Winnovative PDF to HTML Converter for .NET 7.1 Retail
Winnovative PDF to HTML Converter for .NET 7.1 Retail
Winnovative PDF to HTML Converter can be used in any type of .NET application to convert PDF pages to HTML documents. The integration with existing .NET applications is extremely easy and no installation is necessary. The downloaded archive contains the assembly for .NET and a demo application. The full C# source code for the demo application is available in the Samples folder. The converter produces HTML string objects during conversion that you can save to HTML files or use for further processing. You can also customize the resulted HTML content zoom level and HTML images resolution.
Features
Convert PDF pages to HTML documents
Customize the generated HTML content zoom level
Customize the HTML images resolution in generated HTML document
Convert PDF pages to HTML documents in memory or to HTML files in a folder
Support for password protected PDF documents
Convert to HTML only a range of PDF pages
Get the number of pages in a PDF document
Get the PDF document title, keywords, author and description
Does not require Adobe Reader or other third party tools
Support for .NET 4.0 framework and later
Documentation and C# samples for all the features
Code Sample for PDF to HTML Conversion
The code below was taken from the PDF to HTML Converter demo application available for download in the PDF to HTML converter archive. In this sample an instance of the PdfToHtmlConverter class is constructed and used to convert the PDF document pages to HTML documents.
private void btnConvertToHtml_Click(object sender, EventArgs e)
{
if (pdfFileTextBox.Text.Trim().Equals(String.Empty))
{
MessageBox.Show("Please choose a source PDF file", "Choose PDF file", MessageBoxButtons.OK);
return;
}
// the source pdf file
string pdfFileName = pdfFileTextBox.Text.Trim();
// start page number
int startPageNumber = int.Parse(textBoxStartPage.Text.Trim());
// end page number
// when it is 0 the conversion will continue up to the end of document
int endPageNumber = 0;
if (textBoxEndPage.Text.Trim() != String.Empty)
endPageNumber = int.Parse(textBoxEndPage.Text.Trim());
// create the converter object and set the user options
PdfToHtmlConverter pdfToHtmlConverter = new PdfToHtmlConverter();
pdfToHtmlConverter.LicenseKey = "UtzN3cnM3c3dy9PN3c7M08zP08TExMTdzQ==";
// set the resolution of HTML images
pdfToHtmlConverter.Resolution = int.Parse(textBoxResolution.Text);
// set the zoom of HTML content
pdfToHtmlConverter.Zoom = int.Parse(textBoxZoom.Text);
// the demo output directory
string outputDirectory = Path.Combine(Application.StartupPath, @"DemoFiles\Output");
Cursor = Cursors.WaitCursor;
try
{
// convert PDF pages to HTML files in a directory
pdfToHtmlConverter.CreateIndexFile = true;
pdfToHtmlConverter.ConvertPdfPagesToHtmlFile(pdfFileName, startPageNumber, endPageNumber, outputDirectory, "PdfPage");
// uncomment the lines below to raise the PageConvertedEvent event when a PDF page is converted
// the pdfToHtmlConverter_PageConvertedEvent handler below will be executed for each converted PDF page
// Do not forget to uninstall the handler when is not needed anymore
//pdfToHtmlConverter.PageConvertedEvent += pdfToHtmlConverter_PageConvertedEvent;
//pdfToHtmlConverter.ConvertPdfPagesToHtmlInEvent(pdfFileName, startPageNumber, endPageNumber);
// uncomment the line below to convert PDF pages in memory to an array of PdfPageHtml objects
//PdfPageHtml[] pdfPageHtmls = pdfToHtmlConverter.ConvertPdfPagesToHtml(pdfFileName, startPageNumber, endPageNumber);
}
catch (Exception ex)
{
// The conversion failed
MessageBox.Show(String.Format("An error occurred. {0}", ex.Message), "Error");
return;
}
finally
{
Cursor = Cursors.Arrow;
}
try
{
System.Diagnostics.Process.Start(outputDirectory);
}
catch (Exception ex)
{
MessageBox.Show(string.Format("Cannot open output folder. {0}", ex.Message));
return;
}
}
/// <summary>
/// The PageConvertedEvent event handler called after when a PDF page was converted to HTML
/// The event is raised when the ConvertPdfPagesToHtmlInEvent() method is used
/// </summary>
/// <param name="args">The handler argument containing the PDF page HTML and page number</param>
void pdfToHtmlConverter_PageConvertedEvent(PageConvertedEventArgs args)
{
// get the HTML document and page number from even handler argument
string pdfPageHtml = args.PdfPageHtml.Html;
int pageNumber = args.PdfPageHtml.PageNumber;
// save the PDF page HTML to a file
string outputHtmlFile = Path.Combine(Application.StartupPath, @"DemoFiles\Output", "PdfPage_" + pageNumber + ".html");
File.WriteAllText(outputHtmlFile, pdfPageHtml, Encoding.UTF8);
args.PdfPageHtml.Dispose();
}
Only for V.I.P
Warning! You are not allowed to view this text.