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.

2120 questions
171
votes
8 answers

How can I extract embedded fonts from a PDF as valid font files?

I'm aware of the pdftk.exe utility that can indicate which fonts are used by a PDF, and wether they are embedded or not. Now the problem: given I had PDF files with embedded fonts -- how can I extract those fonts in a way that they are re-usable as…
simplybest55
169
votes
15 answers

How to extract text from a PDF?

Can anyone recommend a library/API for extracting the text and images from a PDF? We need to be able to get at text that is contained in pre-known regions of the document, so the API will need to give us positional information of each element on the…
Budda007
  • 1,715
  • 2
  • 11
  • 3
85
votes
11 answers

Converting a PDF to PNG

I'm trying to convert a PDF to a PNG image (at least the cover of one). I'm successfully extracting the first page of the PDF with pdftk. I'm using imagemagick to do the conversion: convert cover.pdf cover.png This works, but unfortunately the…
Adam
  • 1,387
  • 1
  • 14
  • 15
70
votes
3 answers

Ghostscript to merge PDFs compresses the result

I found this neat command to merge multiple PDF into one, using Ghostscript: gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=out.pdf in1.pdf in2.pdf The resulting size is smaller than the combined size of the 2 PDFs. Running the command with…
Dimitris Baltas
  • 2,625
  • 3
  • 31
  • 25
56
votes
7 answers

Optimize PDF files (with Ghostscript or other)

Is Ghostscript the best option if you want to optimize a PDF file and reduce the file size? I need to store alot of PDF files and therefore I need to optimize and reduce the file size as much as possible Does anyone have any experience with…
clarkk
  • 24,753
  • 63
  • 173
  • 296
48
votes
5 answers

How to use ghostscript to convert PDF to PDF/A or PDF/X?

Is there a way to use ghostscript to convert PDF to PDF/A or PDF/X? I know it can be used to convert PDF to images, but I don't know if it can be used to convert PDF/A. What parameters should I use?
imgen
  • 481
  • 1
  • 4
  • 3
45
votes
5 answers

Resizing a PDF using Ghostscript

I am trying to scale a PDF which is for example just small of A4 size up to A4. This works fine with portrait documents. The document is scaled up correctly and then padding is added to the top. On landscape documents padding is not added though.…
Matt
  • 505
  • 1
  • 5
  • 8
45
votes
3 answers

PDF text extraction from given coordinates

I would like to extract text from a portion (using coordinates) of PDF using Ghostscript. Can anyone help me out?
AMER
  • 921
  • 2
  • 10
  • 9
44
votes
1 answer

Cropping a PDF using Ghostscript 9.01

I am not a programmer, but would like to learn how to crop a PDF using Ghostscript. I have installed Ghostscript 9.01 in my machine. Please guide me step by step process (starting from invoking Ghostscript) to crop a PDF with the specific…
AMER
  • 921
  • 2
  • 10
  • 9
44
votes
7 answers

What "thread safe" really means...In Practical terms

please bear with my newbie questions.. I was trying to convert PDF to PNG using ghostscript, with ASP.NET and C#. However, I also read that ghostscript is not thread safe. So my questions are: What exactly does "ghostscript is not thread safe" mean…
N_R
  • 463
  • 1
  • 4
  • 6
35
votes
6 answers

Splitting a PDF with Ghostscript

I try to split a multipage PDF with Ghostscript, and I found the same solution on more sites and even on ghostscript.com, namely: gs -sDEVICE=pdfwrite -dSAFER -o outname.%d.pdf input.pdf But it seems not working for me, because it produces one…
zseder
  • 939
  • 2
  • 10
  • 15
34
votes
7 answers

Convert: Postscript delegate failed

I am trying to convert a PDF to JPEG: $ convert pdf-test.pdf pdf-test.pdf.jpg However, I am getting this error: convert: Postscript delegate failed `pdf-test.pdf': No such file or directory @ error/pdf.c/ReadPDFImage/664. convert: missing an image…
Charlie Kee
  • 1,111
  • 3
  • 11
  • 26
32
votes
4 answers

Converting a multi page pdf to multiple pages using a single command

I want to convert multi page pdfs into single page images efficiently. I already know how to do this one page at a time with imagemagick. For example, convert x.pdf[2] x3.jpg will give me the 3rd page of the pdf as an image. So if I figure out how…
Moiz Raja
  • 5,082
  • 6
  • 34
  • 48
31
votes
3 answers

PDF compare on linux command line

I'm looking for a Linux command line tool to compare two PDF files and save the diffs to a PDF outfile. The tool should create diff-pdf's in a batch-process. The PDF files are construction plans, so pure text-compare doesn't work. Something…
Christof Aenderl
  • 3,345
  • 2
  • 27
  • 41
31
votes
5 answers

Any tips for speeding up GhostScript?

I have a 100 page PDF that is about 50 MBs. I am running the script below against it and it's taking about 23 seconds per page. The PDF is a scan of a paper document. gswin32.exe -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dCompatibilityLevel=1.3 …
Abe Miessler
  • 75,910
  • 89
  • 276
  • 451
1
2 3
99 100