Questions tagged [ghostscript]

Ghostscript is a suite of software based on an interpreter for Adobe Systems' PostScript and Portable Document Format (PDF) page description languages.

Ghostscript is software which converts and processes different graphic formats:

  • Inputs: it can read in Portable Document Format (PDF), PostScript (PS) and Encapsulated PostScript (EPS)
  • Outputs: it can output PDF, PS, EPS and many graphic and raster image formats such as TIFF, JPEG, PNG, PNM, PPM, PCL.

Ghostscript's executables are frequently named...

  • ...gs (on Linux, Unix and Mac), and gswin32c.exe or gswin64c.exe for commandline-only interface,
  • ...gsx (on Linux, Unix and Mac), and gswin32.exe or gswin64.exe for the interface that also pops up a window with the rendered file.

The GhostPDL "extension" to Ghostscript can additionally process the Extensible Paper Specification (XPS), and Hewlett Packard's PCL and convert these to most of the above mentioned output formats.

The commandline tools of the GhostPDL extension are named...

  • ...pcl6 for PCL input,
  • ...gxps for XPS input,

Ghostscript can also be described as a PostScript interpreter and as a PDF interpreter as well as a PDF distiller. As such it aims to be as compatible as possible with Adobe Systems' PostScript interpreter and Acrobat Distiller products. That means you can ask Ghostscript to process (most of) the same setdistillerparams as are documented by Adobe.

2294 questions
14
votes
4 answers

Script (or some other means) to convert RGB to CMYK in PDF?

Is it possible to write a script for Adobe Illustrator or some other tool that will read the contents of a number of PDF files and convert all the RGB colours to CMYK? If so, could somebody please point out some of the steps involved, or where to…
DaveDev
  • 41,155
  • 72
  • 223
  • 385
14
votes
3 answers

How to install, test, convert, resize PDF using ImageMagick, Ghostscript, Windows Vista/7 x64

I'm having trouble with getting ImageMagick and Ghostscript to work together - everything seems difficult, from installation, to testing, to actually using the software. Does anyone have any tips?
Ben
  • 54,723
  • 49
  • 178
  • 224
14
votes
2 answers

PDF - Remove White Margins

I would like to know a way to remove white margins from a PDF file. Just like Adobe Acrobat X Pro does. I understand it will not work with every PDF file. I would guess that the way to do it, is by getting the text margins, then cropping out of…
jacktrades
  • 7,224
  • 13
  • 56
  • 83
13
votes
1 answer

Stamp PDF file with control for position of stamp file

Does anyone know about stamping PDF file to PDF file and also controls for positioning PDF file stamp? I have a file orginal.pdf and logo.pdf. I want to stamp logo.pdf file to file orginal.pdf at the top left of file original.pdf. How can it be done…
een qren
  • 139
  • 1
  • 1
  • 4
13
votes
5 answers

Converting a multiple-page PDF to a single image

I'm attempting to convert a PDF into a single image using GhostScript. Only the first page is converted, while my intention is to generate a horrendously tall PNG/JPG image with all the pages concatenated together. These are the parameters I'm…
TheFuzzy
  • 185
  • 1
  • 1
  • 9
13
votes
5 answers

Using ImageMagick or Ghostscript (or something) to scale PDF to fit page?

I need to shrink some large PDFs to print on an 8.5x11 inch (standard letter) page. Can ImageMagick/Ghostscript handle this sort of thing, or am I having so much trouble because I'm using the wrong tool for the job? Just relying on the 'shrink to…
ceejayoz
  • 176,543
  • 40
  • 303
  • 368
13
votes
4 answers

How to determine string height in PostScript?

I need to determine the height of a string (in given scale and font) in postscript. /Helvetic-Oblique findfont 10 scalefont setfont 10 10 1 0 360 arc fill 10 10 moveto (test) dup stringwidth pop 2 div neg 0 rmoveto show will print test centered…
willem
  • 2,617
  • 5
  • 26
  • 38
13
votes
4 answers

How to print PDF on default network printer using GhostScript (gswin32c.exe) shell command

I'd like to print PDF file(s) on windows' network printer via GhostScript. (I dont want to use Adobe Reader) I've read gswin32c.exe which can do the job. I experimented with many commands and coudn't find the way how to force gs to print PDF on my…
Maciej
  • 10,423
  • 17
  • 64
  • 97
13
votes
2 answers

Reducing PDF file size using Ghostscript on Linux didn't work

I have about 50-60 pdf files (images) that are 1.5MB large each. Now I don't want to have such large pdf files in my thesis as that would make downloading, reading and printing a pain in the rear. So I tried using ghostscript to do the following: gs…
dearN
  • 1,256
  • 4
  • 19
  • 40
12
votes
3 answers

ImageMagick/Imagick convert PDF to JPG using native PHP API

I’m attempting to convert PDF files into PNGs. It works great from the command line (I do have GhostScript 8.64 installed). But from PHP I’m having a problem: code: $im = new Imagick($pdf_file); // this is where it throws the exception…
matt
  • 846
  • 2
  • 10
  • 13
12
votes
2 answers

How can I remove all images from a PDF?

I want to remove all images from a PDF file. The page layouts should not change. All images should be replaced by empty space. How can this be achieved with the help of Ghostscript and the appropriate PostScript code?
Kurt Pfeifle
  • 86,724
  • 23
  • 248
  • 345
12
votes
1 answer

embedFonts complains about “Unknown device: pswrite”

Running embedFonts on some EPS file I created, I get an error message: > embedFonts("foo.ps") Unknown device: pswrite Unrecoverable error: undefined in .uninstallpagedevice Operand stack: defaultdevice Error in embedFonts("foo.ps") : status 1…
MvG
  • 57,380
  • 22
  • 148
  • 276
12
votes
0 answers

Simple VB.Net Wrapper for Ghostscript Dll

I love Ghostscript. You can use it to convert pdf's to graphics files, split and/or merge pdf files, make thumbnails, and a whole bunch of other stuff. And, it's free, open-source software! There are scads of posts on web sites on how to use…
oldvbguy
  • 203
  • 3
  • 8
11
votes
4 answers

Changing the text and background color of a PDF file

I'd like to change the background color and text color programmatically in PDF documents so that they're nicer to read at night (kinda like in Adobe Reader: Edit -> Preferences -> Accessibility -> Replace Document Colors). Is there any good command…
Bedford
  • 1,136
  • 2
  • 12
  • 36
11
votes
3 answers

Obey the MediaBox/CropBox in PDF when using Ghostscript to render a PDF to a PNG

I've been using Ghostscript to convert my single figure plots rendered in PDF to PNG: gswin32c -sDEVICE=png16m -r300x300 -sOutputFile=junk.png ^ -dBATCH -dNOPAUSE Figure_001-a.pdf This works in the sense I get a PNG out and it contains the…
user319080
  • 121
  • 1
  • 4