簡體   English   中英

使用Abcpdf將多頁可填充PDF轉換為html表單時出現錯誤

[英]Getting error when converting multipage fillable PDF to html form using Abcpdf

引發的異常是“在WebSupergoo.ABCpdf10.Doc.Save(String path)在GetHtmlFromUploadedPdfDocument(Nullable`1 pageNumber)在.....”。 上載的pdf文件包含條形碼和可填寫的fext字段。

以下是我用來將pdf轉換為html的代碼。

            var filePaths= HttpContext.Current.Server.MapPath("~/PDF//");           
            byte[] bytes = File.ReadAllBytes(filePaths);              
            doc.Read(bytes);
            if (pageNumber > 0)
            {
                doc.PageNumber = pageNumber.Value;
                doc.RemapPages(pageNumber.ToString());
            }
            var pdfFile = "sample";
            var htmlPath = HttpContext.Current.Server.MapPath("~/HTML/" + pdfFile + ".html");
            doc.Encryption.CanChange = false;
            doc.Encryption.CanEdit = false;
            doc.Encryption.CanAssemble = false;
            doc.Encryption.CanExtract = false;
            doc.Encryption.CanFillForms = false;
            doc.Save(htmlPath);
            content = File.ReadAllText(htmlPath);

我知道這是舊帖子。 但是我面臨類似的問題。 我最終解決了它,可能會對其他人有所幫助。

就我而言,保存文件所在的文件夾缺少適當的權限。

請執行以下任務:

  • 右鍵單擊您要保存文件的根文件夾。

  • 選擇屬性。 在屬性部分取消選中只讀。

  • 轉到安全選項卡。 選擇編輯>添加。

  • 在文本框中鍵入“所有人”。 然后檢查名稱>確定。

  • 授予“每個人”讀取,寫入和修改權限。

暫無
暫無

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

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