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

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.

Unix & Linux Asked by Artmancc on December 26, 2020

0 Answers

Add your own answers!

Related Questions

How to validate a line if followed by a specifc line?

2  Asked on December 29, 2020 by user441539


LightDM: how to distinguish users with the same name?

2  Asked on December 29, 2020 by maddin25


Making bit identical ext2 filesystems

4  Asked on December 28, 2020 by jhufford


Which installed software packages use the most disk space on Debian?

9  Asked on December 28, 2020 by mirzhan-irkegulov


How to force ddclient to use only HTTPS?

0  Asked on December 28, 2020 by mountainx


How to execute a script after every systemd automount?

1  Asked on December 27, 2020 by john-wh-smith


How to detect and clean up junk journal files?

1  Asked on December 27, 2020 by reinierpost


ARM LXC Container template

2  Asked on December 27, 2020 by bulkmoustache


Updating kernel: vmlinuz in /boot not being created by DNF

4  Asked on December 26, 2020 by big-millz


Samba shared folder with setgid problem

1  Asked on December 24, 2020 by alex-forencich


Ask a Question

Get help from others!

© 2022 All rights reserved.