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

ConvertToExcel Method

Convert a PDF document to an CSV/XML document.

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




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




BclXlhrError ConvertToExcel(const wchar_t * InputFileName,
                            const wchar_t * OutputFileName,
                            const wchar_t * Password,
                            int From,
                            int To);
Sub ConvertToExcel(InputFileName As String,
                   OutputFileName As String,
                   [Password] As Variant,
                   [From] As Variant,
                   [To] As Variant)

Parameters

InputFileName

Input file name in absolute path format.

OutputFileName

Output CSV/XML 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.Excel;
...
PDF2Excel pdf2excel = new PDF2Excel();
try
{
   pdf2excel.ConvertToExcel(@"c:\temp\input.pdf", @"c:\temp\output.csv");
}
catch(PDF2ExcelException ex)
{
   Console.WriteLine(ex.Message);
}
finally
{
   pdf2excel.Dispose();
}
Imports BCL.easyConverter.Excel
...
Dim pdf2excel As New PDF2Excel()
Try
   pdf2excel.ConvertToExcel("c:\test\input.pdf", "c:\test\output.csv")
Catch ex As PDF2ExcelException
   System.Console.WriteLine(ex.Message)
Finally
   pdf2excel.Dispose()
End Try
import PDF2Excel
pdf2excel = PDF2Excel.PDF2Excel()
try:
   pdf2excel.ConvertToExcel("c:\\test\\input.pdf", "c:\\test\\output.csv")
except PDF2Excel.PDF2ExcelException as ex:
   print(ex)
PDF2Excel pdf2excel = new PDF2Excel();
try
{
   pdf2excel.ConvertToExcel("c:\\temp\\input.pdf", "c:\\temp\\output.csv", "", 0, -1);
}
catch(PDF2ExcelException e)
{
   System.out.println(e);
}
finally
{
   pdf2excel.dispose();
}
<?php
require("PDF2Excel.php");
$pdf2excel = new BCL\easyConverter\Excel\PDF2Excel();
try
{
   $pdf2excel->ConvertToExcel("c:\\test\\input.pdf", "c:\\test\\output.csv");
}
catch(BCL\easyConverter\Excel\PDF2ExcelException $ex)
{
   echo $ex->getMessage(), "\n";
}
?>
#include <stdio.h>
#include <windows.h>
#include "easyConverter.h"

int main()
{
   HMODULE hPDF2ExcelDll = LoadLibraryW(L"C:\\Program Files\\BCL Technologies\\easyConverter SDK 5\\Rtf\\easyConverter.dll");
   if(!hPDF2ExcelDll)
   {
      printf("easyConverter could not be loaded.\n");
      return 1;
   }
   else
   {
      BclXlhrError error;
      BclPDF2Excel* pPdf2Excel = CreatePDF2Excel(hPDF2ExcelDll);
      if(!pPdf2Excel)
      {
         printf("easyConverter could not be initialized.\n");
         FreeLibrary(hPDF2ExcelDll);
         return 1;
      }
      error = pPdf2Excel->ConvertToExcel(pPdf2Excel, L"c:\\test\\input.pdf", L"c:\\test\\output.csv", L"", 0, -1);
      if(error)
      {
         printf("Conversion failed with error %d.\n", error);
         FreeLibrary(hPDF2ExcelDll);
         return 1;
      }
      pPdf2Excel->Dispose(pPdf2Excel);
      FreeLibrary(hPDF2ExcelDll);
      return 0;
   }
}
On Error GoTo Convert_Err

        oConverter = CreateObject("EasyConverter.PDF2Excel.5")
        Call oConverter.ConvertToExcel(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