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

ConvertToWord Method

Convert a PDF document to an Word document.

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




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




BclWdhrError ConvertToWord(BclPDF2Word * pPdf2Word,
                           const wchar_t * InputFileName,
                           const wchar_t * OutputFileName,
                           const wchar_t * Password,
                           int From, int To);
Sub ConvertToWord(InputFileName As String,
                  OutputFileName As String,
                  [Password] As Variant,
                  [From] As Variant,
                  [To] As Variant)
beconv.exe [-password <Password>][-pages <From>-<To>] -i <InputFileName> -o <OutputFileName>




Parameters

InputFileName

Input file name in absolute path format.

OutputFileName

Output Word file name in absolute path format (.docx, .doc, .rtf).

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

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

        oConverter = CreateObject("EasyConverter.PDF2Word.5")
        Call oConverter.ConvertToWord(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 beconv="C:\Program Files\BCL Technologies\easyConverter SDK 5\Rtf\beconv.exe"
%beconv% -i "c:\test\input.pdf" -o "c:\test\output.docx"