[ 
https://issues.apache.org/jira/browse/PDFBOX-5078?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17265078#comment-17265078
 ] 

Tilman Hausherr edited comment on PDFBOX-5078 at 1/14/21, 6:42 PM:
-------------------------------------------------------------------

[^64-1212 (4).pdf]

Attached a sample booklet PDF file

 
{code}
PDDocument outdoc = new PDDocument();
PDPage page = document.getPage(i);
PDRectangle cropBox = document.getPage(i).getCropBox();
float upperRightY = cropBox.getUpperRightY();
float lowerLeftY = cropBox.getLowerLeftY();

cropBox.setLowerLeftY(upperRightY/2);
cropBox.setUpperRightY(upperRightY/2);
page.setCropBox(new PDRectangle(cropBox.getCOSArray()));
//page.setCropBox(cropBox);
outdoc.importPage(page);
int j = i+1;
outdoc.save(f.getParent()+File.separator+"sample_"+(j)+".pdf");

cropBox = page.getCropBox();
cropBox.setUpperRightY(upperRightY/2);
cropBox.setLowerLeftY(lowerLeftY/2);
//page.setCropBox(cropBox);
page.setCropBox(new PDRectangle(cropBox.getCOSArray()));
outdoc.importPage(page);

outdoc.save(f.getParent()+File.separator+"sample_"+(j+1)+".pdf");
outdoc.close();
{code}



was (Author: apostlechristian377):
[^64-1212 (4).pdf]

Attached a sample booklet PDF file

 

PDDocument outdoc = new PDDocument();
PDPage page = document.getPage(i);
PDRectangle cropBox = document.getPage(i).getCropBox();
float upperRightY = cropBox.getUpperRightY();
float lowerLeftY = cropBox.getLowerLeftY();

cropBox.setLowerLeftY(upperRightY/2);
cropBox.setUpperRightY(upperRightY/2);
page.setCropBox(new PDRectangle(cropBox.getCOSArray()));
//page.setCropBox(cropBox);
outdoc.importPage(page);
int j = i+1;
outdoc.save(f.getParent()+File.separator+"sample_"+(j)+".pdf");

cropBox = page.getCropBox();
cropBox.setUpperRightY(upperRightY/2);
cropBox.setLowerLeftY(lowerLeftY/2);
//page.setCropBox(cropBox);
page.setCropBox(new PDRectangle(cropBox.getCOSArray()));
outdoc.importPage(page);

outdoc.save(f.getParent()+File.separator+"sample_"+(j+1)+".pdf");
outdoc.close();

> How to Split A PDF Page vertically into 2 Pieces via PDFBOX
> -----------------------------------------------------------
>
>                 Key: PDFBOX-5078
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5078
>             Project: PDFBox
>          Issue Type: Bug
>            Reporter: Joseph
>            Priority: Major
>         Attachments: 64-1212 (4).pdf
>
>
> We can able to convert A4 PDF to Booklet PDF via PrintDF open source 
> ([https://github.com/Raudius/PrintDF/blob/master/src/us/raudi/printdf/PrintDF.java)]
> However not able to convert Booklet to A4 i.e that is cutting vertically of a 
> Booklet PDF page and resequence all the pages.
> 1st problem is not sure how to cut veritically each and every PDF page and 
> save as 2 separate PDF page or file
> 2nd re-sequence of the booklet to proper sequence as 1, 2, 3, 4, 5 by first 
> identifying the actual book sequence 
> (http://www.boooks.org/index.php?page=21&lng=1)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to