Quantcast
Channel: Aspose.Pdf Product Family
Viewing all articles
Browse latest Browse all 3131

XSL-FO Font Naming Issue

$
0
0
Hi,

I have been using the Aspose.PDF library to render XSL-FO as a PDF but have encountered a Font Naming issue where the font cannot be found when printing.  In working with through the issue it was found that the /BaseFont value being stored in the PDF does not follow the PostScript naming schema.

Here is the documentation I found from the Adobe site:  http://partners.adobe.com/public/developer/en/font/5088.FontNames.pdf

Sec 2.2 mentions that the FontName generally consists of the family name followed by a hyphen and then styling attributes.

Given that info, if my XSL-FO element had a font-family="Arial" and a font-weight="bold" then the /BaseFont value in the PDF would be "Arial-Bold" (which works correctly) but when using the Aspose.Pdf.Generator.PDF::BindFO function the /BaseFont written out to the PDF is "ArialBold" which fails the font look up.

Here is the code i used to generate the PDF and attached is a sample xml:

global::Aspose.Pdf.Generator.Pdf oPdf = new global::Aspose.Pdf.Generator.Pdf();
oPdf.BindFO("Font.xml");
oPdf.Save("output.pdf");

This will create the following object in the PDF file:
<</Type/Font
/Subtype/TrueType
/FirstChar 0
/LastChar 255
/Widths[....]
/Encoding/WinAnsiEncoding
/BaseFont/ArialBoldItalic
/Name/ArialBoldItalic
/FontDescriptor 12 0 R
>>

If that value is updated to the following, then everything works correctly:
<</Type/Font
/Subtype/TrueType
/FirstChar 0
/LastChar 255
/Widths[....]
/Encoding/WinAnsiEncoding
/BaseFont/Arial-BoldItalic
/Name/ArialBoldItalic
/FontDescriptor 12 0 R
>>

Is there a way to change the value that is being stored in the /BaseFont field?

Viewing all articles
Browse latest Browse all 3131

Trending Articles