MacOS – Create a PDF with a custom page size? (Mavericks)

macospdf

I'm trying to create a PDF with a custom page size. Basically, I'm converting a set of JPEGs which are exactly 5:4 dimensions into a single PDF, so I wanted to set the paper size to 8×10, so as not to have "letterbox-type" borders on the top and bottom of the PDF pages. The purpose is for viewing on-screen, not for printing, and these are personal documents which I am not sharing, so there is no need to worry about printability.

I'm using a consumer-grade HP LaserJet printer (P1102W), whose driver apparently "does not support" custom paper sizes. This is evidenced by the fact that I am unable to choose the option to "manage custom sizes" in the paper size list – it is grayed out.

Researching around the Internet seems to reveal that only certain drivers actually will let you configure a custom page size. To experiment, in TextEdit (which does have the Page Setup option), I was able to configure a custom page size. However, Preview does not have a Page Setup option. I've also seen screenshots where certain HP drivers do enable this option, but I obviously don't know which ones, nor do I have the corresponding printer or driver on my system.

I tried installing a generic PostScript printer driver by entering a nonexistent IP into the network printer settings, but even then I was unable to set the custom page size.

Is there any solution I can use to accomplish this? Remember, the goal is to produce a PDF file with a custom page size to eliminate borders, and that PDF will never need to be printed. It seems silly to be limited by the printer driver when the goal is to produce a generic PDF…

Thanks!

EDIT: Ghostscript may be able to do this, but there's something wrong with either my installation or with the Ghostscript that Homebrew installed.

I created a PDF with Preview that had borders, and am now trying to use GS to change the page size. Here's the result:

Mac-mini:~ fmillion$ gs -sDEVICE=pdfwrite -dDEVICEWIDTHPOINTS=612 -dDEVICEHEIGHTPOINTS=720 -dFIXEDMEDIA -c "<</PageOffset [0 36]>> setpagedevice" -o test1.pdf test.pdf 
GPL Ghostscript 9.14 (2014-03-26)
Copyright (C) 2014 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
**** Unable to open the initial device, quitting.

If I do not include the "-c" option along with its parameter, the operation succeeds, but I end up with a page with a half inch at the bottom and the top half inch of the page cut off. The idea of the PageOffset command was to shift the entire page down by 36 points, thus eliminating the bottom border.

I'm using the Ghostscript provided by Homebrew, simply installed with "brew install ghostscript".

Best Answer

It is possible to convert images to PDFs without 'placing them on a default page', so that each page will be whatever size the image is.

There is a collection of python scripts and Automator Actions here, which include one to batch convert images to PDF in that way.

https://github.com/benwiggy/PDFsuite