使用c#打印PDF,不需要acrobat

本文关键字:不需要 acrobat PDF 打印 使用 | 更新日期: 2023-09-27 18:14:18

我使用下面的代码PdfDocument来自SpirePDF库。打印出来了,但文件从左边切下来,质量不好。我想在不使用Acrobat的情况下实现这一点。我想不出怎么做这件事。谁能告诉我哪里错了?

 bool returnValue = false;
          PdfDocument document = new PdfDocument( filePath );
          try {
            document.PrintDocument.PrinterSettings.PrinterName = printer;
            document.PrintDocument.Print();
            returnValue = true;
          } catch( Exception ex ) {
            //throw new Exception( ex.Message );
            returnValue = false;
          }
          return returnValue;

使用c#打印PDF,不需要acrobat

我不知道SpirePDF库,但没有Acrobat打印pdf的一种方法是使用Ghostscript库。

如果你需要。net的Ghostscript包装器,你可以看看Ghostscript。图书馆。

通过Ghostscript打印样本。https://ghostscriptnet.codeplex.com/discussions/470946