We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Merged PDF opens the last page in acrobat

Hi
I am using aspose pdf 10.6.1, after concatenating pdf files the pdf file doesnt open the first page, it opens the last page.

The pdf are merged using
PdfFileEditor editor = new PdfFileEditor();
editor.concatenate(inStreams, outputStream);

I have tried
Document doc = new Document(new ByteArrayInputStream(mergedPdfStream));
GoToAction action = new GoToAction();
action.setDestination(new XYZExplicitDestination(doc.getPages().get_Item(1), 0, 0, 0));
doc.setOpenAction( action);
doc.save(outputStream);

and
Document doc = new Document(new ByteArrayInputStream(mergedPdfStream));
doc.setOpenAction( null);
doc.save(outputStream);

if it is saved to output file it works, issue with the array stream save.
doc.save(“c:/test.pdf”);

Regards
-Kalyan

Hi Kalyan,


Thanks for using our API’s.

I have tested the scenario using couple of my sample PDF documents and I am unable to notice any issue. As per my observations, the resultant file is opening at first page of document. However, can you please share your sample PDF files, so that we can test the scenario in our environment.

Also please share that how you are viewing the document when saving contents in Stream array, once you have updated PDF OpenAction. We are sorry for this inconvenience.

I am able to resolve the issue using below steps

Pdf pdf=new Pdf();
Document doc=new Document(pdf);
pdf.clear();

for(all binary contents in array){
Document docTmp=new Document(new ByteArrayOutputStream(binaryContent));
doc.getPages().add(docTmp.getPages());

}
doc.save(bos);
--bos is byte array output stream

Regards
-Kalyan

Hi Kalyan,


Thanks for the acknowledgement. We are glad to hear that your problem is resolved. Please continue using our API and in the event of any further query, please feel free to contact.