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

Free Support Forum - aspose.com

Font of OLE Object is Changed after DOCX to PDF conversion using .NET

When I embed a pdf as an ole object into a document and then save as PDF fonts are lost with aspose.words 20.10 for .net.

Sample code:

    static void WordEmbedPDF(string pathToPDF, string pathToImagePart)
        Document doc = new Document();
        DocumentBuilder builder = new DocumentBuilder(doc);

        Stream soueceStream = File.OpenRead(pathToImagePart);
        MemoryStream dataStream = new System.IO.MemoryStream();

        builder.InsertOleObject(pathToImagePart, false, false, dataStream);

        PdfSaveOptions options = new PdfSaveOptions();
        options.EmbedFullFonts = true;
        options.Compliance = PdfCompliance.PdfA1a;
        doc.Save(pathToPDF + "-ole-output.pdf", options);

        doc.Save(pathToPDF + "-ole-output.docx");

I have attached the input and output files. Note that the lorem_ipsum.pdf-ole-output.pdf has lost it’s header font styling.

insert ole.zip (1.4 MB)


Please note that Aspose.Words requires TrueType fonts when rendering document to fixed-page formats (JPEG, PNG, PDF or XPS). You need to install fonts that are used in your document on the machine where you are converting documents to PDF. Please refer to the following articles:

Using TrueType Fonts
Manipulating and Substitution TrueType Fonts

We have tested the scenario using the latest version of Aspose.Words for .NET 20.10 and have not found the shared issue. So, please use Aspose.Words for .NET 20.10. We have attached the output PDF with this post for your kind reference. -ole-output.pdf (1.7 MB)