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

Free Support Forum - aspose.com

Word doc Save to PDF and font issue

Currently, we are using version 5.3 of Aspose.Word and version 3.9 of Aspose.Pdf to convert word documents to PDF. The word documents use some custom barcode fonts (code 39).

Here was the way we use to do this:

var ms = new MemoryStream(wordDocument); // inbound word document as byte[]
var d = new Aspose.Words.Document(ms);
var tempXmlFormat = new MemoryStream();
d.Save(tempXmlFormat, SaveFormat.AsposePdf);
var pdf = new Aspose.Pdf.Pdf();
pdf.BindXML(tempXmlFormat, null);
pdf.IsImagesInXmlDeleteNeeded = true;
ms = new MemoryStream();
pdf.SetUnicode(); // this would preserve our code 39 font
pageCount = pdf.PageCount;
var result = ms.ToArray(); // pdf as byte[]

We looking to upgrade to the newest version of Aspose.Word (9.7) and notice that there is direct support for conversion to PDF.

From the code samples, this appears to be the “new” way

var ms = new MemoryStream(wordDocument)
var doc = new Aspose.Words.Document(ms);
doc.Save(pdfStream, Aspose.Words.SaveFormat.Pdf);
var result = pdfStream.ToArray();

The issue is, with the new version, the Code 39 fonts are getting converted to Times New Roman.

I have tried using the Aspose.Words.Saving.PdfSaveOptions(); to EmbedFullFonts, but that doesn’t seem to do the trick.

So, the question is, how do you preserve/embed custom fonts in a pdf when converting from word?

Thanks in advance


Thanks for your request. Please make sure that the Code 39 fonts are installed on your PC. During converting to PDF Aspose.Words should read all fonts used in the original document to create font subset, which will be stored in the output PDF file.
If the font is installed, and the problem still exists, please attach this font here for testing. I will investigate the problem and provide you more information.
Best regards,

Yes, the font is currently installed on the computer doing the conversion. Please see attached zip file. The font and a sample .doc file is included.

Thanks again.

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,

Thanks for the quick reply. Is there any estimated time frame that this could get addressed?

Thanks for your inquiry. Unfortunately, currently I cannot provide you any reliable estimate regarding this issue. Once our developer analyzed the issue I will be able to provide you more information.
Best regards,

So, it’s been 6 weeks and was hoping to hear some news. We recently renewed our license thinking that staying up with releases would be better off. This is our first issue with upgrading and I was hoping that this would be a simple fix.

Without this, our renewed license is useless and i might as well ask for a refund.

Any idea if this will ever be looked at?

Thank you for your request.
The task now is under “Code Review” in our code base. At the moment, presumably the problem will be included in release 10.1 which will be out in 3-4 weeks. Sorry for the inconvenience.

The issues you have found earlier (filed as 25211) have been fixed in this .NET update and in this Java update.

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

Thanks for the update.