TenB
TenB

Reputation: 21

Convert PDF to PostScript

I need to convert a PDF file to PostScript using C#. Is it possible without using a third-party DLL? Or is there an open source project for the same?

Upvotes: 0

Views: 11029

Answers (3)

Kurt Pfeifle
Kurt Pfeifle

Reputation: 90213

The "cheapest" way to do this (I will not give my definition of 'cheap' in this context, though) would be to call one of the commandline utilities out there which can convert PDF to PostScript:

  • gswin32c.exe (Win), gs (*nix): Ghostscript, multiplatform, GPL v3 license,...
  • pdftops.exe (Win), pdftops (*nix): part of XPDF by Foolabs, multiplatform, GPL v2 license,...
  • pdftops (*nix), from the "poppler" fork of XPDF (in theory a Windows version should be easy to compile, but there are no obvious places on the 'net to grab ready-made ones from)

Here are example commandlines, first for Ghostscript, assuming Windows (quotes for cases where names have spaces):

 "c:/path/to/gswin32c.exe" ^
     -sDEVICE=ps2write ^
     -o "c:/path/to/OUTPUT.pdf" ^
     "c:/path/to/INPUT.pdf"

and second for XPDF/pdftops (skipping paths, assuming files are in current directory):

 pdftops.exe ^
     -level3 ^
     INPUT.pdf ^
     OUTPUT.ps

Upvotes: 5

Marnix van Valen
Marnix van Valen

Reputation: 13673

I don't think this can be done without a third party application or component.

You may be able to do a PDF to postscript conversion through a PostScript printer driver and then capture the output, but that would require you to be able to print PDF documents. You'll need either a PDF rendering component or a PDF reader application to do that.

Consider spending some cash on a decent conversion lib. I think you'll find it money well spent.

If you need an opensource tool, look into ghostscript. Most 'free' PDF converters use that.

Upvotes: 0

Ned Batchelder
Ned Batchelder

Reputation: 375574

You should reconsider your requirements: interpreting PDF is a huge job, unless the PDFs come in very specific forms.

Upvotes: 1

Related Questions