Skip to content

Commit

Permalink
correctif(pdf): ETQ instructeur, lorsque je télécharge un dossier et …
Browse files Browse the repository at this point in the history
…ses PJs, les \t deviennent des ?

>
>
Co-authored-by: colin@darie.eu
  • Loading branch information
Martin committed Oct 31, 2023
1 parent 9866acc commit c075797
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/views/dossiers/show.pdf.prawn
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def maybe_start_new_page(pdf, size)
end

def clean_string(str)
str&.gsub(/[[:space:]]/, ' ') # replace non breaking space, which are invalid in pdf
str&.each_line { _1.gsub(/[[:space:]]/, ' ') } # replace non breaking space, which are invalid in pdf
end

def text_box(pdf, text, x, width)
Expand Down Expand Up @@ -189,6 +189,9 @@ def add_single_champ(pdf, champ)
format_in_2_lines(pdf, tdc.libelle, value)
format_in_2_lines(pdf, "Code Postal :", champ.code_postal) if champ.code_postal?
format_in_2_lines(pdf, "Département :", champ.departement_code_and_name) if champ.departement?
when 'Champs::TextareaChamp'
value = champ.blank? ? 'Non communiqué' : champ.to_s
format_in_2_lines(pdf, tdc.libelle, clean_string(value))
else
value = champ.blank? ? 'Non communiqué' : champ.to_s
format_in_2_lines(pdf, tdc.libelle, value)
Expand Down

0 comments on commit c075797

Please sign in to comment.