pdffillerjs / pdffiller

Take an existing PDF Form and data and PDF Filler will create a new PDF with all given fields populated.
MIT License
286 stars 113 forks source link

Unable to download PDF with special characters like "&$%*" etc. #56

Open sammartinj opened 7 years ago

sammartinj commented 7 years ago

Hey Guys, I have been trying to fix this issue for a while. But it doesn't work. When the file name of the PDF contains "&$*^@!" etc it doesn't download the file. When I checked in the folder: "/var/folders/zx/b_048vz90m78z4703gcx42tw0000gp/T/" PDFTK is trying to create a file in a different file name excluding the special characters.

Example: Filename: "example&Cb-2015-06-30.pdf"

What I find in the folder: "/var/folders/zx/b_048vz90m78z4703gcx42tw0000gp/T/" is: A new file named "example" is created. Which means that, everything after the "&" special symbol are excluded.

I am getting this error on trying the following:

In index.js:

exec( path +" "+ sourceFile + " fill_form " + tempFDF + " output " + destinationFile + " flatten", function (error, stdout, stderr) {

......

}

Error Message

‌Command failed: /bin/sh -c /usr/local/bin/pdftk /Users/xx/Documents/xxx/xxx/xxx/xxx/services/pdfTemplates/xxx_report.pdf fill_form 1489128372502data.fdf output /var/folders/zx/b_048vz90m78z4703gcx42tw0000gp/T/example&Cb-2015-06-30.pdf flatten /bin/sh: Cb-2015-06-30.pdf: command not found