簡體   English   中英

找不到ABCChrome,WebSupergoo.ABCpdf11.Internal.PDFException

[英]Could not find ABCChrome, WebSupergoo.ABCpdf11.Internal.PDFException

由於某些原因,我無法弄清楚是什么導致了ABCpdf的錯誤。 我們正在從v9升級到v11。 我們嘗試包括dll和只是參考,但似乎都沒有用。

發生錯誤的docPDF.AddImageHtml(strHTML);

我們正在使用Webforms網站和IIS。

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
  }
}

為了解決此問題,我卸載了ABCPDF以進行自動安裝。 從bin文件夾中刪除了所有DLL。 然后,我按照此處找到的說明手動安裝了DLL

然后,ABC PDF開始正常工作。 好像自動安裝ABC PDF .net導致手動安裝出現問題。

我收到錯誤消息Unable to start ABCChrome engine

在我的情況下, ABCPdf是通過nuget軟件包管理器添加的 ,而不是直接安裝在目標服務器上。

我的解決方案是停止服務,進入任務管理器並殺死ABCPdf進程,然后重新啟動服務。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM