2012-09-18 3 views
0

.NET을 사용하여 동적 PDF를 생성하려고합니다. 내가 찾은 라이브러리는 QuickPDFLibrary입니다. 나는 iTextSharp와 같은 것을 할 수있는 몇 가지 다른 라이브러리가 있다는 것을 알고있다. 그러나 상업용 응용 프로그램에 대한 라이센스가 필요합니다. QuickPDFLibrary는 ASP.NET을 지원한다고 명시하고 있습니다. 그러나, 나는 그것을 작동시키지 못하고 자신의 사이트에서 ASP.NET과 함께 사용하는 문서를 찾을 수 없습니다. DLL과 ActiveX를 설정하는 절차를 수행했지만 그 중 하나가 aspx 페이지의 컨텍스트에서 작동하지 못했습니다. 내 코드는 다음과 같습니다.QuickPDFLibrary를 사용한 동적 PDF 생성

public partial class _Default : System.Web.UI.Page 
{ 
    public QuickPDFAX0816.PDFLibrary qp; 
    protected void Page_Load(object sender, EventArgs e) 
    { 
     qp = new QuickPDFAX0816.PDFLibrary(); 
    } 

    protected void Button1_Click(object sender, EventArgs e) 
    { 
     qp.UnlockKey("UNLOCK KEY HERE"); 

     // This function draws text onto a document 

     // Setup the parameters 
     string fileName = "drawText.pdf"; 

     // Check to see if the library has been successfully unlocked 
     if (qp.Unlocked() == 1) 
     { 
      // Set origin co-ordinates to top left of page 
      qp.SetOrigin(1); 

      // Call the DrawText function 
      qp.DrawText(100, 100, "Hello world from C# and the ActiveX edition of Quick PDF Library"); 

      // Save the changes to the document on the local disk (in the debug folder) 
      int result = qp.SaveToFile(fileName); 

      if (result == 1) 
      { 
       Console.WriteLine("IT worked!"); 
      } 
      else 
      { 
       Console.WriteLine("IT failed!"); 
      } 
      // Open PDF automatically 
      //System.Diagnostics.Process.Start(fileName); 

     } 
     else 
     { 
      // If library could not be unlocked warn the user 
      Console.WriteLine("License key could not be validated. The library was not unlocked."); 
     } 
    } 
} 
+0

안녕하세요, 모두에게 감사드립니다. 나는 ABCpdf.NET과 함께 가기로 결정했다. –

답변

0

시도해보십시오. PDF 샤프 http://www.pdfsharp.net/. MIT 라이선스가있는 오픈 소스이기 때문에 상업용 제품에 대한 매우 독점적 인 라이선스입니다. NET (ActiveX가 없음). 좋은 샘플이 있습니다.