jkraemer / pdf-forms

Fill out PDF forms with pdftk (http://www.accesspdf.com/pdftk/).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

UTF-8 chars are not displayed in the filled PDF

oki opened this issue · comments

Hi,

I have test pdf: http://s000.tinyupload.com/?file_id=77431117353383489288

I am filling in data with small script:

require "pp"

template_file = File.join(Rails.root, "form_example.pdf")
output_file = "output.pdf"

pdftk = PdfForms.new(`which pdftk`.chomp, utf8_fields: false, data_format: "XFdf")

pp pdftk.get_field_names template_file

pdf_data = {
  "name" => "różowy słoń ma usiąść na tępych gwoździach"
}

pdftk.fill_form template_file, output_file, pdf_data

After run got: http://take.ms/DrupC all utf8 letters dissapear (except ó)
Also attached generated pdf file: http://s000.tinyupload.com/index.php?file_id=32840734551043583650

Any idea what the problem is here? Why UTF-8 chars are not displayed?
Thanks for any help or experience.

Running pdftk output.pdf dump_data_fields_utf8 yields the following result:

---
FieldType: Text
FieldName: name
FieldFlags: 0
FieldValue: różowy słoń ma usiąść na tępych gwoździach
FieldJustification: Left

I'd say the data is stored properly but your PDF lacks the proper font to display them.

this should be a disclaimer in the readme 😄

good point