GhostScript

     

    HowTo Create PDFs without Adobe Distiller. Please see the new and vastly improved DoItYourselfPostscriptPrinter which renders much of this page obsolete.

    These instructions assume you are using MS-Windows. They probably aren't perfect, but they work for me. *nix and Macs users have all the needed tools installed already and are wondering what all the fuss is about.

     

    For the Hasty

     

  • install Ghostscript and GSView
  • install a Postscript printer driver
  • Print to file
  • Run GSView, set page size, open a .ps file, convert to PDF: File > Convert > PDF
  • and that's it. really. smile

     

     

     

    Preparation and Configuration

    Download Ghostscript and GSView. Ghostscript does the work and GSView is a graphical interface to ghostcript.

    Install Ghostscript first and then GSView; the defaults work fine

    Configure your printers to output Postscript files {select printer} > Printer Preferences > Advanced :

    • TrueType? Font: Download as Softfont
    • Postscript Output Option: Encapsulated Postscript

    If you don't have a postscript printer, you can use the any of the PS drivers from http://designjet.hp.com/, the hp5500ps will let you use page sizes up to 60" wide. If large page sizes aren't necessary you can use any of the Apple Color Laser drivers for up 11"x17" (which are distributed with Windows, so you don't need to download anything).

    There is a Distiller PPD you can downlod from Adobe which work even better: http://www.adobe.com/support/techdocs/2eb4a.htm If you try it out please drop your comments here.

    Note: the EPS output option is only for single page compositions. Set to "Optimise for Portability" if you need multiple pages. If you leave it to the default "Optimize for Speed" setting the output file will have printer-specific settings.

     

     

    Create a postscript file, thence to PDF

    In ArcMap (or any other application for that matter), load a map composition select a PS printer, and print to file.

    Fire up GSView, set your page size, open the postscript file. Go to File > Convert > PDF and adjust the options to suit. Generally speaking the only one I change is resoltion (72 for web and 600 for print). And that's all there is to it for the most part.

    If you associate .ps with GSView you can just double-click on any .ps file and it will start GSView automatically, however you have to wait for the page to display before you can change settings like page-size. On large maps this delay is often painfully slow.

    When using a custom page size ( Media > User Defined ) remember to add the units (e.g. in, cm etc.) at the end of the number or GSView assumes you've entered as points . You can add your own page sizes to the drop down media list by editing %userprofile%\gsview32.ini in the [UserMedia] section (this is per user, for system wide settings use %windir%\gswin32.ini ) . Numbers are in points (1pt is 1/72 of an inch, so 36" is 2592pt).

     

     

    Batch Processing

    Set the environment:

    GS=gswin32
    GSC=gswin32c
    GS_DLL=c:\gs\gs8.14\bin
    GS_FONTPATH=c:\gs\fonts;C:\WINDOWS\fonts;Z:\some\other\font\dir\Fonts
    GS_LIB=c:\gs\gs8.14\lib;c:\gs\fonts;C:\WINDOWS\fonts;Z:\some\other\font\dir\Fonts
    PATH=%path%;c:\gs\gs8.14\bin
    
    (setenv_gs.bat.txt a batch file which sets the above. Note: to make these permanent you need to call this batch from autoexec.bat or from Contral Panel > System > Advanced > Environment )

    An example to create a 600dpi 36"x44" pdf:

    D:\> ps2pdf -dDEVICEXRESOLUTION#600 -dDEVICEYRESOLUTION#600 -dDEVICEWIDTH
    #21600 -dDEVICEHEIGHT#26400 printfile.ps output.pdf
    

    Example to convert all files in a directory:

    D:\> for %a in (ansi_e\*.ps) do (
       ps2pdf -dDEVICEWIDTH#21600 -dDEVICEHEIGHT#26400 %a pdfoutdir\%~na.pdf
       )
    

    More information:

     

    Page Size Quick Reference

     

    page name inch wide high cm wide high points wide high
    ANSI A 8.50 11.00 21.59 27.94 612 792
    ANSI B 11.00 17.00 27.94 43.18 792 1224
    ANSI C 17.00 22.00 43.18 55.88 1224 1584
    ANSI D 22.00 34.00 55.88 86.36 1584 2448
    ANSI E 34.00 44.00 86.36 111.76 2448 3168
    A4 8.26 11.70 21.00 29.70 595 842
    A3 11.70 16.54 29.70 42.00 842 1191
    A2 16.54 23.88 42.00 59.40 1191 1720
    A1 23.88 33.11 594.0 84.10 1720 2384
    A0 33.11 46.81 84.10 118.90 2384 3370
    250k NTS map 30.00 28.00     2160 2016
    13 Dec 2005: changed to match Wikipedia:Paper_size .

     

     


    Found a mailing list thread which might be at the root of some problems we've been having with too-fat lines in postscript prints (not ghostscript specific). More on thin lines in Ghostscript PDFs
    Automatic Stroke Adjustment

    When a stroke is drawn along a path, the scan conversion algorithm may produce lines of nonuniform thickness because of rasterization effects. In general, the line width and the coordinates of the endpoints, transformed into device space, are arbitrary real numbers not quantized to device pixels. A line of a given width can intersect with different numbers of device pixels, depending on where it is positioned.

    For best results, it is important to compensate for the rasterization effects to produce strokes of uniform thickness. This is especially important in low-resolution display applications. To meet this need, PDF 1.2 provides an optional stroke adjustment feature. When stroke adjustment is enabled, the line width and the coordinates of a stroke are automatically adjusted as necessary to produce lines of uniform thickness. The thickness is as near as possible to the requested line width - no more than half a pixel different.

    Because automatic stroke adjustment can have a substantial effect on the appearance of lines, a PDF document must be able to control whether the adjustment is to be performed. This can be specified as the value of the SA entry in a graphics state parameter dictionary.

    -- p. 380 of "PDF Reference Second Edition Version 1.3", 2000, Addison Wesley/Adobe

     

     


    Ghostscript v8.5 includes a windows printer PPD so you can just print from any application straight to a PDF, which means you don't have to use GSView as an intermediate step.

    Unfortunately in initial testing I haven't been able to get it to work. It runs but acrobat won't open the results. Weird thing is that GSview has no problems.

     

     

    Ugly Fonts?

    I converted a bunch of old postscript map files to PDF using the ps2pdf batch file. In Acrobat the fonts looked ugly and jagged, almost to the point of being illegible. The printed output was fine however.

    A PDF created from the same file using GSView on the other hand was nice to Acrobat. After much head scratching and searching and hair pulling I finally got ps2pdf to work for both print and display (thanks to Russel Lang and the -d option in GSView):

    Solution 1: delete the GS_FONTPATH environment variable

    Solution 2: pass -sFONTPATH#"" on the command line (sets it to null).

    Why does this happen at all though? http://www.physics.ohio-state.edu/~yurh/doc/tex2pdf/ says "When such a PS file is converted to a PDF file, the resluting [sic] PDF file will have the same problem -- poor display quality on screen, but good quality in print. The reason is that, bitmap fonts are converted to Adobe Type 3 fonts in converting to PDF, and Acrobat displays Type 3 fonts in very poor quality on screen."

     

    Adding Page Sizes to Media Menu

    By default GSView only lists european page sizes in the Media menu. To add other page sizes, edit gsview32.ini and add/change the [UserMedia] section. The numbers are in points, which you is 72 times num. inches:

     

    [UserMedia]
    34x44=2448,3168   ; ansi E
    22x34=1584,2448   ; ansi D
    17x22=1224,1584   ; ansi C
    13x19=936,1368   ; super B, A3+, B+
    30x28=2160,2016   ; Standard 250k NTS Map
    

    gsview32.ini is located in a) the Progam Files directory and b) the User Profile directory c:\documents and settings\username. If you edit the former, changes are made available to all users, however on an upgrade they could be overwritten. For the latter changes are retained through upgrades but must be made for each user independently.

     

     

     

     

    WebForm
    TopicCategory HowTo

     

     

        Send feedback