2017-12-12 37 views
-1

어떤 이유로 ABCpdf에서이 오류의 원인이 무엇인지 알 수 없습니다. 우리는 v9에서 v11로 업그레이드 중입니다. 우리는 dll과 그냥 참조를 포함하여 노력했지만 둘 다 작동하는 것으로 보입니다. 우리는 웹 양식 웹 사이트와 IIS를 사용하는ABCChrome, WebSupergoo.ABCpdf11.Internal.PDFException을 찾을 수 없습니다.

docPDF.AddImageHtml(strHTML);에 오류가 발생

라인입니다.

An exception occurred: WebSupergoo.ABCpdf11.Internal.PDFException: Could not find ABCChrome. 
at WebSupergoo.ABCpdf11.Internal.Chrome.ABCChromePool.GetABCChromePath() 
at WebSupergoo.ABCpdf11.Internal.Chrome.ABCChromePool.GetWorker(IHtmlChromeOptions options) at WebSupergoo.ABCpdf11.Internal.Chrome.ABCChromePages.AddImageUrl(String url) 
at WebSupergoo.ABCpdf11.Internal.Chrome.ABCChromePages.AddHtml(String html) 
at WebSupergoo.ABCpdf11.Doc.AddUrlHtml(String urlOrHtml, Boolean isHtml, Boolean paged, Int32 width, Boolean disableCache) 
at WebSupergoo.ABCpdf11.Doc.AddImageHtml(String html, Boolean paged, Int32 width, Boolean disableCache) at WebSupergoo.ABCpdf11.Doc.AddImageHtml(String html) 
at VIGWorker.GeneratePDF() in c:\dev\ClarityFoundations\CFWebsite\Client\VG\pages\VG_VisualIndexGen.aspx.cs:line 1249 

함수 호출

public void GenerateTestPDF(string strHTML) { 
    try 
    { 
     // Using trial license for v11 
     // Install the license 
     string strLicense = App.Model.Parm.GetValue("REPORT-PDF-ABCPDF-LICENSE"); 
     if (!string.IsNullOrEmpty(strLicense)) 
     { 
      XSettings.InstallLicense(strLicense); 
     } 

     // Load the CMS header and footer 
     string strHeader = CMS.GetContentHTML_ShowError("My_Header"); 
     string strFooter = CMS.GetContentHTML_ShowError("My_Footer"); 

     // Create new PDF Document object: 
     Doc docPDF = new Doc(); 

     // Setup the main document parameters 
     docPDF.TopDown = true; 

     // Portrait layout. Page is 8.5x11 inches, at 72 pixels per inch 
     docPDF.MediaBox.Width = (8.5 * 72); // 612 pixels 
     docPDF.MediaBox.Height = (11 * 72); // 792 pixels 

     // We want a body rect that has 1/2 inch margin on right and left, and 1 inch on top and bottom for header and footer. 
     docPDF.Rect.String = docPDF.MediaBox.ToString(); 
     docPDF.Rect.Inset(36, 72); // 1/2 inch margin on right and left, 1 inch on top and bottom for header/footer 

     iItemsPerRow = 3; 
     iRowsPerPage = 5; 

     //Figure out maximum picture size based on page size and items per page 
     // WIDTH: We want ~10 pixels on sides and in between columns 
     int iPageWidth = (int)docPDF.Rect.Width; 
     iMaxImageWidth = (iPageWidth - (10 * (iItemsPerRow + 1)))/iItemsPerRow; 

     // HEIGHT: We want ~10 pixels on all sides and in between rows, and also about 60 for text below picture. 
     int iPageHeight = (int)docPDF.Rect.Height; 
     iMaxImageHeight = (iPageHeight - ((10 * (iRowsPerPage + 1)) + (60 * iRowsPerPage)))/iRowsPerPage; 

     // Calculate the ration to use when comparing image height to width, and the CSS to use depending on which one we choose. 
     fImageRatio = (float)iMaxImageWidth/(float)iMaxImageHeight; 
     strImageCSSByWidth = "width:" + iMaxImageWidth.ToString() + "px; height:auto;"; 
     strImageCSSByHeight = "height:" + iMaxImageHeight.ToString() + "px; width:auto;"; 

     // Get the F/L/FL icon locations 
     strFIcon = strBaseURL + "/Images/VI_Icon_F.png"; 
     strLIcon = strBaseURL + "/Images/VI_Icon_L.png"; 
     strFLIcon = strBaseURL + "/Images/VI_Icon_FL.png"; 

     // Start on page 1 
     docPDF.Page = 1; 

     if (!string.IsNullOrWhiteSpace(strHTML)) 
     { 
      int iTextID = docPDF.AddImageHtml(strHTML); 
      while (docPDF.Chainable(iTextID)) 
      { 
       docPDF.Page = docPDF.AddPage(); 
       iTextID = docPDF.AddImageToChain(iTextID); 
      } 
     } 

     // Write the PDF file to disk 
     byte[] bytBuffer = docPDF.GetData(); 

     // Cleanup 
     docPDF.Dispose(); 

     using (FileStream fs = File.Create(strFilePath)) 
     { 
      fs.Write(bytBuffer, 0, bytBuffer.Length); 
     } 
    } 
    catch(Exception ex) { 
    // do something with the exception 
    } 
} 
+0

코드와 오류를 알려주십시오. 그렇지 않으면 작업 할 수 없습니다. –

답변

0

자동 설치 ABCPDF를 제거 있었는지 내가 한이 문제를 해결하려면. bin 폴더에서 모든 DLL을 제거했습니다. 그런 다음 찾은 지침에 따라 DLL을 수동으로 설치했습니다. here.

그런 다음 ABC PDF가 정상적으로 작동하기 시작했습니다. ABC PDF .net의 자동 설치가 수동 설치로 인해 문제를 일으키는 것처럼 보입니다.