Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Filling PDF form with PDFTK (or php/javabridge) ignoring certain unicode chars

Possibly related question 1, Related question 2

What We're trying to accomplish:
Use drupal webform submition data as a source to fill a PDF form and serve it to the user, flattened for printing. We're trying to deploy this on Drupal 6 and later on Drupal 7. Site is a large D6 site deployed on a CentOS VPS. We're in the process of moving it to D7.

Links:

  • Module for filling PDFs
  • Module for webforms

Our problem:
No matter what we try we can not get certain Unicode(utf-8) chars to be inserted into the PDF.
Specifically these do not work: č, đ, ć
These work: š, ž
NOTE: This has to work as these chars are common in names and surnames of Slovenians, and this pdf is a printout for a contract in Slovenia.

What we tried:
We first used PDFTK that our sysadmin built from source. We tried 1.41 and 1.41. He than found a package of both version and we tested them both. None worked. We than analyzed the module and used the same command line function with a striped down example. It produced the same result. We tried PDF generated on a Mac that was converted from a DOC, than fields added with Adobe Acrobat Pro. Than we tried a PDF created with LibreOffice on Linux Mint. Both produced the same results. This problem has been replicated on CentOS vps, CentOS virtualbox install of our sysadmin and a ubuntu 10.04 devbox and across 2 D6 vanilla installs, 1 D7 vanilla install and on the production D6 install. We also tried the second option given by the fillpdf module: java/tomcat bridge (More here). This was tried on the ubuntu 10.04 devbox and it also did not work. We also tried the provided software-as-a-service PDFTK service FillPDF service and it also produced the same result.

Any ideas what could be wrong? Any ideas how to get this done (even with the use of other system, services, custom code etc.)?

like image 329
Putr Avatar asked Jan 05 '12 11:01

Putr


1 Answers

Try using: http://sourceforge.net/projects/pdfformfiller2/files/.

For instalation do this:

Fillpdf:

drush dl fillpdf
drush en fillpdf

Webform:

drush dl webform
drush en webform

Webform tokens:

drush dl webform_tokens
drush en webform_tokens

PDF form filler 2:

itext-xtra-5.2.0.jar 0060b17c2ca9ee33a39806a8bad461e2

itextpdf-5.2.0.jar   ea0173384c42986e269da4fb67d0a391

pdfformfiller.jar    9109ecb8f887ea40719480134ed73ddd

pdf_filler.sh

You will also need this java packages on server:

giflib-4.1.3-7.3.3.el5.i386.rpm

java-1.6.0-openjdk-1.6.0.0-1.27.1.10.8.el5_8.i386.rpm

tzdata-java-2012c-1.el5.i386.rpm

chmod +x pdf_filler.sh

pdf_filler.sh should be in $PATH
like image 184
artuh Avatar answered Sep 19 '22 12:09

artuh