Welcome Guest Search | Active Topics | Sign In | Register

Using embedded fonts already in an existing PDF Options
Michael
Posted: Tuesday, August 26, 2014 8:33:17 PM
Rank: Newbie
Groups: Member

Joined: 8/26/2014
Posts: 5
Hi,
I’m using the 4.0.45.2 version of the EO .PDF Class Library. If I use PdfDocument to load an existing PDF file that obviously has fonts embedded in it, can I use HtmlToPdf.ConvertHtml to add additional text to the existing PDF and reference the embedded fonts (by name) so the new text is rendered using those fonts? Or, do I have to have those fonts installed on my computer in order to utilize those fonts?
eo_support
Posted: Tuesday, August 26, 2014 8:57:40 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,196
Hi,

You can not use existing embedded font. The reason is PDF does not embed the whole font, it only embed the character it used. For example, if your PDF use font "Verdana" for text "abc", then the result PDF file will embed font "Verdana" in the file, but only with data for three characters "abc". If you wish to add a letter "d" to the PDF file, you still need font "Verdana" on your system since the existing embedded "Verdana" font in the file doesn't have any data for letter "d" at all.

For version 4 you will need the font to be installed on your system. For the latest version you can use CSS @font-face directly to dynamically load a font in the page without actually install it. If you are not familiar with font-face, you can search it online and you should be able to find plenty of information about it.

Thanks!

Michael
Posted: Wednesday, August 27, 2014 7:02:17 PM
Rank: Newbie
Groups: Member

Joined: 8/26/2014
Posts: 5
Ok. I installed the font I want to use, but I'm getting the following exception from the Html to Pdf engine. The font I'm trying to use is Lavanderia Regular. According to this link (http://www.essentialobjects.com/forum/postst5721_Can-I-embed-a-font-into-a-new-pdf.aspx) I should be able to use this font. Windows says this is a OpenType font (OpenType Layout, PostScript Outlines) and it has a .otf file extension. I have a test C# application that demonstrates the issue if you would like to see it.

Unhandled Exception: EO.Pdf.HtmlToPdfException: Convertion failed. Object reference not set to an instance of an object. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at EO.Pdf.Internal.gh.a(Char A_0, Boolean A_1)
at EO.Pdf.Internal.fr.a(String A_0, Boolean A_1, gh A_2, Single A_3, Int32[]A_4, Int32 A_5, Single& A_6)
at EO.Pdf.Internal.fr.b(ke A_0)
at EO.Pdf.Internal.fr.a(kb[] A_0)
at EO.Pdf.Internal.fr..ctor(lw A_0, Boolean A_1, Int32 A_2, kz A_3, Int32 A_4, Single A_5, Rectangle A_6, PdfPage A_7, fg A_8, Int32 A_9, Graphics A_10)
at EO.Pdf.Internal.lw.a(PdfPage A_0, Boolean A_1, Int32 A_2, Rectangle A_3, kz A_4, hf A_5, Graphics A_6)
at EO.Pdf.Internal.lw.a(Int32 A_0, HtmlToPdfResult A_1)
at EO.Pdf.Internal.lw.d()
--- End of inner exception stack trace ---
at EO.Pdf.HtmlToPdfException.b(Exception A_0)
at EO.Pdf.Internal.lw.d()
at EO.Pdf.HtmlToPdfSession.RenderAsPDF(PdfPage page)
at EO.Pdf.HtmlToPdf.ConvertHtml(String html, PdfPage page, HtmlToPdfOptions options)
at TestPdfUpdate.Program.Main(String[] args) in C:\temp\TestPdfUpdate\Program.cs:line 25
eo_support
Posted: Wednesday, August 27, 2014 7:20:10 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,196
Hi,

You need to update your EO.Pdf to the current version as well. I believe your version only supported TrueType outline. PostScript outline support is something added rather recently.

Thanks!
Michael
Posted: Wednesday, August 27, 2014 8:02:15 PM
Rank: Newbie
Groups: Member

Joined: 8/26/2014
Posts: 5
Cool! Good to know. Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.