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

Free Support Forum - aspose.com

Word to pdf image issue

Hi team,

We have a problem with the images in a PDF document after this are converted from a word document. The problem consists in that the images are not displayed and instead and “x” image are showed.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

About the context execution and experiences:

Our implementation scenario consist in a SharePoint Solution, the conversion are realized in an “ItemUpdated” event handler taking the last published stream associated to the document to proceed with the conversion to pdf.

Based in our evidences and experiences we thing that this is a particular bug that occurs in this particular execution environment. Because as a part of our tests, we have constructed and windows app (with the same code snippet to convert) in order to realize the conversion and this problem doesn't occur.

Additionally, during the construction of this solution we had experience other atypical problem that in the same way only was occurred under this context execution and in the test app it worked. This problem was an error during the load of the document object in the conversion process, specifically the problem occurred in the load of the Word Object:

Document srcDoc = new Document(streamDoc); throw "Exception: The document appears to be corrupted and cannot be loaded"

This last error ocurred using the product versions 5.3.0.0 for Aspose.Word and the 3.8.0.0 for the Aspose.PDF, and after discard many possible reasons and modify the implementation trying to fix this with failed results, we update the solution to use the Aspose.Words 9.1.0.0 and the Aspose.PDF 4.4.0.0 products (the most recent versions when we test) and that issue leave to appear without change the implementation, just refreshing the assemblies and recompiling.

Finally, We saw other problem adding a text to the word document before to convert, the text inserted by the code snippet below is not showed. This problem occurs with the version of Aspose.Words 9.1.0.0 and the Aspose.PDF 4.4.0.0 products.

Aspose.Words.Paragraph par = new Aspose.Words.Paragraph(srcDoc);
Run run = new Run(srcDoc, _strWaterMark);
par.AppendChild(run);
shape.AppendChild(par);
run.Font.Size = _intFontSize;
run.Font.Bold = _blnBold;
run.Font.Color = System.Drawing.ColorTranslator.FromHtml(_strColor);
builder.MoveToHeaderFooter(Aspose.Words.HeaderFooterType.HeaderPrimary);
builder.InsertNode(shape);

By the foregoing we are depending on your support help to solve this problems. Attached is:

  • DECRETO-2010-DECGGL-253.docx Source document.
  • DECRETO-2010-DECGGL-253.pdf Result document with problems
  • convertedfromdesktopapp.pdf Converted from testing desktop app with ok image.
  • sharepointcodesnippet.txt Code snippet from the method used to convert for reference.
  • sharepointcodesnippet.txt Code snippet from the method used in the test app, is an copy of the previous with some modifications, he is not in sharepoint context.

For this conversions are used the Aspose.Words 9.1.0.0 and the Aspose.PDF 4.4.0.0 products.

Thanks a Lot!, we will be outstanding to your feedback in order to find a solution.

JHenao

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request and sorry for delayed response. I cannot reproduce the problem on my side.

As I can see you are using old legacy method of PDF conversion. This method is not supported already. You should try using the latest version of Aspose.Words and direct-to-PDF method of conversion. New method does not require Aspose.Pdf, you can convert Word documents to PDF using only Aspose.Words. Please follow the link to learn more:

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net/howto-convert-a-document-to-pdf.html

You can download the latest version of Aspose.Words from here:

http://www.aspose.com/community/files/51/.net-components/aspose.words-for-.net/category1188.aspx

Best regards,

Hi team,

I have tried with the lastest of Aspose.Words version until date (9.5, version released next day of the publication of this post) , also I have modified the code according to the suggestion removing the use of the aspose.pdf. However despite the above, the image issue persists.

I'm aware that could be tricky to reproduce this issue becouse the plataform is SharePoint(see details first post), so please let me know any aditional information that you may need in order to achieve this, or even if there is something more that i must try also please let me know.

About the new version tested, i observed that the SaveOptions property has changed, now is an objet to pass as a parameter in save method , also the ExportImagesFolder property doesn't exists. is this property no longer required or is there another way to set this? this may have something to do?

due the haste of our customer we apreciate your response becouse the upgrade to this recent versión depends on it; we need to know if this issue could have any solution or if the use of this product must be reconsidered.

attached is the new conversion code snippet .

Thanks a lot and best regards!

Hello

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks you for additional information. As you already know the legacy (old) method of PDF conversion was excluded from the latest version of Aspose.Words. PdfExportFloatingTables, PdfExportImagesFolder properties relate to legacy method of PDF conversion and do not have any effect in case of using Save method. So you should use the code like the following to convert your document to PDF:

Document doc = new Document("your.docx");

doc.Save("out.pdf");

Also, I still cannot reproduce the problem with image on my side. Could you please try using the code provided above to convert your document to PDF and let me know how it goes on your side.

Best regards,

Hello,


I have the same problem too. When I create a word document (i mean .doc), the images displayed without issue. But when i convert it to a PDF document, the images not displayed and instead and “x” image are showed. Could you help me please ?

Best regards,

Hi HAKKI,

Thanks for your request. Could you please show me your code and attach your input and output documents here for testing. I will check the problem on my side and provide you more information.

Best regards,