DOCX to PDF Missing Image in PDF

I’m using OpenXML 2.0 to create a DOCX that exports an image with some text in the header/footer and a watermark. Everything exports fine to the DOCX, but when I save the DOCX to a PDF using Aspose.Words, then the image is missing. The image is populated via a content control via OpenXML. I’m using Aspose.Words 23.1

@andrewj1murray Unfortunately, I cannot reproduce the problem on my side. I have used the following simple code for testing:

Document doc = new Document(@"C:\Temp\in.docx");
doc.Save(@"C:\Temp\out.pdf");

Here is the output PDF produced by the code above : out.pdf (118.9 KB)

Could you please provide your code that will allow us to reproduce the problem? We will check the issue and provide you more information.

Also, could you please let us know what is your environment? The problem might occur becasue your application is deployed in Linux environment.
Aspose.Words for .NET Standard and .NET6 uses SkiaSharp to deal with graphics, to make it work on Linux you have to add reference either to SkiaSharp.NativeAssets.Linux or to SkiaSharp.NativeAssets.Linux.NoDependencies

If you add reference to SkiaSharp.NativeAssets.Linux, you should also install libfontconfig1 in your system. SkiaSharp.NativeAssets.Linux depends on this library. You can use the following command to install it:

apt-get update && apt-get install -y libfontconfig1

If you do not have rights to install packages, or other reasons not to install libfontconfig1, you can simply use SkiaSharp.NativeAssets.Linux.NoDependencies, which does not require installation of libfontconfig1.

@andrewj1murray Unfortunately, I still cannot reproduce the problem on my side. You document is converted properly on my side in a simple .NET6 console application.
Could you please create a simple application that will allow us to reproduce the problem? Does the problem occurs if use the following code for conversion?

Document doc = new Document(@"C:\Temp\in.docx");
doc.Save(@"C:\Temp\out.pdf");

Didn’t know that SkiaSharp was the used for the graphics portion. Added that in and now everything works. Thanks for the help.

1 Like