Free Support Forum - aspose.com

Error Converting to PDF when Word doc has embedded image

I am attempting to convert a Word document created with Aspose.Word to a PDF using the following code:

aspDoc.Save(“DocFromScratchPDF.xml”, Aspose.Word.SaveFormat.FormatAsposePdf)
aspPDF.BindXML(“DocFromScratchPDF.xml”, Nothing)
aspPDF.IsImagesInXmlDeleteNeeded = True
aspPDF.Save(“DocFromScratchPDF.pdf”)

When the last line of code is executed, I get the following exception:
Couldn’t open image file: C:\Documents and Settings\wilson_ma\My Documents\Visual Studio Projects\AsposeTest\binDocFromScratchPDF.001.Png

The problem is the missing “” between bin and the document name. As a temporary workaround I have been opening the XML file and placing the backslash before the image name, which allows the code to execute successfully.

Thanks for the report, we will look into this issue asap.

This issue is caused by Aspose.Pdf and I've notified Aspose.Pdf development team.

In the meantime you can easily workaround if you specify a path when saving and loading the XML file between Aspose.Word and Aspose.Pdf. Also, you can send the file through a memory stream.

The Aspose.Pdf team says this issue was fixed in the latest Aspose.Pdf hotfix.