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: font subset
Date Mon, 13 Jun 2016 16:27:27 GMT
Am 13.06.2016 um 09:49 schrieb Croe.David:
> hi,
> i would like to add headers/footers to each page of a pdf file. footers may contain dynamic
data like page numbers. current approach is to copy those headers/footers from a template
pdf file, but then the font is missing.
> As far as I've understood each page has its own font resources , is that correct ? or
is it possible to embed fonts for a whole file and reference them?
> Does pdfbox offer a way to embed only a subset of a font to decrease the file size?

You can direct PDFBox to subset a font:

     PDFont font = PDType0Font.load(doc, new 
File("c:/windows/fonts/simhei.ttf"));

You can use that font object for several pages of a document, i.e. you 
don't have to call load() again. Note that all released 2.0 versions 
have a bug which may occur with fonts that are partially or completely 
monotype. (You'll see it when it happens, glyphs will appear in wrong 
positions) This will be fixed in the next release.

Tilman

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


Mime
View raw message