How to convert PDF from two slides per page into one slide per page

conversionimagemagickpdf

I have a presentation in pdf file with two slides per page.

I want a presentation in pdf file with one slide per page.

I tried using ImageMagick:

convert -crop 1x2@ orig.pdf t2.pdf 

It divided the slides, but didn't crop them. In new file slides had whitespace on half of the page. I added +repage:

convert -crop 1x2@ orig.pdf +repage t6.pdf

It only worked on every second slide. Odd numbered slides still had the white space.

Best Answer

You need to +repage before and after the cropping operation.

convert -quality 100 -density 300 orig.pdf +repage -crop 1x2@  +repage t6.pdf

From the Imagemagick site you can read

It might be necessary to +repage the image prior to cropping the image to ensure the crop coordinate frame is relocated to the upper-left corner of the visible image. Similarly you may want to use +repage after cropping to remove the page offset that will be left behind. This is especially true when you are going to write to an image format such as PNG that supports an image offset.


As noticed from the OP this conversion from a vectorial pdf can be lossless.
The introduction of the option -density 300 will give a resolution maybe acceptable for our purpose that we will pay with an increased size of the file.
It can be increased e.g.to 600 DPI or more if needed.

If the file contains slides (e.g. from a powerpoint), included as images inside the PDF file it's possible to extract these with pdftoppm and include them in a new pdf file.

pdftoppm - Portable Document Format (PDF) to Portable Pixmap (PPM) converter

pdftoppm converts Portable Document Format (PDF) files to color image files in Portable Pixmap (PPM) format, grayscale image files in Portable Graymap (PGM) format, or monochrome image files in Portable Bitmap (PBM) format.

Related Question