如何在Windows 2008计算机上使用AIC加载PDF文件并输出Postscript?

时间:2011-05-12 18:29:27

标签: .net pdf acrobat postscript

如何使用AIC(Acrobat Interapplication Communication)编写代码来加载PDF文件并输出等效的Postscript文件?以交互方式使用Acrobat X,我会打开文件,然后使用菜单文件>另存为...>更多选项...>的PostScript。

理想情况下,我想从Windows服务程序执行此操作,而不在计算机控制台上显示任何窗口。

我已经安装了Acrobat X Pro,并且我已经下载了Acrobat SDK。

我更喜欢C#中的代码示例,但如果需要,我可以从VB或C ++转换。

3 个答案:

答案 0 :(得分:1)

对于最新版本的Ghostscript(v9.02),一个合适的命令行是:

gswin32c.exe ^
  -o output.ps ^
  -sDEVICE=ps2write ^
   input.pdf

答案 1 :(得分:1)

另一种替代方法可能是使用命令行开关调用Acrobat Reader(或Professional?),以便将PDF转换为PostScript。在Linux(Ubuntu Natty)上至少这是Acrobat Reader版本9.4.2提供的(不确定Windows版本是否提供完全相同的CLI开关):

kp@s42:~$  acroread -help
Usage: acroread [options] [list of files] 
Run 'acroread -help' to see a full list of available command line options.
------------------------

Options:
    --display=<DISPLAY>                                          This option specifies the host and display to use.
    --screen=<SCREEN>                                            X screen to use. Use this options to override the screen part of the DISPLAY environment variable.
    --sync                                                       Make X calls synchronous. This slows down the program considerably.
    -geometry [<width>x<height>][{+|-}<x offset>{+|-}<y offset>] Set the size and/or location of the document windows.
    -help                                                        Prints the common command-line options.
    -iconic                                                      Launches in an iconic state on the desktop.
    -info                                                        Lists out acroread Installation Root, Version number, Language.
    -tempFile                                                    Indicates files listed on the command line are temporary files and should not be put in the recent file list.  
    -tempFileTitle <title>                                       Same as -tempFile, except the title is specified.
    -toPostScript                                                Converts the given pdf_files to PostScript.
    -openInNewInstance                                           It launches a new instance of acroread process. 
    -openInNewWindow                                             Same as OpenInNewInstance. But it is recommended to use OpenInNewInstance. openInNewWindow will be deprecated.
    -installCertificate <server-ip> <server-port>                Fetches and installs client-side certificates for authentication to access the server while creating secured connections.
    -installCertificate [-PEM|-DER] <PathName>                   Installs the certificate in the specified format from the given path to the Adobe Reader Certificate repository.
    -v, -version                                                 Print version information and quit.
    /a                                                           Switch used to pass the file open parameters.


Forms of using -toPostScript
    -toPostScript [options] pdf_file ... [ps_dir]
    -toPostScript [options] -pairs pdf_file_1 ps_file_1 ...
    -toPostScript [options]
    Note: When using -toPostScript it must be the first argument passed in on the command line.

Valid options for the conversion of PDF to PostScript:

    -binary                                                      emit binary PostScript where possible.
    -start <int>                                                 identify the first page in the document to be converted (default is the first page of the document).
    -end <int>                                                   identify the last page in the document to be converted (default is the last page of the document).
    -optimizeForSpeed                                            emit PostScript such that all fonts are emitted once at the beginning of the document. 
    -landscape                                                   rotate the pages to print landscape.
    -reverse                                                     reverse the page order of the output.
    -odd                                                         emit only odd-numbered pages.
    -even                                                        emit only even-numbered pages.
    -commentsOff                                                 don't print comments.
    -annotsOff                                                   don't print annots.
    -stampsOff                                                   don't print stamps.
    -markupsOn                                                   print document and markups.
    -level2                                                      emit Level 2 PostScript.
    -level3                                                      emit Level 3 PostScript.
    -printerhalftones                                            use the printer default halftones.
    -saveVM                                                      download fonts as needed to preserve printer memory.
    -shrink                                                      shrink the pages to fit the page size.
    -expand                                                      expand the pages to fit the page size.
    -size <pagesize>                                             set the page size.
    -transQuality level                                          set the transparency flattening level. Value from 1-5.
    -printerName <name>                                          this is to print device-dependent PS.
    -rotateAndCenter                                             auto-rotate and center the pages.
    -choosePaperByPDFPageSize                                    use the pdf page size to determine the output tray.
    -nUp <hpage> <vpage> <pageorder> border rotate               print multiple pages on the same sheet of paper.
    -booklet <subset> <binding> rotate <from> <to>               prints multiple pages on the same sheet of paper in the order required to read correctly when folded.


For detailed description on the options please visit the manpage.

答案 2 :(得分:0)

使用Ghostscript代替它可能更好。在最简单的用例中,使用命令行参数对其进行简单调用作为外部进程将为您进行转换 - 但有几种方法可以实现更好的集成 - 直到创建Postscript虚拟打印机。