
To do this programmatically using PDFBox, here's the code snippet:
/*******************************************************
* Set the PDF to open up in 2-Page view as default
*
* @param pdfDoc
*******************************************************/
public static void set2PageView(PDDocument pdfDoc)
{
PDPageFitDestination dest = new PDPageFitDestination();
dest.setPage(pdfDoc.getPage(0));
PDActionGoTo action = new PDActionGoTo();
action.setDestination(dest);
pdfDoc.getDocumentCatalog().setOpenAction(action);
// PagetLayout
// TWO_PAGE_LEFT = Two-up (Facing)
// TWO_PAGE_RIGHT = Two-up (Cover Page)
pdfDoc.getDocumentCatalog().setPageLayout(PageLayout.TWO_PAGE_RIGHT);
}
No comments:
Post a Comment