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

Free Support Forum - aspose.com

Problems saving Word as PDF

We are experiencing problems when trying to save DOCX document as PDF (see the attached .docx).


Document is generated by Aspose.Words and if we choose to save document as DOCX it works as expected.

All content (tables) is dynamicaly created with Aspose.Words

DOCX saving options are following:
Dim docSaveOption As New Aspose.Words.Saving.OoxmlSaveOptions docSaveOption.Compliance = Aspose.Words.Saving.OoxmlCompliance.Iso29500_2008_Transitional
docSaveOption.SaveFormat = SaveFormat.Docx
doc.Save(Me.Response, docName & “.docx”, ContentDisposition.Attachment, docSaveOption)

However if we change that to:
Dim docSaveOption As New Aspose.Words.Saving.PdfSaveOptions
docSaveOption.SaveFormat = SaveFormat.Pdf
doc.Save(Me.Response, docName & “.pdf”, ContentDisposition.Attachment, docSaveOption)

the result is corrupted PDF file with size 2KB

If we change the ContentDisposition to Inline

Dim docSaveOption As New Aspose.Words.Saving.PdfSaveOptions
docSaveOption.SaveFormat = SaveFormat.Pdf
doc.Save(Me.Response, docName & “.pdf”, ContentDisposition.Inline, docSaveOption)

we recive “Index was outside the bounds of array” exception

As recieved PDF file is not corrupted if there is no customer activity (so no table in word document) we suspect it is somehow related to tables in document

Hi Erik,

Thanks for your inquiry. The shared document have 0kb file size. Could you please attach your input Word document again here for testing? We will investigate the issue on our side and provide you more information.

I must have picked the wrong file. I have attached the correct file now.



Hi Erik,

Thanks for sharing the document. We have tested the scenario using latest version of Aspose.Words for .NET 16.3.0 and have not found the shared issue. Please use Aspose.Words for .NET 16.3.0 and let us know if you have any more queries.