Android font specification for PDF documents

38 views
Skip to first unread message

Ron Allan

unread,
Jan 6, 2015, 1:26:27 PM1/6/15
to pdfne...@googlegroups.com
I am trying to control the fonts that are used for viewing PDF files on Android phone and tablet. The documentation says that the best possible match will be taken from pdfnet.res when rendering a PDF in the client viewer. Is it possible to constrain the fonts contained in pdfnet.res to a subset of what is currently included? For example, limit the font types to courier, times new roman, and tahoma, or some other subset.

Particulars:
Platform: Android phone and tablet
Version of PDFTron: 6.3.2 (6.3.2.27718)

Regards,

Ron

Shirley Gong

unread,
Jan 6, 2015, 5:56:05 PM1/6/15
to pdfne...@googlegroups.com
Hi Ron,

Just to clarify, inside PDFNet, it only contains base 14 fonts
When a PDF document does not have embedded fonts, and the fonts needed are non-base 14 fonts, it tries to load best suitable font that is available on the system. Therefore, font selection will depend on what fonts are available in the system.

To override default PDFNet font selection, you can use PDFNet.addFontSubst.
For example, to use DroidSans as default font:

File fontDroidSans = new File("/system/fonts/DroidSans.ttf");

PDFNet.addFontSubst(PDFNet.e_Identity, fontDroidSans.getAbsolutePath());

Best Regards,
Shirley

Support

unread,
Jan 7, 2015, 1:15:30 AM1/7/15
to pdfne...@googlegroups.com

For more samples of how to use addFontSubst() see commented out code at beginning of PDFDraw sample:


On Tuesday, January 6, 2015 10:26:27 AM UTC-8, Ron Allan wrote:
Reply all
Reply to author
Forward
0 new messages