Font issue with PDFtk

前端 未结 2 1105
野的像风
野的像风 2021-02-05 06:26

I\'m having difficulties filling in a form using pdftk with text fields with true type fonts.

  • Font files (.ttf) are added to /Library/Fonts (OSX Maver
相关标签:
2条回答
  • 2021-02-05 07:02

    This was causing a huge headache for me for 2 days. It turns out I was focusing on the wrong end of the problem.

    A nice alternative that isn't as manual and only has to be done once is to enter some text in a field of the source PDF form, in your case ./my_form.pdf. I don't know EXACTLY why this works, but it does. that way if you want to create a new file at any time, you dont have to go through this trouble :)

    0 讨论(0)
  • 2021-02-05 07:24

    I was getting the same java.lang.ArrayIndexOutOfBoundsException: 0 error using pdftk to fill forms on an Adobe Acrobat generated PDF. This question is super old, but I couldn't find a consistent answer on stackoverflow or elsewhere so I figured I'd post my fix.

    What ended up working for me:

    1. Opening the PDF in the OS X app Preview
    2. Clicking into a form field, adding text then deleting that text (so nothing is actually changed)
    3. Saving it

    4. Running the PDF through pdftk again

    I'm not that familiar with encoding or PDFs in general, but saving the PDF with Preview seems to fix the encoding or at least get it to a place where pdftk can work with it. Good luck.

    0 讨论(0)
提交回复
热议问题