Improve pdf
This commit is contained in:
parent
89ef15f41d
commit
4abae91a5a
3 changed files with 59 additions and 9 deletions
|
|
@ -71,7 +71,6 @@ module PdfDocuments
|
|||
|
||||
def logo
|
||||
@prawn_document.image "app/assets/images/logo-apfelschule.png", width: 150
|
||||
@prawn_document.move_down 30
|
||||
end
|
||||
|
||||
def prepare_rich_text(rich_text)
|
||||
|
|
@ -112,7 +111,11 @@ module PdfDocuments
|
|||
end
|
||||
|
||||
def image(attachable, **args)
|
||||
@prawn_document.image(ActiveStorage::Blob.service.path_for(attachable.key), **args) rescue StandardError do false end
|
||||
begin
|
||||
@prawn_document.image(ActiveStorage::Blob.service.path_for(attachable.key), **args) && raise("david")
|
||||
rescue StandardError
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
def without_page_break(&block)
|
||||
|
|
@ -140,8 +143,8 @@ module PdfDocuments
|
|||
@prawn_document.text("absolute right: #{Float(@prawn_document.bounds.absolute_right).round(2)}")
|
||||
end
|
||||
|
||||
def new_page
|
||||
@prawn_document.start_new_page
|
||||
def new_page(required_space: 0)
|
||||
@prawn_document.start_new_page if @prawn_document.cursor <= required_space + 10
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue