Free Support Forum - aspose.com

PdfFileEditor Concatenate output starts in adobe and foxit on last page

Hi,

When using the PdfFileEditor.Concatenate method, we find that when viewing the resulting PDFs in Adobe Reader or Foxit that the PDF is opened to the last page and not the start of the document!

See example attachment where I simply concatenated the same PDF 3 times like below:

public void Merge()
{
List files = new List();

files.Add(“PDF.pdf”);
files.Add(“PDF.pdf”);

files.Add(“PDF.pdf”);


PdfFileEditor editor = new PdfFileEditor();
editor.Concatenate(files.ToArray(), “3xPDFs.pdf”);
}

Any ideas?

EDIT:

Sorry about the premature post, but I found that concatenating a different PDF didn’t result in it being opened on the last page… Still, why would one PDF open on the last page and not the other and how can we set this differently, if possible?

Cheers,

Hi Matthew,

I would like to share with you that some times due to the OpenAction script with GoTo command might cause this kind of behavior. For example, if the last file executes this command to move the control to the first page, it will move to the first page of the last file not the first page of the total concatenated file.

So, please make sure that the files you concatenate do not contain such scripts, otherwise you might notice such anomaly. However, if this is the not the case with some files and you still find the same issue then please share the input PDF files with us, so we would be able to test it at our end.

We’re sorry for the inconvenience.
Regards,

Hi,

Attached is a zip containing doc.pdf which has AncSIS.pdf concatenated to it and outputs Concatenated.pdf.

public void Merge()
{
PdfFileEditor editor = new PdfFileEditor();
editor.Concatenate(new string[] { “doc.pdf”, “AncSIS.pdf” }, “Concatenated.pdf”);
}

Opening in either Adobe or Foxit shows the last page…

Is there any way to alter this behaviour with Pdf.Kit?

Regards,

Hi Matthew,

I have reproduced this problem at my end and logged it as PDFKITNET-19329 in our issue tracking system. Our team will look into this issue and you’ll be updated via this forum thread once it is resolved.

We’re sorry for the inconvenience.
Regards,

Hi Matthew,

I would like to inform you that this issue is caused due to the OpenAction command. However, you can remove it using RemoveDocumentOpenAction method. Please use the following code snippet to remove the OpenAction from the concatenated file:


PdfContentEditor editor2 = new PdfContentEditor();
editor2.BindPdf("Concatenated.pdf");
editor2.RemoveDocumentOpenAction();
editor2.Save("Concatenated2.pdf");

I hope this helps. If you have any further questions, please do let us know.

Regards,

Thanks for the advice, but…

We are using Pdf Kit 4.6.0 (latest!?) and the method RemoveDocumentOpenAction does not exist or is not public…

.NET Reflector does not reveal this method at all?

Cheers,

EDIT: Just saw latest version is actually 4.7.0 so downloaded and tested that but same issue!

Hi Matthew,

Please find attached the latest hot fix. The method previously mentioned is available in this hot fix.

I hope this helps. If you still find any issue or have more questions, please do let us know.
Regards,