Unable to update Image in the intermediate XMLfile

Hi,

We are evaluating ASPOSE PDF component (Word to PDF conversion) and while working with the evaluation version I have come up with an issue. Our requirement is as follows: The source word document will have an image place holder (an image control). When the PDF will be generated from that I need to fill in an image in the image place holder and display the same in the resultant PDF.

When I convert the Word Doc to PDF the XML file that gets generated in the transition has an Image tag with a blank image stored in the TEMP folder.



For my requirement, I read that XML file, update the Image File Name and then use it to generate the PDF. While working on this I have found that ASPOSE PDF component generates the images in a specific format and only treats them as valid files. In the above example, the image that I had supplied to the WORD document was converted to PNG format and named as “test.001.png”. When I try to use my own image (even with PNG format) I get an error “The image xxxxxx.png is not a recognized imageformat.” I tried using the auto generated image “test.001.png” and it worked fine.

I am confused because of this behavior and need some help with the image update process.

Please assist.

Regards,
Vaibhav Modak

Hello Vaibhav,

Thanks for considering Aspose.

I’ve tested the scenario while replacing an image in the Intermediate XML but I’m unable to reproduce the problem.

As per your requirement, you need some image place holder, in which image will be placed before the document is converted into PDF format. You can try using Mail Merge feature of Aspose.Words to accomplish this requirement. At the runtime you can replace the mail merge image field with an image file and then convert the word document into PDF format either using Direct-to-PDF method of Aspose.Words or using conventional method of using Aspose.Words along with Aspose.Pdf.

In case you still face any problem, please share the resource document so that we can test the issue at our end

For related information on saving word file directly into PDF format, please visit Convert a Document to PDF also visit Save a Document

I would also recommend you to visit Mail Merge and Reporting & Insert Images from a Database