Merge Concetenate pdf files with bookmark

I almost tested your product before purchasing.

The merging is great.
How do I add bookmark for each pdf file?

PdfFileEditor editor = new PdfFileEditor();
FileOutputStream outputStream = new FileOutputStream(baseFolder + this.pdfFileName);
editor.concatenate(pdfs, outputStream);
outputStream.close();

Thanks,
Chang Shin

Hi Chang,


Thanks
for using our products.

You
need to programmatically manage the Bookmarks i.e. Export the bookmark using
ExportBookmarksToXML(…) method of PdfBookmarkEditor class. Once the PDF files are concatenated, you can import the bookmarks from XML file using ImportBookmarksWithXML(…) method.

But
during Bookmark Import, there will be an issue with the page number to which
particular bookmark will be pointing. After the PDF concatenation, the page
numbering will be changed.

[Java]

PdfBookmarkEditor pCE=new
PdfBookmarkEditor();<o:p></o:p>

try {

pCE.bindPdf(path+"example1_Bookmarks.pdf");

} catch (FileNotFoundException e) {

e.printStackTrace();

}

pCE.ExportBookmarksToXML(path+"bookmarkXML.xml");

If I got the each pdf file pages, It would be ok.
but how do I get the pdf totakl page size?

I tried to use it. there is no Document in pdf jar file.
Only Word jar has The Document.
If I use the word Document, it does not work.

//open document
com.aspose.pdf.Document pdfDocument = new com.aspose.pdf.Document(“input.pdf”);
//get page count
System.out.printf("Page Count :- " + pdfDocument.getPages().size());

Thanks,
Chang Shin


I found the code to get pdf total pagse size:

PdfFileInfo pdfInfo = new PdfFileInfo(path + “Temp\” + fileName);
pdfInfo.getNumberofPages();

Thanks,
Chang Shin

Finally, I merged couple pdf files. they are really happy with your product
I need more these options:

1. Reduce file size.
2. Set Open Options
a. Single page continuous
b. magnification = fit page
c. reside window to initial page = yes
d. center window on screen
3. remove hidden information
4. OCR (Optical Character Recognition)

Could recommend where I can find these options?

Thanks,
Chang Shin

Hi Chang,

Please note that Document class is part of DOM approach which is currently available in Aspose.Pdf for .NET and recently

we have migrated the code of Aspose.Pdf for .NET to Java version so all the current features/functionalities available in Aspose.Pdf for .NET

will also become available in new release version of Aspose.Pdf for Java. Currently we are busy testing the new auto-ported version and once it becomes

available, we would be more than happy to update you with the status of availability.

The current release version does not work with features specified under Working with Aspose.Pdf (DOM). We are sorry for this inconvenience.

Chang Shin:
I found the code to get pdf total pagse size:

PdfFileInfo pdfInfo = new PdfFileInfo(path + “Temp\” + fileName);
pdfInfo.getNumberofPages();
Hi Chang,

Yes you are right. getNumberofPages() method of PdfFileInfo class provides the feature to get page count of a PDF document.

Hi Chang,

I am afraid currently Aspose.Pdf.Kit for Java does not support the feature to compress the PDF files. However the upcoming release version of Aspose.PDF for Java (Auto-ported version) provides the capability to compress the input document. We are sorry for this inconvenience.

  1. Set Open Options
    a. Single page continuous
    b. magnification = fit page
    c. reside window to initial page = yes
    d. center window on screen

Please try using changeViewerPreference(intviewerAttribution) method of PdfContentEditor class to accomplish your requirements. You may pass any value from [ViewerPreference](http://www.aspose.com/docs/display/pdfkitjava/ViewerPreference) enumeration.

  1. remove hidden information

Can you please share what sort of information you need to remove from PDF file ?

  1. OCR (Optical Character Recognition)

In order to perform OCR, first you need to convert the page of PDF file to Image format using Aspose.Pdf.Kit for Java and then use Aspose.OCR for Java to accomplish your requirements. For further information, please visit

Thank you for speedy reply.
I am checking.

Chang Shin

I used these codes. It works
One more thing.
How to see bookmarks too?
they want to see the bookmark when the file is opened.

Thanks,
Chang Shin

PdfContentEditor pdfContentEditor = new PdfContentEditor();
pdfContentEditor.bindPdf(path + outputFile);
ViewerPreference viewerPreference = new ViewerPreference();
pdfContentEditor.changeViewerPreference(viewerPreference.CenterWindow);
pdfContentEditor.changeViewerPreference(viewerPreference.FitWindow);
pdfContentEditor.changeViewerPreference(viewerPreference.PageLayoutSinglePage);
pdfContentEditor.changeViewerPreference(viewerPreference.DisplayDocTitle);
//pdfContentEditor.changeViewerPreference(viewerPreference.PageLayoutTwoColumnLeft);
//pdfContentEditor.changeViewerPreference(viewerPreference.PageModeFullScreen); withput menu//
pdfContentEditor.save(path + outputFile);

I use this codes to get bookmark.
How do I add sub bookmark?

String[] bookmarkNames = new String[bookMarkList.size()+1];
int[] bookmarkPages = new int[bookMarkList.size()+1];
bookmarkNames[0] = “Email Message”;
int index = 0;
for ( String fileName : bookMarkList ) {
index++;
bookmarkNames[index] = fileName;
}

PdfBookmarkEditor pdfBookmarkEditor = new PdfBookmarkEditor();
pdfBookmarkEditor.bindPdf(baseFolder + this.pdfFileName);
pdfBookmarkEditor.createBookmarkOfPage(bookmarkNames, bookmarkPages);
pdfBookmarkEditor.save(baseFolder + this.pdfFileName);


Thanks
Chang Shin

I added the sub bookmark. they are ok.
I want to see the bookmakr when we open the pdf file.
How can I find the code?
I found this code in pdf library.

OpenType.Bookmarks;

How can I use this code to show bookmark?

Thanks,
Chang Shin


Chang Shin:
I want to see the bookmakr when we open the pdf file.
How can I find the code?
I found this code in pdf library.

OpenType.Bookmarks;

How can I use this code to show bookmark?
Hi Chang,

Thanks for contacting support.

Please note that in order to have the Bookmarks section open by default (when PDF file is viewed), please try using following code lines.

[Java]

com.aspose.pdf.kit.PdfContentEditor
pdfContentEditor = new
com.aspose.pdf.kit.PdfContentEditor();<o:p></o:p>

pdfContentEditor.bindPdf("c:/pdftest/Bookmarked_output.pdf");

com.aspose.pdf.kit.ViewerPreference viewerPreference = new com.aspose.pdf.kit.ViewerPreference();

pdfContentEditor.changeViewerPreference(viewerPreference.PageModeUseOutlines);

pdfContentEditor.save("c:/pdftest/Bookmarked_Open_Default.pdf");

It works.
however It is the document description:

“PageModeUseOutlines”
"Document outline visible. "

I think the description is not enough for us…

Thanks,
Chang Shin

Hi Chang,

I am glad to hear that your requirement has been accomplished with earlier stated code snippet. Now concerning to the limited documentation of ViewerPreference class, we are working on preparing more articles and topics which can help in better understanding the features of this class. Meanwhile I have added the related information under following topic Tips and Tricks

We are sorry for this inconvenience.

Great!.
We will buy your product soon.

Thanks,
Chang Shin

Hi Chang,
Thanks for your patience.

I am pleased to share that an autoported MergedAPI version of Aspose.Pdf for Java 4.0.0 has been released. Please try using the latest release version and in case you encounter any issue or you have any related query, please feel free to contact.

Hello
How did you get sub bookmarks please ?
thank you.