We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose.word .NET not rendering correct font in PDF file when converting to PDF

I built a console application that create MS Word letter and PDF from HTML code stored in a database using the Aspose.Words.net library.

I am setting the font to Myriad Pro (OpenType) . When the Aspose.word.net renders the MS Word Document the font is correct, But when it renders the PDF I get a differnt font called MicrosoftSansSerif. How do i get the PDF to render with the Myriad Pro font.

I use a variable called strLetterFont that contain a string with the font name . Example "Myriad Pro"
private static Document doc;
private static DocumentBuilder builder;
private static Paragraph paragraph;
private static Section currentSection;
private static PageSetup pageSetup;

doc = new Document();

builder = new DocumentBuilder(doc);
paragraph = builder.CurrentParagraph;
currentSection = builder.CurrentSection;
pageSetup = currentSection.PageSetup;
currentSection.PageSetup.PaperSize = PaperSize.Letter;
currentSection.PageSetup.TopMargin = 36;
currentSection.PageSetup.BottomMargin = 36;
currentSection.PageSetup.LeftMargin = 72;
currentSection.PageSetup.RightMargin = 72;

Aspose.Words.Font font = builder.Font;
font.Name = strLetterFont;

I will then loop trough the database use the DocumentBuilder
to insert the HTML into the Document, I also set the font
again in the builder.

builder.Font.Name = strLetterFont;
builder.Font.Size = 12;

I am using SaveDoc menthod to save both documents after building up a document with the document builder.

SaveDoc(doc, outputFolder + strEXT_SRVY_ID + ".pdf", SaveFormat.Pdf);

SaveDoc(doc, outputFolder + strEXT_SRVY_ID + ".docx", SaveFormat.Docx);


Thanks for your inquiry. Could you please attach your output Word and PDF document and Myriad Pro font? I will check the issue on my side and provide you more information.

Best regards.

Files attached.


Thank you for additional information. I managed to reproduce the problem on my side. Your request has been linked to the appropriate issue. You will be notified as soon as it is resolved.

Best regards,

The issues you have found earlier (filed as 18487) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.