2015-02-03 4 views
3

ghostscript api를 사용하여 pdf를 인쇄하는 방법. Google을 시도했지만 여전히 적절한 해결책을 얻지 못했습니다. 이 일을 어떻게 도와 드릴까요?Ghostscript.NET.dll 지정된 프린터로 PDF 인쇄

+0

당신은 구글은 충분하지 않았다. http://stackoverflow.com/questions/21462247/printing-pdf-using-ghostscript-net-dpi-printing-issue | 필요한 경우이 변환기를 사용할 수 있습니다. http://codeconverter.sharpdevelop.net/SnippetConverter.aspx –

+1

https://ghostscriptnet.codeplex.com/discussions/574516 | https://ghostscriptnet.codeplex.com/discussions/470946 –

+0

@Visual Vincent 위의 모든 예는 pdf 이미지로 변환합니다. 나는 인쇄 pdf를 프린터로 보내고 싶다. –

답변

5

이 (Ghostscript.NET 래퍼를 사용하여) 당신을 위해 작동합니다 :

using System; 
using System.Collections.Generic; 
using Ghostscript.NET.Processor; 

namespace Ghostscript.NET.Samples 
{ 
    public class SendToPrinterSample : ISample 
    { 
     public void Start() 
     { 
      // YOU NEED TO HAVE ADMINISTRATOR RIGHTS TO RUN THIS CODE 

      string printerName = "YourPrinterName"; 
      string inputFile = @"E:\__test_data\test.pdf"; 

      using (GhostscriptProcessor processor = new GhostscriptProcessor()) 
      { 
       List<string> switches = new List<string>(); 
       switches.Add("-empty"); 
       switches.Add("-dPrinted"); 
       switches.Add("-dBATCH"); 
       switches.Add("-dNOPAUSE"); 
       switches.Add("-dNOSAFER"); 
       switches.Add("-dNumCopies=1"); 
       switches.Add("-sDEVICE=mswinpr2"); 
       switches.Add("-sOutputFile=%printer%" + printerName); 
       switches.Add("-f"); 
       switches.Add(inputFile); 

       processor.StartProcessing(switches.ToArray(), null); 
      } 
     } 
    } 
} 
+1

덕분에 그 작품 : ( –

+0

나는 ghost 스크립트 설치와 함께 아래 링크 코드를 제안했다. 나는 gsdll32.dll 어셈블리 바이너리와 GhostscriptVersionInfo를 시도했다. [link] (https://ghostscriptnet.codeplex.com/discussions/465418) 네이티브 dll 및 관리되는 어셈블리를 사용하는 방법을 알려주십시오. –

+0

pdf1.7 (xfa) –

관련 문제