BCL easyConverter SDK HTML
easyConverter SDK Usermanual
PDF-to-HTML Programming API  |  Download Free Trial  |  Contact Us to Purchase

ConvertToHTML Method

Convert a PDF document to an HTML document.

void ConvertToHTML(string InputFileName,
                   string OutputFileName,
                   string Password,
                   int From,
                   int To)
Sub ConvertToHTML(InputFileName As String,
                  OutputFileName As String,
                  Password As String,
                  From As Integer,
                  To As Integer)
def ConvertToHTML(self, strInputFileName, strOutputFileName, strPassword, intFrom, intTo)




void ConvertToHTML(String InputFileName,
                   String OutputFileName,
                   String Password,
                   int From,
                   int To) throws PDF2HTMLException
function ConvertToHTML($strInputFileName, $strOutputFileName, $strPassword, $intFrom, $intTo)




BclHthrError ConvertToHTML(const wchar_t * InputFileName,
                           const wchar_t * OutputFileName,
                           const wchar_t * Password,
                           int From,
                           int To);
Sub ConvertToHTML(InputFileName As String,
                  OutputFileName As String,
                  [Password] As Variant,
                  [From] As Variant,
                  [To] As Variant)
beconvh.exe [-password <Password>][-pages <From>-<To>] -i <InputFileName> -o <OutputFileName>




Parameters

InputFileName

Input file name in absolute path format.

OutputFileName

Output HTML file name in absolute path format.

Password (optional)

Password to open the PDF document, if any.

From (optional)

The starting page number to convert.

To (optional)

The ending page number to convert.

Exception Handling

Please refer to the list of return exceptions.

Example Usage

using BCL.easyConverter.HTML;
...
PDF2HTML pdf2html = new PDF2HTML();
try
{
   pdf2html.ConvertToHTML(@"c:\temp\input.pdf", @"c:\temp\output.html");
}
catch(PDF2HTMLException ex)
{
   Console.WriteLine(ex.Message);
}
finally
{
   pdf2html.Dispose();
}
Imports BCL.easyConverter.HTML
...
Dim pdf2html As New PDF2HTML()
Try
   pdf2html.ConvertToHTML("c:\test\input.pdf", "c:\test\output.html")
Catch ex As PDF2HTMLException
   System.Console.WriteLine(ex.Message)
Finally
   pdf2html.Dispose()
End Try
import PDF2HTML
pdf2html = PDF2HTML.PDF2HTML()
try:
   pdf2html.ConvertToHTML("c:\\test\\input.pdf", "c:\\test\\output.html")
except PDF2HTML.PDF2HTMLException as ex:
   print(ex)
PDF2HTML pdf2html = new PDF2HTML();
try
{
   pdf2html.ConvertToHTML("c:\\temp\\input.pdf", "c:\\temp\\output.html", "", 0, -1);
}
catch(PDF2HTMLException e)
{
   System.out.println(e);
}
finally
{
   pdf2html.dispose();
}
<?php
require("PDF2HTML.php");
$pdf2html = new BCL\easyConverter\HTML\PDF2HTML();
try
{
   $pdf2html->ConvertToHTML("c:\\test\\input.pdf", "c:\\test\\output.html");
}
catch(BCL\easyConverter\HTML\PDF2HTMLException $ex)
{
   echo $ex->getMessage(), "\n";
}
?>
#include <stdio.h>
#include <windows.h>
#include "easyConverterHTML.h"

int main()
{
   HMODULE hPdf2HtmlDll = LoadLibraryW(L"C:\\Program Files\\BCL Technologies\\easyConverter SDK 5\\Html\\easyConverterHTML.dll");
   if(!hPdf2HtmlDll)
   {
      printf("easyConverter could not be loaded.\n");
      return 1;
   }
   else
   {
      BclHthrError error;
      BclPDF2HTML* pPdf2Html = CreatePDF2HTML(hPdf2HtmlDll);
      if(!pPdf2Html)
      {
         printf("easyConverter could not be initialized.\n");
         FreeLibrary(hPdf2HtmlDll);
         return 1;
      }
      error = pPdf2Html->ConvertToHTML(pPdf2Html, L"c:\\test\\input.pdf", L"c:\\test\\output.html", L"", 0, -1);
      if(error)
      {
         printf("Conversion failed with error %d.\n", error);
         FreeLibrary(hPdf2HtmlDll);
         return 1;
      }
      pPdf2Html->Dispose(pPdf2Html);
      FreeLibrary(hPdf2HtmlDll);
      return 0;
   }
}
On Error GoTo Convert_Err

        oConverter = CreateObject("EasyConverter.PDF2HTML.5")
        Call oConverter.ConvertToHTML(inFileName, outFileName)
        MsgBox("Success", vbOKOnly + vbInformation)

Convert_End:

        oConverter = Nothing
        Exit Sub

Convert_Err:

        ' Handle error
         MsgBox("Error(" + CStr(Err.Number) + ")", vbOKOnly + vbInformation)

        Resume Convert_End
set beconvh="C:\Program Files\BCL Technologies\easyConverter SDK 5\Html\beconvh.exe"
%beconvh% -i "c:\test\input.pdf" -o "c:\test\output.html"