Error processing page when opening file in Adobe Acrobat

I am getting this error when opening the document I created in Aspose.PDF:

There was an error processing a page. There was a problem reading this document (18).

I attached two files:

1. pdfdoc.pdf - which is a file that was created using Aspose.Words and Aspose.Pdf.

2. sst.pdf - which is a file created usin Aspose.Pdf

Here is my code:

Aspose.Pdf.License license = new Aspose.Pdf.License();

license.SetLicense("C:\\users\\Aspose.Total.lic");

FileStream inStream1 = new FileStream("c:\\testdata\\pdfdoc.pdf", FileMode.Open);

FileStream inStream2 = new FileStream("c:\\testdata\\sst.pdf", FileMode.Open);

PdfFileEditor editor = new PdfFileEditor();

editor.Append(inStream1, inStream2, 1, 100, inStream1);

inStream1.Close();

inStream2.Close();

Hello Scott,

We apologize for your inconvenience. I have tested the issue and I’m able to reproduce the same problem. I have contacted our development team to investigate this issue in detail and they will keep you updated on the status of a correction.

Hello Scott,

I have discussed the issue with our development team, and it has been noticed that the “sst.pdf” file is damaged (which can be auto-fixed by Acrobat. Open the file and than close it with "save the change"). I am sorry to inform you that repairing the damaged Pdf files is not supported by our products, so it seems like the error is generated by Aspose.Pdf.Kit<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

I have repaired the file through Acrobat and have tried appending the sst.pdf file with pdfdoc.pdf and the resultant Pdf is opening without any error message. The file is in attachment, please take a review. In case of any concerned issues, please feel free to contact.

I created the sst.pdf using Aspose. Attached are the two files referenced in the code below:

private void button6_Click(object sender, EventArgs e)

{

Aspose.Pdf.License license = new Aspose.Pdf.License();

license.SetLicense("C:\\users\\Aspose.Total.lic");

FileStream inStream1 = new FileStream("c:\\testdata\\one.pdf", FileMode.Open);

FileStream inStream2 = new FileStream("c:\\testdata\\two.pdf", FileMode.Open);

PdfFileEditor editor = new PdfFileEditor();

editor.Append(inStream1, inStream2, 1,100, inStream1);

inStream1.Close();

inStream2.Close();

}

Hello Scott,

We apologize for your inconvenience. I have tested the issue and I’m able to reproduce the same problem. The issue is being caused by Aspose.Pdf.kit. I have logged it in our issue tracking system as PDFKITNET-5622. We will investigate this issue in detail and will keep you updated on the status of a correction

Hi Scott,

We checked the issue and found that there is a parameter-misuse in the above code.

public bool Append(
Stream inputStream,
Stream portStream,
int startPage,
int endPage,
Stream outputStream //should not be the same stream as inputStream or portStream.
);
Thanks,

I have a pdf document that is not inserting using pdffileeditor append.

Attached are the files used with the code below:

private void InsertPDF2(String strFromDoc, String strNewDoc, String strTempDoc)

{

Aspose.Pdf.Kit.License license = new Aspose.Pdf.Kit.License();

license.SetLicense(@"C:\users\Aspose.Total.lic");

FileStream inStream1 = new FileStream(strTempDoc, FileMode.Open);

FileStream inStream2 = new FileStream(strFromDoc, FileMode.Open);

FileStream outputStream = new FileStream(strNewDoc, FileMode.Open);

//FileStream outputStream = new FileStream(strNewDoc, FileMode.Create);

PdfFileEditor editor = new PdfFileEditor();

editor.Append(inStream1, inStream2, 1, 100, outputStream);

inStream1.Close();

inStream2.Close();

outputStream.Close();

}

Hello Scott,

I have tested the issue, but I am unable to reproduce the problem. I have successfully been able to append insert.pdf with output.pdf. Here I would like to share one thing, in your code snippet for PdfFileEditor.Appen, you have specified endpage argument value as 100, which should be 1, as the source file insert.pdf has only single page which is the start page and end page. Also please use following code line for output pdf.

FileStream outputStream = new FileStream(strNewDoc, FileMode.Create);<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

The resultant pdf is in attachment. I hope this could resolve your problem. In case of any concerned issues, please feel free to share.