Hi All,
I am working on a project that require generation of a PDF in bytes.
My application is in ASP.NET (a webservice).
The input is a PDF template file and FDF from database.
I am getting an error:
“There was an error opening this document. The file is damaged and could not be repaired.”
Note: It worked fine with the same input, when I generated a PDF file (destination is File).
I used FORM class of Aspose.Pdf.Kit.
Please help me in this regard (I cannot share the code FDF or Template).
ThankYou.
Hi,
It is difficult to reproduce this error without code and inputs. You can send me PDF file and source code. Please refer to: How to Share a Document in a Forum Post - #2.
I will check it and will reply to you.
Thanks.
Hi Ahmad,
Thank You for responding.
We could resolve the issue.
The problem was with the buffer size for destination stream. We used fixed size byte array.
If it was less, valid error is displayed.
If the same destination buffer size is more than the actual destination stream size, then the following error is disaplayed (which was little bit msleading):
“There was an error opening this document. The file is damaged and could not be repaired.”
When we repalced the constant destination buffer size with length of the destination stream (After Form.Save()), it worked.
Thank You.