! instances : prawn does not like svg

win 10% on pdf generation
This commit is contained in:
simon lehericey 2022-03-28 15:10:37 +02:00
parent ba688a477a
commit af27af7900
7 changed files with 4 additions and 9 deletions

View file

@ -59,7 +59,6 @@ gem 'openid_connect'
gem 'pg'
gem 'phonelib'
gem 'prawn-rails' # PDF Generation
gem 'prawn-svg'
gem 'premailer-rails'
gem 'puma' # Use Puma as the app server
gem 'pundit'

View file

@ -459,9 +459,6 @@ GEM
prawn
prawn-table
rails (>= 3.1.0)
prawn-svg (0.31.0)
css_parser (~> 1.6)
prawn (>= 0.11.1, < 3)
prawn-table (0.2.2)
prawn (>= 1.3.0, < 3.0.0)
premailer (1.14.2)
@ -840,7 +837,6 @@ DEPENDENCIES
pg
phonelib
prawn-rails
prawn-svg
premailer-rails
pry-byebug
puma

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View file

@ -181,7 +181,7 @@ prawn_document(page_size: "A4") do |pdf|
italic: Rails.root.join('lib/prawn/fonts/marianne/marianne-thin.ttf' ),
})
pdf.font 'marianne'
pdf.svg IO.read(DOSSIER_PDF_EXPORT_LOGO_SRC), width: 300, position: :center
pdf.image DOSSIER_PDF_EXPORT_LOGO_SRC, width: 300, position: :center
pdf.move_down(40)
render_in_2_columns(pdf, 'Démarche', @dossier.procedure.libelle)

View file

@ -217,7 +217,7 @@ prawn_document(page_size: "A4") do |pdf|
pdf.font 'marianne'
pdf.pad_bottom(40) do
pdf.svg IO.read(DOSSIER_PDF_EXPORT_LOGO_SRC), width: 300, position: :center
pdf.image DOSSIER_PDF_EXPORT_LOGO_SRC, width: 300, position: :center
end
format_in_2_columns(pdf, 'Dossier Nº', @dossier.id.to_s)

View file

@ -69,7 +69,7 @@ DS_ENV="staging"
# PROCEDURE_DEFAULT_LOGO_SRC="republique-francaise-logo.svg"
# Instance customization: PDF export logo ---> to be put in "app/assets/images"
# DOSSIER_PDF_EXPORT_LOGO_SRC="app/assets/images/header/logo-ds-wide.svg"
# DOSSIER_PDF_EXPORT_LOGO_SRC="app/assets/images/header/logo-ds-wide.png"
# Instance customization: watermark for identity documents
# WATERMARK_FILE=""

View file

@ -17,4 +17,4 @@ MAILER_FOOTER_LOGO_SRC = ENV.fetch("MAILER_FOOTER_LOGO_SRC", "mailer/instructeur
PROCEDURE_DEFAULT_LOGO_SRC = ENV.fetch("PROCEDURE_DEFAULT_LOGO_SRC", "republique-francaise-logo.svg")
# Logo in PDF export of a "Dossier"
DOSSIER_PDF_EXPORT_LOGO_SRC = ENV.fetch("DOSSIER_PDF_EXPORT_LOGO_SRC", "app/assets/images/header/logo-ds-wide.svg")
DOSSIER_PDF_EXPORT_LOGO_SRC = ENV.fetch("DOSSIER_PDF_EXPORT_LOGO_SRC", "app/assets/images/header/logo-ds-wide.png")