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

Free Support Forum - aspose.com

BindXML Causes Error

I am converting a Docx to PDF, but when I call the BindXML method of the pdf, I get the following :

C:\Documents and Settings\Geoff\LOCALS~1\Temp\Aspose.Words.e5734e43-78cd-46ca-ba45-bacbb1bb156b.001.png' is not a valid virtual path.

The png file exists in the specified directory.

Code that is a problem is as follows:

'Save to Memory Stream as XML
Dim stream As New System.IO.MemoryStream
doc.Save(stream, Aspose.Words.SaveFormat.AsposePdf)
'Position Stream to begining
stream.Seek(0, IO.SeekOrigin.Begin)

Dim pdf As New Aspose.Pdf.Pdf
pdf.IsImagesInXmlDeleteNeeded = True
pdf.BindXML(stream, Nothing) ---------> Error
pdf.Save(TargetFile)

Hi,

Thank you for considering Aspose.

I found the reason of this problem and we will cooperate with the Aspose.Words team to resolve this problem. As a workaround you can create a folder in your server and save the xml into that folder and then bind it.

Thanks for your quick response.

I have now changed test code to save XML to file, but now the resulting PDF is only a blank single page.

Word document (attached) is 169k and XML is 300k.

My Apologies, I was not properly setting the SaveFormat after the code changes.

The workaround is now working.

We would prefer to utilise the streams rather than have to go through xml file creation on server, but for the short term we can work with this.

Is there any sort of indication if the problem will be fixed in the near future?

Thanks again for your time & quick response.

Hi,

When you stream, the images that extracted by Aspose.Words are also saved onto disk. By default they are saved to the temp folder (C:\Documents and Settings\Geoff\LOCALS~1\Temp) which causes this problem. I found there is a property doc.SaveOptions.ExportImagesFolder in Aspose.Words. I think this property can help you.