I am using the a2ps utility from Homebrew to pretty print code, generating .ps files, and then the Mac OS X utility pstopdf (used by Preview.app) to convert these to .pdf format. But whatever page size is specified in the PostScript, the generated PDF files have a Letter page size of 11 x 8.5 inches.

For example

a2ps --medium=A4 -P file myfile.py


a2ps --medium=A3 -P file myfile.py

generate PostScript files with the correct page dimensions (A4 and A3 respectively) but when converted to PDF by pstopdf the resulting PDF is Letter size with the output truncated at the right/ bottom edge of the page.

I can't find any mention anywhere of how to specify what default page size pstopdf uses. Opening the PostScript files in Preview.app uses pstopdf in the back end so I get the same result.

  • Can you provide an examples of the .ps, to check that it has setpagedevice instructions and DSC commands? pstopdf falls back to Letter in the absence of any other page size.
    – benwiggy
    Sep 29, 2020 at 10:56
  • I can confirm that a2ps does not include any setpagedevice instructions by default, possibly because these are Level 2 PostScript only. Also, manually adding to the PostScript file produced by a2ps an explicit PageSize entry for setpagedevice with the page dimensions in points does produce the correct output in Preview and from pstopdf. My question is how to change the default page size assumed by pstopdf for example to A4.
    – davidh_73
    Sep 29, 2020 at 17:56
  • 1
    a2ps does have a --setpagedevice option. Perhaps that's what you need? Failing that, it has a flag for including a PostScript prologue file, so you could try issuing the command in there.
    – benwiggy
    Sep 29, 2020 at 20:50
  • Using --setpagedevice=PageSize:"[595 842]" with a2ps works to set the default page size to A4. This can be made the default by adding Options: --setpagedevice=PageSize:"[595 842]" to the a2ps-site.cfg file.
    – davidh_73
    Oct 4, 2020 at 21:28

1 Answer 1


If I remove all page size information from a PostScript file, then Preview renders it on a Letter page, even though my default Paper size in CUPS is A4.

There are no user-accessible options or preferences that I can discern. It's certainly undocumented, if it exists.

You may be better off trying to explicitly define the page size in a2ps.

Alternative PDF creators, like GhostScript, offer greater control over the output.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .