I have a generated pdf tool that I use. However I've run into a problem in that my header that I have has information about my user, and my user's address. Problem is that there are times where the header gets cut off if the address is two long. So I'm wondering if there is a possibility to have more than one header?
This is what I am trying to do here, however i've still been having some trouble.
def pdf(admin_fields = false)
tz = @report.user.address.time_zone || Time.zone.name
Time.use_zone(tz) do
html = "<html><head>"
html << %{<meta name='pdfkit-header_center' content="User: #{@report.user.full_name}, #{@report.user.gender.capitalize}, #{@report.user.birth_date.to_formatted_s(:standard_date)}"> }
html << %{<meta name='pdfkit-header_center' content="User: # Address: #{@report.user.full_address}"> }
html << %{<meta name='pdfkit-header_font-size' content="10">}
html << %{<meta name='pdfkit-header_spacing' content="3">}
html << '</head><body>'
html << (I have multiple classes here defined elsewhere in this model)
html << '</body></html>'
PDFKit.new(html).to_pdf
end
end
With what I have here, it is not creating two lines of headers, instead it is looking at the second address and using that one, and ignoring the first one.
Would anyone know if this is possible to change?
Aucun commentaire:
Enregistrer un commentaire