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
pdf.Save(ms);
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