Am 12.03.2018 um 14:27 schrieb Christopher Schultz:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Tilman,

On 3/10/18 6:26 AM, Tilman Hausherr wrote:
Am 09.03.2018 um 21:57 schrieb Tilman Hausherr:
You can subset fonts by using PDType0Font.load(), this limits
memory usage.
I meant "file size".

Also important: try to use each font only once per file. You can
reuse fonts and images within a file. See also

https://stackoverflow.com/questions/48377121/pdfbox-generates-pdf-a-fi
le-of-very-large-size

Okay,
we don't have any calls to any font's load() method... we are
simply using PDType1Font.CONSTANTS for our various fonts (HELVETICA_*
and TIMES_*). Will that give roughly the same behavior? We don't seem
to be having any problems with file size (yet).

With Times/Helvetica/Courier you can use only the characters from WinAnsiEncoding, see Appendix D in the PDF specification. This is not much.


I'm not even really sure what our options are for fonts; our usage of
PDFBox is quite simplistic. Let's say I want to be able to render a
character such as ® or ≤ in a PDF. How do I go about discovering which
(available) font contains the proper mapping, and then ensure that
font's glyphs are included in the PDF?

Call PDFont.encode and catch the IllegalArgumentException.

® or ≤ might be in Symbol or Zapf Dingbats. These are also part of the standard 
14 fonts that you can use easily.



Is it better to pick a font for
the whole document that includes that glyph, or is it better to change
the font for a single character, just to get the right display?

This depends on whether the font for the special characters looks similar to the standard 14 fonts (Times, Helvetica, Courier). If yes then use the extra font only for the special characters. If no, then use the special font for all characters.

Tilman

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

Reply via email to