Thanks for reply,

the pdf looks correct in pdf debugger and reader, thus if it can display the 
"%" sign why pdfbox can't calculate the width ?
It lacks a part in the puzzle.
How to determine if it’s a subset ?

The toUnicode seems to have the character "%" .. 0025 ...
 <0001> <0024> [<0025> <004E> <0041> <004D> <0045> <003A> <0043> <0054>

thanks,
 David 
 


-----Ursprüngliche Nachricht-----
Von: John Hewson [mailto:[email protected]] 
Gesendet: Montag, 30. Mai 2016 18:52
An: [email protected]
Betreff: Re: unable to calculate text width


> On 25 May 2016, at 01:14, Croe.David <[email protected]> wrote:
> 
> Dear all,
> 
> i'm trying to replace and center a text in a pdf which has been created by 
> phantomjs.
> 
> I'm not sure if it's a problem within phantomjs or pdfbox, but I get 
> following exception while calculating the text width of a string starting 
> with Symbol %:
> 
> Exception in thread "main" java.lang.IllegalArgumentException: No glyph for 
> U+0025 in font TimesNewRomanStandard
>       at 
> org.apache.pdfbox.pdmodel.font.PDCIDFontType2.encode(PDCIDFontType2.java:411)
>       at 
> org.apache.pdfbox.pdmodel.font.PDType0Font.encode(PDType0Font.java:351)
>       at org.apache.pdfbox.pdmodel.font.PDFont.encode(PDFont.java:286)
>       at 
> org.apache.pdfbox.pdmodel.font.PDFont.getStringWidth(PDFont.java:315)
> 
> 
> in PDCIDFontType2:
> isEmbedded is true
> parent.getCMap().getName() is Identity-H cmap is null cid is -1
> 
> 
> 
> a closer look with pdfdebugger , this is the toUnicode:
> 
> /CIDInit /ProcSet findresource begin
> 12 dict begin
> begincmap
> /CIDSystemInfo << /Registry (Adobe) /Ordering (UCS) /Supplement 0 >> 
> def /CMapName /Adobe-Identity-UCS def /CMapType 2 def
> 1 begincodespacerange
> <0000> <FFFF>
> endcodespacerange
> 2 beginbfrange
> <0000> <0000> <0000>
> <0001> <0024> [<0025> <004E> <0041> <004D> <0045> <003A> <0043> <0054> 
> <0052> <0062> <0065> <0073> <0074> <0061> <006E> <0064> <0020> <006D> 
> <0069> <0066> <006F> <006C> <0067> <0072> <0050> <0075> <006B> <007A> 
> <0068> <0055> <004B> <0044> <00FC> <0042> <0079> <0070> ] endbfrange 
> endcmap CMapName currentdict /CMap defineresource pop end end
> 
> how to calculate the width or fix the problem ?

As Tilman has suggested, this font is likely a subset and does not contain that 
symbol. You may be able to configure phantoms to not subset fonts, I believe 
that it uses CUPS-PDF for this.

— John

> best regards,
>   David Croé
> ____________________________________________________________
> 
> [https://www.inside-online.de/mail/footer/anbieter_des_jahres.jpg]<htt
> p://www.inside-online.de/de/pressemeldungen-news/anbieter-des-jahres-2
> 016.html?utm_source=Signatur&utm_medium=E-Mail&utm_campaign=Signatur-A
> nbieter-des-Jahres> Danke an unsere Kunden für die Wahl zum Anbieter 
> des Jahres 2016!
> Kontaktieren Sie uns 
> hier<http://www.inside-online.de/de/kontaktieren.html?utm_source=Signatur&utm_medium=E-Mail&utm_campaign=Signatur-Anbieter-des-Jahres>
>  und erfahren Sie, warum uns unsere Kunden zum Anbieter des Jahres gewählt 
> haben.
> Gerne sprechen wir auch über Ihr E-Learning-Projekt!
> ____________________________________________________________


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]





Reply via email to