TransWikia.com

How can I standardize (normalize) the page size in a PDF with lots of small variations in page size?

Unix & Linux Asked by Artmancc on December 26, 2020

My project is about processing a weekly newsletter into an annual PDF compilation.

The hard copy originals were scanned by someone else using Abbyy FineReader. The original documents were US letter size (612 x 792 points), but many/most of the pages are slightly larger or smaller, e.g. 588 x 795.

There is plenty of white space in the margins to crop if needed; likewise, if I have to increase the page size, I can add to the margin. But I would like each page to be exactly 612 x 792. (At 72 pts to the inch, that’s 8.5 x 11 inches.)

I don’t have Adobe Acrobat, so I’m working with open-source tools. Mainly I have been looking at sejda-console and ghostscript, and specifically using ghostscript to apply pdfmarks. Ghostscript is not always helpful in its error messages. One of my documents failed to compile past p. 12, though I couldn’t find anything amiss on p. 13.

I have also attempted to edit the PDF file directly. I’m not very certain about the file structure, which includes a lot of binary stuff mixed in with plain text. The key items, I think, are the MediaBox and possibly CropBox sizes, which I have attempted to change manually using an editor. Mostly, this has worked effectively, although the page by default is anchored at the bottom left corner, meaning that if I change the width and height, for example, it will change the size of the right and top margins respectively. Mostly, this is not objectionable, though occasionally when there is a big change it would be nice to have the added or deleted margin be distributed proportionally left-right and/or top-bottom.

I am posting this in the Unix & Linux forum, which seems to have the bulk of the Stack Exchange traffic on PDF manipulation, even though I have been using my Windows machine for this project. I’ve got a Linux box, too, if needed.

Thanks for any help in pointing me in the right direction.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP