Docx generated through Aspose.PDF having images missing if accessed as OneDrive or Office365 files

Hi,

We are using Aspose.PDF to generate both PDF and Docx files. Files are being generated all good and as per requirement and images appearing in docx fine. But we are having issue for images missing in Docx files if kept in OneDrive synced directory or if we use Office365 on mac.

Aspose.PDF version used: 22.8.0; also tried 22.9.0 but of no use

Images appearing fine:
image.png (25.4 KB)

Images not appearing, when moved or saved to onedrive folder:
image.png (4.0 KB)

Here is sample code we are using with basic html with text and image only:

var loadOptions = new Aspose.Pdf.HtmlLoadOptions();
var document = new Aspose.Pdf.Document(new MemoryStream(Encoding.UTF8.GetBytes(samplehtml)), loadOptions);;
document.Save(outputFilePath, Aspose.Pdf.SaveFormat.DocX);

Code sample in Zip:
sample_code.zip (2.1 KB)

We are also using a purchased license for Aspose.PDF

We know that there are other Aspose products for generating docx like Aspose.Words and Aspose.Html and that may not having this issue, but those did not fulfill our requirment to fully support Html and CSS content as supported by Aspose.PDF.

Most importantly, as we checked the mime type of generated file, that is ā€˜application/zipā€™ instead of ā€˜application/vnd.openxmlformats-officedocument.wordprocessingml.documentā€™. We tried everything to have required ContentType in file, but no success.

We will be very grateful to have any solution or help.

Thanks

@gurpreet.iotasol

We have tested the scenario using the latest version of Aspose.PDF for .NET 22.9 and have not found the shared issue. So, please use Aspose.PDF for .NET 22.9. We have attached the output DOCX with this post for your kind reference.
output docx.zip (10.1 KB)

1 Like

Hi @tahir.manzoor

Issue still exists:
I have tried using the output file shared by you, itā€™s having the same issue if placed in OneDrive folder on windows and no issue if accessed from other folders. This issue is very common on Mac OS with Office365.
Online sync services are very common and we cannot convince our costumers to avoid this. So please can you try with same scenario on windows or mac?

Here is the shared docx preview:
image.png (22.8 KB)

Also donā€™t know why the actual mime type of file produced is ā€˜application/zipā€™ instead of ā€˜application/vnd.openxmlformats-officedocument.wordprocessingml.documentā€™.
Used this online tool to verify:
image.png (34.2 KB)

@gurpreet.iotasol

We have logged this problem in our issue tracking system as PDFNET-52680. We will inform you once there is an update available on it.

We apologize for your inconvenience.

2 Likes