SammyBlackBaron
SammyBlackBaron

Reputation: 897

How to use Arial in PDF using TCPDF without embedding

I have successfully added the font Arial to TCPDF, however the filesize is large due to it embedding the font. I would have thought Arial was a standard font on the vast majority of users machines, so is there a way of it working by using Arial if available, then Helvetica if not, then any sans-serif font as a backup?

Upvotes: 4

Views: 8095

Answers (2)

SammyBlackBaron
SammyBlackBaron

Reputation: 897

I found that if I remove all arial files in the fonts folder other than the ones ending in .php, the filesize drops to around 500KB, just like the other core fonts in tcpdf. I would imagine that this means they are now not embedded and will revert to another sans-serif font on the users machine if they don't have arial.

Upvotes: 0

Marc B
Marc B

Reputation: 360632

You can subset the font, which embeds only the glyphs that are actually used in your document. That'll save some space as Arial has glyphs for a very very large swath of the Unicode character space.

it's the last argument in the setFont() call (scroll to the bottom of the page).

Upvotes: 3

Related Questions