读取Pdf文件并转换为html元素

时间:2017-12-28 14:12:49

标签: c# jquery html pdf model-view-controller

我们要求阅读pdf文件,并需要将其转换为html元素(例如,文本,日期字段,文本区等)。是否有可用的插件......或任何其他方法。

1 个答案:

答案 0 :(得分:0)

也许这些信息可以帮助您Convert PDF file to HTML file in C# - Step by Step

<强>的NuGet

PM> Install-Package sautinsoft.pdffocus

示例

string pathToPdf = @"d:\Tempos\table.pdf"; 
string pathToHtml = Path.ChangeExtension(pathToPdf, ".htm"); 

// Convert PDF file to HTML file 
SautinSoft.PdfFocus f = new SautinSoft.PdfFocus(); 
// You may download the latest version of SDK here:  
// www.sautinsoft.com/products/pdf-focus/download.php  


// Let's force the component to store images inside HTML document 
// using base-64 encoding 
f.HtmlOptions.IncludeImageInHtml = true; 
f.HtmlOptions.Title = "Simple text"; 

// This property is necessary only for registered version 


f.OpenPdf(pathToPdf); 

if (f.PageCount > 0) 
{ 
    int result = f.ToHtml(pathToHtml); 

    //Show HTML document in browser 
    if (result == 0) 
    { 
        System.Diagnostics.Process.Start(pathToHtml); 
    } 
}