使用c#打印PDF而不使用acrobat

问题描述 投票:0回答:1

我在下面使用此代码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# asp.net pdf
1个回答
0
投票

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

如果您需要.NET的Ghostscript包装器,您可以查看Ghostscript.NET库。

通过Ghostscript.NET打印样本可以在这里找到:https://ghostscriptnet.codeplex.com/discussions/470946

© www.soinside.com 2019 - 2024. All rights reserved.