Error in generating pdf merging the W2 PDF and FDF Using aspose 5.6

Hi,

We have been using aspose.pdf.kit dll version 2.5.2 for the merging process till date for our application.

Initially we found its working fine even with .net 3.5 and 2008 servers. But after some patches are done on the 2008 we are facing access violation exception with the details as follows.

"Attempted to read or write protected memory. This is often an indication that other memory is corrupt"

This error had occured when we tried to instantiate the new form class of aspose.pdf on 2008 servers. Is there any thing we can use to solve the problem using the 2.5.2 version only.

our code is working fine 2005 servers.

If the latest version is to be used.

We also faced issues with the new version of aspose of .net 4.5 too (version 5.6.0.0).

The pdfbytes generated are converted to base 64 string following is the generated and thus resulting in error when tried to create a pdf file.

The w2pdf is converted to base64string and placed in a text box as is generated as shown in the file attached.

Following is the same code we used for all the version of the dll

Form pdfForm = new Form(pdfImageStream, w2PDFStream[count]);

pdfForm.ImportFdf(fdf_pdfStream[count]);

pdfForm.Save();

PdfFileEditor pdfEditor = new PdfFileEditor();

using (Stream w2PDFoutputStream = new MemoryStream())

{

pdfEditor.ConcatenateForms(w2PDFStream, w2PDFoutputStream);

w2PDF = new byte[(int)w2PDFoutputStream.Length];

w2PDFoutputStream.Read(w2PDF, 0, (int)w2PDFoutputStream.Length);

}

Please let me know if any more detail is required.

Please let us know th solutions for these issues.


Can any one please provide solutions to the 2 issues mentioned in this post as we are running out of time

Please let us know if any further information is required to work on this issue.

Hi Rafael,

We released the Aspose.Pdf.Kit for .NET 5.7.0 yesterday. Please download it and try at your end to see if it resolves your issue.

Moreover, we have also [released merged Aspose.Pdf for .NET](https://blog.aspose.com/2011/07/01/first-version-of-merged-aspose.pdf-for-.net-is-now-available-for-download) (6.0.0) containing features of both Aspose.Pdf for .NET and Aspose.Pdf.Kit for .NET. Please try using this as well as we’ll be discontinuing the separate Aspose.Pdf.Kit for .NET from October 2011.

Please see if the above mentioned latest version help at your end and share the results with us.

We’re sorry for the inconvenience.
Regards,

hi shahzad ,

We were able to produce the pdf with the new version in 2008 servers.
The problem with the old code is that, 2.5.2 version supported Concatenateforms method of pdfeditor.
While in the latest versions, it is a deprecated method and pdf generated successfully by replacing the method with Concatenate method.

There are still 2 issues remained with us for clarification from you .

Issue 1 :

As suggested by you we will try to use the Aspose.net for .net instead of Aspose.net.kit on further. Its observed that aspose.net.kit is just not made as a subset to aspose.net.
Can you please give us hint about the classes and methods used to merge the FDF Data with the pdf using the asposne.net package.
Demos releting to this would also be helpful for us.

Issue 2 :

Can you please let us know the reasons that may result in the following error when tried to run merge the pdf and fdf in the 2008 servers when it is working fine with 2005 servers.

"Attempted to read or write protected memory. This is often an indication that other memory is corrupt"

This would help us to debug the problem caused for the time being in the 2008 servers


Your quick reply is appreciated.

Thanks

hi shahzad ,

We were able to produce the pdf with the new version in 2008 servers.
The problem with the old code is that, 2.5.2 version supported Concatenateforms method of pdfeditor.
While in the latest versions, it is a deprecated method and pdf generated successfully by replacing the method with Concatenate method.

There are still 2 issues remained with us for clarification from you .

Issue 1 :

As suggested by you we will try to use the Aspose.pdf for .net instead of Aspose.pdf.kit on further. Its observed that aspose.pdf.kit is just not made as a subset to aspose.pdf.
Can you please give us hint about the classes and methods used to merge the FDF Data with the pdf using the asposne.pdf package.
Demos releting to this would also be helpful for us.

Issue 2 :

Can you please let us know the reasons that may result in the following error when tried to run merge the pdf and fdf in the 2008 servers when it is working fine with 2005 servers.

"Attempted to read or write protected memory. This is often an indication that other memory is corrupt"

This would help us to debug the problem caused for the time being in the 2008 servers


Your quick reply is appreciated.

Thanks

Hi Rafael,

You’re right; the ConcatenateForms method has been deprecated and now only Concatenate method is supported. And this method works fine whether the PDF file contains the forms or not.

For the issue 1, please use Aspose.Pdf.Facades namespace while working with merged Aspose.Pdf for .NET. This namespace contains all the classes and methods supported by Aspose.Pdf.Kit for .NET.

Regarding issue 2, I’m afraid, in order to better understand and then resolve the issue, we need to reproduce it at our end. Could you please share a small working sample along with the related files, so we could reproduce the issue over here? You’ll be updated with the results accordingly.

We’re sorry for the inconvenience and looking forward to help you out.
Regards,

Hi,

Irrespective of the data , we are facing problem with the following code.


Form pdfForm = new Form(pdfImageStream, w2PDFStream[count]);
pdfForm.ImportFdf(fdf_pdfStream[count]);
pdfForm.Save();


where pdfImageStream, w2PDFStream[count], fdf_pdfStream[count] are the respective memory streams.

On the execution of the first line , the creation of the form resulted in the following error

"Attempted to read or write protected memory. This is often an indication that other memory is corrupt. "

The replaced the direct creation of the form, with just creation of the form and then the stream assignments as follows

Then the code looked this way

Form pdfForm = new Form();
pdfForm.DestStream = w2PDFStream[count];
pdfForm.SrcStream = pdfImageStream;
pdfForm.ImportFdf(fdf_pdfStream[count]);
pdfForm.Save();

Then, the form creation and assignment were sucsseful but again the same error at line

pdfForm.ImportFdf(fdf_pdfStream[count]);

I can understand that , this is nothing we can do with the data but using memory stream is creating problem. But all the streams are seekable only.
But the code working fine 2003 servers and the above problem occurs only on 2008 servers after some installations were done on those machines.

Can you please let us know if we can do anything on our end.

Hi Rafael,

First of all, please make sure that the
fdf_pdfStream[count] is a valid FDF stream.
Secondly, please try to move the stream to the starting position before passing it to the method.
Lastly, if it still doesn’t resolve your issue then please save the files to the disk and then share with us, so we could investigate it at our end. Moreover, please confirm that you’re using Aspose.Pdf for .NET 6.0.0 at your end.

We’re sorry for the inconvenience and looking forward to help you.
Regards,