Improve pdf
Some checks failed
/ Run tests (push) Successful in 2m9s
/ Run system tests (push) Failing after 2m35s
/ Build, push and deploy image (push) Successful in 1m33s

This commit is contained in:
david 2024-11-24 00:58:36 +01:00
parent 89ef15f41d
commit 4abae91a5a
3 changed files with 59 additions and 9 deletions

View file

@ -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