were $ is a bash prompt, GS> a ghostscript one.
Creating a PDF from postscript {{{
gs -dNOPAUSE -sOutputFile=out1.pdf -sDEVICE=pdfwrite -dPDFSETTINGS=/screen -dBATCH file.ps
Other settings for -dPDFSETTINGS
- /prepress
- /screen
- /printer
- /default
- /ebook
}}}
Changing Page Sizes/ Offsets (eg. to crop to A5) {{{
$gs -dNOPAUSE -sOutputFile=out1.pdf -r300 -sDEVICE=pdfwrite -dFIXEDMEDIA=true -g2480x1754
- The -gWIDTHxHEIGHT is specified in pixels (ie. 300 per inch with the -r300).
- type exactly but replace x and y with the page offset in points:
GS> << /PageOffset [x y] >> setpagedevice
GS> (print.ps) run
- then press ctrl-D to exit GS.
Examples
- image at top of page, you want to shift it down, use y<0
- when gs crops a page, the new page is bottom-right aligned (hmmm, handy…)
This:
<< /PageOffset [0 -420.945 ] >> setpagedevice
is what you need if you have:
a4:
+++++++
| XXX |
| XXX |
| |
| |
+++++++
and you want:
a5
+++++++
| XXX |
| XXX |
+++++++
the -g option
the numbers refer to pixels (2480 = 300dpi x 210mm / (25.4mm/inch) )
@300dpi,
- A5 landscape: -g2480x1754
- A5 portrait : -g1754x2480
- A4 landscape: -g2480x3508
}}}
Explaining {{{
GS> << /PageOffset [x y] >> setpagedevice
-- ----------- ----- -- + this is a Level 2+ feature that alters
| | | | the "page device dictionary"
| | | +--- this is "end of dictionary": puts it on stack
| | +------- an array of two values assigned to the key
| | in the dictionary being defined.
| +---------------- the name for the key in the dictionary
+------------------------ this is "start of dictionary"
Other options for page device: (* level 3 operator):
/PageSize Takes array [w h]
/ImageBBox Takes array [l b r t] or null. Anything outside
this box won't be painted. Set to null for max.
Should always set to null after setting /PageSize
/Separations* boolean
/SeparationColorNames
/ImageShift* Takes array [x y]. On front sides, x = left,
y = up. On back it would be reversed.
/PageOffset* Seems to me to be the same.
/Margins This is for device-dependant adjustments and
shouldn't be used for page positioning.
/ProcessColorModel one of
DeviceGray, DeviceRGB, DeviceCMYK,
DeviceCMY, DeviceRGBK, DeviceN*
(ref. p.422)
}}}
Colour Separations {{{
There’s an “aurora” script for this written by Graham Freeman g-freeman@adfa.edu.au
$ cat aurora black 85.lpi myfile.ps >myfile_black_plate.ps
$ cat aurora cyan 85.lpi myfile.ps >myfile_cyan_plate.ps
can do for cmyk and red, blue and green. Only postscript level1 though.
}}}
Output one file per page {{{
-sOutputFile=ABC-%d.png
produces 'ABC-1.png', ... , 'ABC-10.png', ...
-sOutputFile=ABC-%03d.pgm
produces 'ABC-001.pgm', ... , 'ABC-010.pgm', ...
-sOutputFile=ABC_p%04d.tiff
produces 'ABC_p0001.tiff', ... , 'ABC_p0510.tiff', ... , 'ABC_p5238.tiff'
}}}
