halloleo
halloleo

Reputation: 10434

How to cut an overlong PDF page in a series of A4 PDF pages with ImageMagick

I have an overlong PDF containing text and image elements. Here an example:

Overlong PDF

How can I split this page into a PDF with mutiple A4 pages where the first pages contains the top bit, the next page what's shown underneath and so on until the last page which holds the leftover at the bottom.

When I just 'print' the PDF to an new PDF (e.g. in Preview on macOS) in full-width mode only the middle of the input page is saved.

Can I do this easily with ImageMagick?


ps: If generating all pages is too difficult, having just the first page containing the top of the input PDF would be OK too.

Upvotes: 0

Views: 196

Answers (1)

fmw42
fmw42

Reputation: 53154

If your PDF width at 72 dpi is 595, then in Imagemagick 6, you can do

convert image.pdf -crop 595x842 +repage +adjoin result.pdf

If using Imagemagick 7, you can do

magick image.pdf -crop "%[papersize:a4]" +repage +adjoin result.pdf

Upvotes: 1

Related Questions