How to work around Mac OS X converting A4 to US Letter


When opening a PostScript (.ps) document, Preview on Mac OS X (at least up to 10.4.9) will sometimes change the page size from A4 to US Letter. This also happens when using the commandline tool pstopdf to convert a PS file to PDF. This tool is located in /usr/bin/pstopdf and has a manual page.

Both Preview and pdftops use the Adobe Distiller framework located in /System/Library/PrivateFrameworks/PSNormalizer.framework which defaults to US Letter, even on machines that are sold outside the USA and which will never print using this size paper. The problem is that Mac OS X does not seem to provide a way to override the default. It might be possible to modify /System/Library/PrivateFrameworks/PSNormalizer.framework/Versions/A/Resources/startupNORM.ps but I'm not a PostScript/PDF expert so this needs to be confirmed.

The problem has been around least since Mac OS X 10.3, according to Thomas Kaiser. As a workaround, he suggests adding a few lines to each PostScript file and also provides a script that will add the appropriate lines.

Thomas also outlines how to tweak the parameters in the startupNORM.ps file (for versions of Mac OS X up to and including 10.3.2) if one wants to produce a smaller PDF file for web viewing, given a PostScript input file. It is unclear why tweaking startup parameters should have stopped working after 10.3.2.

Here is a patch for the mpage commandline utility to ensure that files it creates are not autoconverted to US Letter by Preview or pstopdf, by adding the PostScript code suggested by Thomas Kaiser to every file generated by this tool. (mpage is a commandline tool that turns text into PostScript and can also place multiple pages of PostScript on one sheet of paper, similar to the enscript and psnup utilities combined.)

diff -ur mpage-2.5.5/mpage.c mpage-2.5.5.mod/mpage.c
--- mpage-2.5.5/mpage.c	2006-11-16 22:41:27.000000000 +0000
+++ mpage-2.5.5.mod/mpage.c	2007-04-28 10:52:56.000000000 +0100
@@ -355,6 +355,11 @@
 # endif
     fprintf(outfd, "%%%%EndProlog\n");
 
+    fprintf(outfd, "%%%%BeginFeature: *PageSize Default\n");
+    fprintf(outfd, "<< /PageSize [ %d %d ] >> setpagedevice\n",
+                   ps_width, ps_height);
+    fprintf(outfd, "%%%%EndFeature\n");
+
     if (opt_duplex) {
         fprintf(outfd, "%%%%BeginSetup\n");
         if (opt_tumble) {


Copyright 2007 by András Salamon <andras@dns.net>

Last updated 28-Apr-2007