简体   繁体   English

将PDF转换为PostScript

[英]Convert PDF to PostScript

I need to convert a PDF file to PostScript using C#. 我需要使用C#将PDF文件转换为PostScript。 Is it possible without using a third-party DLL? 是否可以不使用第三方DLL? Or is there an open source project for the same? 还是有一个相同的开源项目?

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: 做到这一点的“最便宜”的方法(尽管在这种情况下,我不会给出“便宜”的定义)是调用其中可以将PDF转换为PostScript的命令行实用程序之一:

  • gswin32c.exe (Win), gs (*nix): Ghostscript , multiplatform, GPL v3 license,... gswin32c.exe (Win), gs (* nix): Ghostscript ,多平台,GPL v3许可证,...
  • pdftops.exe (Win), pdftops (*nix): part of XPDF by Foolabs , multiplatform, GPL v2 license,... pdftops.exe (Win), pdftops (* nix): Foolabs提供XPDF的一部分 ,多平台,GPL v2许可证,...
  • 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) pdftops (* nix),来自XPDF的“ poppler”分支(理论上Windows版本应该易于编译,但是网上没有明显的地方可以从中获取现成的文件)

Here are example commandlines, first for Ghostscript, assuming Windows (quotes for cases where names have spaces): 以下是示例命令行,首先使用Ghostscript,假设使用Windows(名称带有空格的情况下用引号引起来):

 "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): 第二个用于XPDF / pdftops(跳过路径,假设文件位于当前目录中):

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

您应该重新考虑您的要求:解释PDF是一项艰巨的工作,除非PDF格式非常特殊。

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. 您可能能够通过PostScript打印机驱动程序进行PDF到Postscript的转换,然后捕获输出,但这将要求您能够打印PDF文档。 You'll need either a PDF rendering component or a PDF reader application to do that. 您将需要一个PDF呈现组件或一个PDF阅读器应用程序来做到这一点。

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. 如果需要开源工具,请查看ghostscript。 Most 'free' PDF converters use that. 大多数“免费” PDF转换器都使用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM