pdftk unicode works in preview but not adobe acrobat

69 views Asked by At

I generate a PDF file and the unicode text appears in macos preview but not acrobat.

I have the following fdf file

%FDF-1.2
1 0 obj
<<
/FDF
<<
/Fields [
<<
/T (name)

/V <FEFF0793>
>>]
>>
>>
endobj
trailer
<<
/Root 1 0 R
>>
%%EOF

The main thing is FEFF0793 which is utf16be encoded, and it should render the ޓ character (https://www.compart.com/en/unicode/U+0793)

pdftk form4.pdf fill_form fdf output 6.pdf

My form4.pdf

When I view it in MacOS preview, it doesn't appear until I click

enter image description here

enter image description here

but in acrobat it appears as a bullet point

enter image description here

Here is the fonts embedded. Whats the problem here? Why doesn't it appear in acrobat?

The font is from here: https://fonts.google.com/noto/specimen/Noto+Sans+Thaana

It's added to my MacOS fontbook, so not sure whats happening here. What if I had custom fonts that aren't part of my fontbook but I want to use their unicode values. What do I do here?

enter image description here

1

There are 1 answers

6
iPDFdev On

The problem is Acrobat does not have a default font to be used with this script. Even after installing Non Sans Thaana in Windows, Acrobat cannot display the character.

The only solution is to associated the Thaana font with the form field when you create the form. This operation will embed the font in the PDF file and the form will be displayed correctly. Form field with Thaana font Embedding the font with Ghostscript like in your comment does not help as it does not associated the font with the form field.

The problem with pdftk is that it does not create appearances (explicit graphics for displaying the field value) for the form fields, it relies on the viewer to create them. Acrobat, with the embedded Thaana font, will create a proper appearance for the form field but other viewers might not create them.