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