Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Pdftk Fill forms with special chars

pdf pdftk

This topic has been archived. This means that you cannot reply to this topic.
4 replies to this topic

#1 Vaielab

Vaielab

    Programming God

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1382 posts

Posted 26 March 2015 - 11:48 AM

Hello,

I'm currently trying to fill a pdf form via command line (to be later able to execute this via php).
After some search, I find out that I can either use a fdf file or a xfdf file.
And with the command pdftk Test01.pdf fill_form fields2.xfdf output output.pdf flatten
It's working fine.

But if the xfdf or fdf file have a special chars (éàêĉ...), this char is simply not render.
Anyone have a idea?

I'm uploading a pdf demo, and my xfdf file for you to test

 

--- Edit

For some reason, I can't seem to be able to upload the xfdf file, since the file is quite simple, here the content

<?xml version="1.0" encoding="UTF-8"?>
<xfdf xmlns="http://ns.adobe.com/xfdf/" xml:space="preserve">
    <fields>
        <field name="Nom">
            <value>allo&#233;éè\223</value>
        </field>
    </fields>
    <ids original="c7a58949ae24d48d53aa9ac2b92557f8" modified="1427398676" />
    <f href="Test01.pdf" />
</xfdf>

I've tried multiple way to encode it, but none is working

Attached Files


Edited by Vaielab, 26 March 2015 - 11:50 AM.

You can now stalk me on linkedin: http://ca.linkedin.c...elle/24/b44/88/ !


#2 BlackRabbit

BlackRabbit

    CodeCall Legend

  • Expert Member
  • PipPipPipPipPipPipPipPip
  • 3871 posts

Posted 28 March 2015 - 02:07 PM

I've heard it's a well known unicode fail.

Instead, you could use pdf-merge.py --unicode



#3 Vaielab

Vaielab

    Programming God

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1382 posts

Posted 30 March 2015 - 08:47 AM

Hello,

Thanks for the answer,

I'm searching on the web for the correct syntax to use pdf-merge, but I'm still having error when I'm trying to execute

I get this error message:

sh pdf-merge.py --output=final.pdf Test01.pdf test.xfdf 
pdf-merge.py: 1: pdf-merge.py: --pdfmarks: not found
pdf-merge.py: 23: pdf-merge.py: Merge PDFs preserving bookmarks.

Thanks to Larry Cai for suggesting that Unicode be supported and for
discussion about the  option.
: not found

Do you have an idea?


You can now stalk me on linkedin: http://ca.linkedin.c...elle/24/b44/88/ !


#4 BlackRabbit

BlackRabbit

    CodeCall Legend

  • Expert Member
  • PipPipPipPipPipPipPipPip
  • 3871 posts

Posted 31 March 2015 - 06:45 PM

It seems an install issue.

 

Does this link help?



#5 Vaielab

Vaielab

    Programming God

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1382 posts

Posted 17 April 2015 - 05:21 AM

I never manage to make pdf-merge.py worked, but I find a solution:

After testing, I saw that if the pdf was created with libreoffice insted of adobe acrobat, I was able to write specials chars with pdttk

Sadly, libreoffice didn't had all the options I needed.

But if I create the pdf with adobe acrobat, save it, and open it with pdf architech 3 (a free pdf maker), put the cursor in every single textbox (no idea why), and do a save as, it now work...

 

If I don't put the cursor in a textbox, that textbox will not accept special chars

And at the end I have to do a save as not a normal save since pdf architech don't see any change in the document...

 

So basically I have no idea why it's working... but it's working :D


You can now stalk me on linkedin: http://ca.linkedin.c...elle/24/b44/88/ !





Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download