Split A4 PDF page into two A5 and back again

后端 未结 3 1835
北海茫月
北海茫月 2021-01-06 15:25

I have a PDF with A4 pages. Each page contains two identical A5 pages for printing reasons. What I want to do in my Java program is to split these pages and use each unique

3条回答
  •  执念已碎
    2021-01-06 16:04

    A possibly less clunky solution for the record, using pdfjam-related bits. If test.pdf is an A4 landscape doc to be split into A5 portrait:

    1) extract left half-pages

    pdfcrop --bbox "0 0 421 595" --clip --papersize "a5" test.pdf test-left.pdf
    

    Note: --bbox " " works in bp units

    2) extract right half-pages:

    pdfcrop --bbox "421 0 842 595" --clip --papersize "a5" test.pdf test-right.pdf
    

    3) collate pages as desired, e.g.

    pdfjoin test-left.pdf test-right.pdf "1" --outfile test-collated.pdf
    

    4) reglue:

    pdfnup --nup 2x1 test-collated.pdf --a4paper --outfile test-done.pdf
    

提交回复
热议问题