pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tilman Hausherr <THaush...@t-online.de>
Subject Re: Embedded vs. non-embedded fonts (PDFBox & iText)
Date Thu, 06 Apr 2017 21:03:48 GMT
Am 06.04.2017 um 13:37 schrieb Vassallo, Fabio:
> Thank you for you answer, Tilman.
>
> As I would like to try to remove the embedded fonts from the PDF file, Is it possible
to do it using a PDFBox code?

Yes; from a PDFont object, then get the font descriptor, then can call 
.getCOSObject() on it and then manipulate from there, i.e. remove 
FontFile / FontFile2 / FontFile3 from the font descriptor.

Tilman

>
> Fabio
>
>> It might be possible to create your own different encoding as described
>> in page 264 of the PDF specification, and delete the embedded font
>> later. I haven't tested it and won't do it, and here's why: you should
>> embed your fonts. Not embedding might result in weird effects with some
>> viewers, e.g. getting different glyphs, squares or nothing at all. So it
>> would be several hours of work to create a bad PDF file with some code
>> that is hard to understand.
>>
>> Are you aware that you can embed subsets? These are much smaller than
>> full fonts. Use PDType0Font.load().
>> Tilman
>
> Fabio Vassallo
> Product Development (CIS)
>
>
> Würth Phoenix S.r.l.
> via Kravogl 4, 39100 Bolzano
> T: +39 0471 564 116
> F: +39 0471 564 122
> Website | e-Mail | Map
>
>            
>
> -----Original Message-----
> From: Tilman Hausherr [mailto:THausherr@t-online.de]
> Sent: Tuesday, April 4, 2017 6:08 PM
> To: users@pdfbox.apache.org
> Subject: Re: Embedded vs. non-embedded fonts (PDFBox & iText)
>
> See my answer from 10.3.2017.
>
> Tilman
>
> Am 04.04.2017 um 12:01 schrieb Vassallo, Fabio:
>> Good morning.
>>
>> I'm currently using PDFBox to build documents for the company I’m
>> working for, and I need to print strings with generic character, also
>> non in the WinAnsiEncoding range (e.g. “ł”).
>>
>> And I shouldn’t embed fonts in the PDF documents.
>>
>> If I use the internal PDFBox fonts (e.g. PDType1Font.HELVETICA)
>> apparently no fonts are than embedded in the document.
>>
>> So I assume that the document, when displayed, refers to Fonts present
>> in the PC (Arial?); nevertheless PDPageContentStream.showText() throws
>> an IllegalArgumentException for such “special” characters.
>>
>> Using iText I could use the following call:
>>
>> *Font myFont = com.itextpdf.text.FontFactory.getFont(name, size,
>> style, color);*
>>
>> Using variable “myFont”, now I can refer to the font with no font
>> embedding, and I can use also non-WinAnsiEncoding characters.
>>
>> Is there any way or workaround in PDFBox to generate a file with no
>> embedded files and with “special” characters?
>>
>> If not, will it be possible in one of the next PDFBox releases?
>>
>> Thank you very much in advance,
>>
>> Fabio Vassallo
>>
>> *Fabio Vassallo*
>> Product Development (CIS)
>> http://hafisherhomes.com/wp-content/themes/hughfisher/img/galleryDivid
>> erLine.png
>>
>> cid:image001.png@01D18B3E.92F52E70
>>
>> Würth Phoenix S.r.l.
>> via Kravogl 4, 39100 Bolzano
>>
>> T: +39 0471 564 116
>>
>> F: +39 0471 564 122
>>
>> Website <http://www.wuerth-phoenix.com/>| e-Mail
>> <mailto:fabio.vassallo@wuerth-phoenix.com>| Map
>> <https://www.google.de/maps/place/Wuerth+Phoenix+S.R.L./@46.474192,11.
>> 33141,15z/data=%214m2%213m1%211s0x0:0x98a5db69edb2a02?hl=en>
>> http://hafisherhomes.com/wp-content/themes/hughfisher/img/galleryDivid
>> erLine.png
>>
>> twitter-2 <https://twitter.com/WuerthPhoenix>wordpress-2
>> <http://www.neteye-blog.com/>linkedin
>> <https://www.linkedin.com/company/wuerth-phoenix>youtube
>> <https://www.youtube.com/user/WuerthPhoenix>http://feng-shui-web.net/b
>> log2/wp-content/uploads/2016/02/xing-icon.png
>> <https://www.xing.com/companies/w%C3%BCrthphoenixsrl>facebook
>> <https://www.facebook.com/wuerthphoenix>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>


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


Mime
View raw message