I am using Dynamic PDF Generator 4.0 and have been successful embedding TrueType fonts using code like:
TrueTypeFont arialNarrow = new TrueTypeFont("ArialN.ttf");
TrueTypeFont arialNarrowBold = new TrueTypeFont("ArialNB.ttf");
TrueTypeFont arialNarrowItalic = new TrueTypeFont("ArialNI.ttf");
TrueTypeFont arialNarrowBoldItalic = new TrueTypeFont("ArialNBI.ttf");
newFontFamily = new FontFamily("Arial Narrow", arialNarrow, arialNarrowBold, arialNarrowItalic, arialNarrowBoldItalic);
The resulting PDF displays text with the Arial Narrow font just fine if I create the PDF on disk via
_pdfDoc.Draw(String.Format(@"{0}\{1}", job.OutputDir, job.PDFName))
But, if I instead output the PDF to the web, via
_pdfDoc.DrawToWeb();
then the resulting Adobe Reader complains:
"Cannot extract the embedded font 'DCXFOI+ArialNarrow-Bold'. Some characters may not display or print correctly."
and any text typset with the Arial Narrow Bold font displays as dots.
Is there some trick to embedding fonts in PDFs destined for display via the web?
Font Embedding for Web Output
Re: Font Embedding for Web Output
Support · Dec 11, 2009Hello,
You can set the Embed property of the TrueTypeFont object to True and that will embed the font in the output PDF file.
Thanks,
ceTe Software Support Team
Re: Font Embedding for Web Output
Forum member · Dec 14, 2009Well that sounds reasonable, but didn't help. I changed my code to:
TrueTypeFont arialNarrow = new TrueTypeFont("ArialN.ttf");
arialNarrow.Embed = true;
TrueTypeFont arialNarrowBold = new TrueTypeFont("ArialNB.ttf");
arialNarrowBold.Embed = true;
TrueTypeFont arialNarrowItalic = new TrueTypeFont("ArialNI.ttf");
arialNarrowItalic.Embed = true;
TrueTypeFont arialNarrowBoldItalic = new TrueTypeFont("ArialNBI.ttf");
arialNarrowBoldItalic.Embed = true;
newFontFamily = new FontFamily("Arial Narrow", arialNarrow, arialNarrowBold, arialNarrowItalic, arialNarrowBoldItalic);
_fontFamilies.Add(newFontFamily);
But I still get the same message. The Embed property seems to default to true anyway, and the message from Adobe Reader implies that the font is indeed embedded. The messages starts off
"Cannot extract the embedded font . . ."
Re: Font Embedding for Web Output
Support · Dec 14, 2009Hello,
The true type fonts added to the PDF will be subset embedded by default and it should not cause any problem in viewing the text. Can you please try using the latest build of our product downloading from our CustomerArea
by logging in using your serial number.
If this does not solve your problem then please send over the font files and the code you are using to our [^a|mailto:support@cete.com|Support Team^] so that they can look into it further.
Thanks,
ceTe Software Support Team.
Re: Font Embedding for Web Output
Forum member · Dec 14, 2009I knew you'd asked me for sample code, so I started writing a throw-away WebApp I could send you. I stumbled across something interesting. When we output to web we add some security settings:
StandardSecurity security = new StandardSecurity("");
security.AllowCopy = true;
security.AllowEdit = false;
security.AllowPrint = true;
_pdfDoc.Security = security;
If I comment out those lines, my font embeds correctly.
Any thoughts on why applying security interferes with my font embedding?
Re: Font Embedding for Web Output
Support · Dec 14, 2009Hello,
Setting the Security object should not interfere with the embedding of the font. By default the Embed property for the Font is set to true. We will do some testing on our end and post the results soon.
Thanks,
ceTe Software Support Team
Re: Font Embedding for Web Output
Support · Dec 15, 2009Hello,
We do not see any problem when using security and fonts together. Can you please make sure that you are using the latest build of our product? You can download it from our CustomerArea
by logging in using your current serial number.
If you are still have problem then please send over the code and the output PDF file you are getting to our [^a|mailto:support@cete.com|Support Team^] so that they can look into it further.
Thanks,
ceTe Software Support Team.
Re: Font Embedding for Web Output
Forum member · Dec 15, 2009Yes, if I use DynamicPDF Generator v 5.1.2 the problem goes away.
I will look into purchasing an upgrade. Thank you for your help.