pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Maruan Sahyoun <sahy...@fileaffairs.de>
Subject Re: Weird issue with fonts in input fields after merging
Date Thu, 08 Oct 2015 12:35:45 GMT
Hi,

> Am 08.10.2015 um 13:30 schrieb Johannes Barre <johannes.barre@billfront.com>:
> 
> Hello!
> 
> I have a weird issue. So, I have to PDFs. When I fill form fields in one of
> them and save, everything looks fine. However, when I append this filled
> PDF to another one, xpdf doesn't display the values anymore and complains
> about missing fonts:
> 
> Syntax Error: Unknown font tag 'ProximaNova-Regular'
> Syntax Error: Unknown font in field's DA string
> Syntax Error: Unknown font tag 'ProximaNova-Regular'
> Syntax Error: Unknown font in field's DA string
> 
> I'm using JRuby (9k), but I hope it's understandable for you. I put the
> source & PDFs in this gist:
> https://gist.github.com/iGEL/a8484f0bc44b03fa9de1 (Will delete it later,
> once the issue is solved)
> 
> Other specs: pdfbox-app-1.8.10, openjdk 1.8.0_66, Debian Jessy inside of
> Docker
> 
> As you can see, I use a special way to set the values. I had problems with
> German umlauts using setValue and it also sometimes fails (Possibly related
> to https://issues.apache.org/jira/browse/PDFBOX-1550, the message is the
> same as in that bug)
> 

setting the field value directly using 

form.getField(name).getDictionary.setItem(
    Java::OrgApachePdfboxCos::COSName::V,
    Java::OrgApachePdfboxCos::COSString.new(value)
)

will not update the visual appearance of the filed and as a result the newly set value is
not visible


> The COVER_PAGE.pdf and BIW_FORM.pdf are the templates I'm using,
> form_filled.pdf is just the BIW_FORM.pdf with 2 fields filled and merged is
> COVER_PAGE.pdf and form_filled.pdf merged together.
> 
> The p in line 15 and 22 print out the DA value of the field and it's the
> same for both files:
> 
> "/ProximaNova-Regular 9 Tf 0.019 0.305 0.627 rg" # form_filled.pdf
> "/ProximaNova-Regular 9 Tf 0.019 0.305 0.627 rg" # merged.pdf

the font resource is called /ProximaNova-Regular but that's not in your PDF as the font which
is in your PDF is called /MHGLSX+ProximaNova-Regular. In addition the issue with a font subset
is that only certain characters are part of that subset. As a result some of the characters
you need to display your field value might not be within the subset.

BR
Maruan


> 
> This font is according to pdffonts in both files:
> 
> $ pdffonts form_filled.pdf
> name                                 type              encoding         emb
> sub uni object ID
> ------------------------------------ ----------------- ---------------- ---
> --- --- ---------
> NPQRGV+ProximaNova-Light             Type 1C           Custom           yes
> yes yes    124  0
> *MHGLSX+ProximaNova-Regular           Type 1C           WinAnsi
> yes yes yes    125  0*
> NPQRGV+ProximaNova-Bold              Type 1C           Custom           yes
> yes yes    126  0
> MHGLSX+Facit-Bold                    Type 1C           Custom           yes
> yes yes    127  0
> NPQRGV+ProximaNova-Bold              Type 1C           WinAnsi          yes
> yes yes    218  0
> NPQRGV+ProximaNova-Light             Type 1C           WinAnsi          yes
> yes yes    219  0
> ProximaNova-Bold                     Type 1C (OT)      Custom           yes
> no  no       8  0
> ProximaNova-Light                    Type 1C (OT)      Custom           yes
> no  no       9  0
> NPQRGV+ProximaNova-Bold              Type 1C           WinAnsi          yes
> yes yes    251  0
> NPQRGV+ProximaNova-Light             Type 1C           WinAnsi          yes
> yes yes    252  0
> NPQRGV+ProximaNova-Bold              Type 1C           WinAnsi          yes
> yes yes    254  0
> NPQRGV+ProximaNova-Light             Type 1C           WinAnsi          yes
> yes yes    255  0
> FJORTL+ProximaNova-Light             CID Type 0C       Identity-H       yes
> yes yes    165  0
> NPQRGV+ProximaNova-Bold              Type 1C           WinAnsi          yes
> yes yes    259  0
> NPQRGV+ProximaNova-Light             Type 1C           WinAnsi          yes
> yes yes    260  0
> 
> $pdffonts merged.pdf
> name                                 type              encoding         emb
> sub uni object ID
> ------------------------------------ ----------------- ---------------- ---
> --- --- ---------
> AYOVHV+Facit-Bold                    Type 1C           Custom           yes
> yes yes    131  0
> AYOVHV+ProximaNova-Bold              Type 1C           Custom           yes
> yes yes    132  0
> AYOVHV+ProximaNova-Light             Type 1C           Custom           yes
> yes yes    133  0
> AYOVHV+ProximaNova-Semibold          Type 1C           WinAnsi          yes
> yes yes    134  0
> ProximaNova-Light                    Type 1C (OT)      Custom           yes
> no  no       9  0
> AYOVHV+ProximaNova-Light             Type 1C           WinAnsi          yes
> yes no     192  0
> AYOVHV+ProximaNova-Light             Type 1C           WinAnsi          yes
> yes no     193  0
> NPQRGV+ProximaNova-Light             Type 1C           Custom           yes
> yes yes    275  0
> *MHGLSX+ProximaNova-Regular           Type 1C           WinAnsi
> yes yes yes    276  0*
> NPQRGV+ProximaNova-Bold              Type 1C           Custom           yes
> yes yes    277  0
> MHGLSX+Facit-Bold                    Type 1C           Custom           yes
> yes yes    278  0
> NPQRGV+ProximaNova-Bold              Type 1C           WinAnsi          yes
> yes yes    437  0
> NPQRGV+ProximaNova-Light             Type 1C           WinAnsi          yes
> yes yes    438  0
> ProximaNova-Bold                     Type 1C (OT)      Custom           yes
> no  no     462  0
> ProximaNova-Light                    Type 1C (OT)      Custom           yes
> no  no     512  0
> NPQRGV+ProximaNova-Bold              Type 1C           WinAnsi          yes
> yes yes    500  0
> NPQRGV+ProximaNova-Light             Type 1C           WinAnsi          yes
> yes yes    501  0
> NPQRGV+ProximaNova-Bold              Type 1C           WinAnsi          yes
> yes yes    503  0
> NPQRGV+ProximaNova-Light             Type 1C           WinAnsi          yes
> yes yes    504  0
> FJORTL+ProximaNova-Light             CID Type 0C       Identity-H       yes
> yes yes    377  0
> NPQRGV+ProximaNova-Bold              Type 1C           WinAnsi          yes
> yes yes    451  0
> NPQRGV+ProximaNova-Light             Type 1C           WinAnsi          yes
> yes yes    452  0
> 
> Why are the field values not showing up and how can I fix that?
> 
> Thanks for your help!
> 
> Johannes


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Mime
View raw message