tags:

views:

57

answers:

4

I am stuck up with a file conversion issue. I need to convert a PDF file to postscript file(Through program c#). Is it possible without any third party dll?? Any one can suggest open source projects for the same?

A: 

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

Ned Batchelder
A: 

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.

Marnix van Valen
Thanks Marnix,Can you suggest any suitable libs?
TenB
For printing PDF from .NET (C#, VB etc.) you could use [PDFRasterizer.NET by TallComponents](http://www.tallcomponents.com/pdfrasterizer3.aspx "PDFRasterizer.NET by TallComponents") (Note that I've worked for TallComponents). I'm not aware of any libs that can do direct conversions from PDF to postscript.
Marnix van Valen
+1  A: 

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
pipitas
A: 

I can't leave a comment yet, so please check my answer to http://stackoverflow.com/questions/3492129

mosheb