Hi,
I am trying to convert a Word document to PDF using Aspose.Pdf for .NET and I got the following error.
An unhandled exception of type ‘System.StackOverflowException’ occurred in Aspose.Pdf.dll
I am using the example code from this link
https://docs.aspose.com/words/net/convert-a-document-to-pdf/
Thanks…
Sanjay Kumar
Ph: 732-694-3170
This message was posted using Email2Forum by salman.sarfraz. (attachment)
Hello Sanjay,
Thanks for considering Aspose.
Please share the resource word document so that we can test the scenario at our end.
We apologize for your inconvenience.
Attached find the document I am using.
Hello Sanjay,
I have tested the issue and I’m able to reproduce the same problem. I have logged it in our issue tracking system as PDFNET-12706. We will investigate this issue in detail and will keep you updated on the status of a correction. We apologize for your inconvenience.
Hello Sanjay,
Thanks for your patience.
After spending sometime over the issue PDFNET-12706 which was reported earlier, we’ve come to the conclusion that the format of input Word is somehow weird. When the Word contents are transformed into an XML file, notice the element in the header. It has only single empty line with LineSpacing 686 pound. So, this text would occupy the whole page. Just as the double line border does (It is the text’s border). In normal process, texts in main body should start after the text. However, MS Word, seems to ignores header contents and treat them as floating objects.
Further investigation showed that if we set the PageMarginTop to nonnegative value(e.g 0), everything seems right. I think this should be the magic. As in your original document, PageMarginTop=“-54”, and it should mean something unknown to us because Word is not an open format. We can’t support it in short time.
As a workaround, please remove the Header and set Page border. I have also attached the modified Word document and the resultant pdf file for your reference, please take a look.
Please try using the latest HotFix for Aspose.Pdf for .NET 4.1.1 that can be accessed from this link.
<?xml version="1.0" encoding="UTF-8"?>
**
Hello Sanjay,
Thanks for your patience.
The conventional method of using Aspose.Words and Aspose.Pdf to convert word files into PDF format is now obsolete. Please try using Direct-to-PDF save method of Aspose.Words and as we have stated earlier, the issue PDFNET-12706 seems to be related to Aspose.Words.
For your convenience, I am moving this thread to Aspose.Words forum where I believe our team of experts taking care of that product would be in better position to assist you in this regard. In case you have any further query, please feel free to contact. We apologize for the delay and inconvenience.
Hi
Thanks for your inquiry. Please try using the latest version of Aspose.Words and direct-to-PDF method as described here:
https://docs.aspose.com/words/net/convert-a-document-to-pdf/
You can download the latest version from here:
https://releases.aspose.com/words/net
Best regards,