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

Free Support Forum - aspose.com

Image is lost after DOCX to PDF conversion at Azure using .NET

We are running into this same issue now. When converting to PDF the images no longer show up. When saving as a .docx everything is fine. Images were working fine a few months ago. I’ve tried installing the SkiaSharp NuGet Package but that hasn’t worked either.

We are running on Azure Functions and .NET Core (.NET Standard 2.0) and have the latest Aspose.Words and Aspose.PDF packages (20.x)

@John9

We suggest you please use the latest version of Aspose.Words for .NET 20.5 and read the following article.
Converting a Document with Images using Aspose.Words in Azure Functions

If you still face problem, please attach the following resources here for testing:

  • Your input Word document.
  • Please attach the output PDF file that shows the undesired behavior.
  • Please attach the expected output PDF file that shows the desired behavior.
  • Please create a standalone console application ( source code without compilation errors ) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.

I’ve discovered that the issue does not occur when using Visual Studio but it does occur when using Visual Studio Code, which is what the team normally uses. I did confirm that the SkiSharp.dll file was being placed in the bin/ folder.
Here is a project to reproduce.
AsposeIssue.zip (856.3 KB)

@John9

Have you tried the latest version of Aspose.Words for .NET 20.5? Please ZIP and attach the problematic output PDF here for our reference.

We suggest you please follow the steps mentioned in the following article for document conversion to PDF.
Creating a Web Role Project

Yes, the project that I uploaded is using Words 20.5. Here is one of the files generated without the image. The original .docx file is in the zipped file I already uploaded.
df62e6b5-29a7-49d4-b5cb-7ad7edc71ef4.pdf (18.3 KB)

@John9

Have you set the following setting mentioned in step 7 in the shared article?

Modify the ServiceDefinition.csdef configuration file so that the application can run in Windows Azure under Full Trust. It is recommended that you have *enableNativeCodeExecution = "true"* to avoid any permission issues that may arise when using Aspose.Words to convert documents to PDF or XPS.

You have implemented IWarningCallback interface. Please share if you are facing any warning messages. Many thanks for your cooperation.

We are working over your query and will get back to you soon.

We don’t use web roles on the project and therefore we do not have a ServiceDefinition.csdef file. Also, I am able to reproduce this issue locally so it shouldn’t be anything with Azure itself, although it is running the Function Host emulator.

@John9

We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-20401 . You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

1 Like

@John9
The problem you have encountered is not a defect in Aspose.Words. The problem occurs because for some reason Visual Studio Code does not copy SkiaSharp native assets to the output directory. If you build the project in Visual Studio in the ‘bin’ directory there is ‘runtimes’ folder that contains native assets. However, Visual Studio Code ignores ‘runtimes’ folder and does not copy it. I managed to work this problem around by adding an instruction into .csproj file to copy libskiasharp.dll into the output directory.

<ItemGroup>
    <ReferenceCopyLocalPaths Include="$([System.Environment]::GetFolderPath(SpecialFolder.UserProfile))\.nuget\packages\skiasharp\1.68.1.1\runtimes\win-x64\native\libSkiaSharp.dll" />
</ItemGroup>

But this is definitely a bug in Visual Studio Code. I am going to close the defect created by Tahir as Not a Bug. Please let me know if you need more assistance.

Thanks Alexey, I will check the recommended fix. I appreciate the investigation and will let you know if I notice any further issues.