Free Support Forum - aspose.com

Error converting word to pdf format

Aspose.Words.Document srcDoc = new Aspose.Words.Document(inFileName);

srcDoc.SaveOptions.ExportImagesFolder = Path.GetDirectoryName(outFileName);

MemoryStream xmlDoc = new MemoryStream();

srcDoc.Save(xmlDoc, Aspose.Words.SaveFormat.AsposePdf);

xmlDoc.Position = 0;
Aspose.Pdf.Pdf pdf = new Aspose.Pdf.Pdf();
pdf.BindXML(xmlDoc, null);

pdf.IsImagesInXmlDeleteNeeded = true;
pdf.Save(outFileName);
result = true;


error: when excecute the line
srcDoc.Save(xmlDoc, Aspose.Words.SaveFormat.AsposePdf);
error was Index was out side the bounds of array.

how to solve this issue??

Hi

Thanks for your request. You are using old version of Aspose.Words and old method of PDF conversion. We no longer support this method of conversion. We introduced new direct-to-PDF method. Please follow the link for more information:

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

So, please try using the latest version of Aspose.Words and direct method of conversion. 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,

Thanks for your reply,Iam getting this error when i update the aspose.words dll.

Could not load file or assembly 'Aspose.Words, Version=4.2.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)



Hi

Thanks for your request. The problem probably occurs because you simply replace the dll. Please try to remove and add the reference to Aspose.Words.dll again and then rebuild your project. This should resolve the problem.

Best regards,

Thanks !
It’s asking about the updation of License.
Is it possible to resolve that using old version?,as I was developing Pdf report in that
InsertHtml tag using .
for wordfile it is getting,but when converting word to pdf the above error is getting.

Hi

Thanks for your request. Unfortunately, as I mentioned we no longer support old method od PDF conversion. Also, we do not provide fixes for old versions. All new features and fixes are included into new releases of Aspose.Words.

Best regards,

for some reports it’s getting Pdf and some are not,why?

Hi

Thanks for your request. It is difficult to tell you why some your documents cannot be converted to PDF. Could you please attach few sample documents here for testing?

Also, have you tried using the latest version of Aspose.Words as I suggested earlier?

Best regards,

Thanks for your reply,
some files getting report converting from word to PDF.
the file attached is not converting to pdf.
error getting at “memorystream” as above I have told.
2 files I have attached,one is report that get in PDF
another is not getting in pdf.

Hi

Thank you for additional information. I can successfully convert your document to PDF using the latest version of Aspose.Words and direct-to-PDF method of conversion. So please try using the latest version as I suggested earlier.

Best regards,