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

 

All of BCL's COM Objects can be accessed from a variety of programming environments. This section shows the basics of COM Objects and how to access them. If you are already familiar with using COM Objects, skip to Sample Code to get started right away.

 

COM Objects in Visual C# and Visual Basic .NET

This example shows how to access a COM Object from Visual C# and Visual Basic .NET.

  1. Create a new project. Click Project -> Add References, and select the BCL EasyConverter 4 HTML Type Library:


  2. Create and user the object.

    Visual C# Code:
     
    BCL.easyConverter4.Interop.HTML.PDF2HTML oConverter = new BCL.easyConverter4.Interop.HTML.PDF2HTML();

    try
    {
         oConverter.ConvertToHTML(inFile, outFile, null, null, null);

    }
    catch(System.Runtime.InteropServices.COMException err)
    {
        // ...
    }

    finally
    {
        oConverter = null;
    }


    Visual Basic .NET Code:
     
    Dim oConverter As BCL.easyConverter4.Interop.HTML.PDF2HTML
    Try
        oConverter = CreateObject("EasyConverter.PDF2HTML.4")
        Call oConverter.ConvertToHTML(inFileName, outFileName)
    Catch ex As System.Runtime.InteropServices.COMException
        ' ...
    End Try


COM Objects in Visual Basic

This example shows how to access a COM Object from Visual Basic.

  1. Create a new project. Click Project -> References, and select the EasyConverter 4 HTML Type Library:


  2. Create and use the object in VB Code:
     
    Sub Convert(inFileName As String, outFileName As String)

        Dim oConverter As EasyConverterHTML.PDF2HTML

        On Error GoTo Convert_Error

        Set oConverter = CreateObject("EasyConverter.PDF2HTML.4")

        Call oConverter.ConvertToHTML(inFileName, outFileName)

        Exit Sub

    Convert_Error:

        ' ...

    End Sub

COM Objects in Visual C++

This example shows how to access a COM Object from Visual C++.

  1. Create a new Visual C++ project.
  2. Import the BCL COM object:
     
    #import "C:\Program Files\BCL Technologies\easyConverter SDK 4\HTML\beconvh.dll"  
  3. Initialize COM library for use by current apartment:
     
    HRESULT hr = CoInitialize(NULL);
    if(FAILED(hr))
    {
        // failed.
        // ...
    }

  4. Create and Use the object:
     
    EasyConverterHTML::IPDF2HTMLPtr pConvObj = NULL;
    try
    {
        pConvObj.CreateInstance ("EasyConverter.PDF2HTML.4")

        pConvObj->ConvertToHTML(lpInFileName, lpOutFileName);
    }
    catch(_com_error &e)
    {
        // ...
    }

  5. Close COM library on the current apartment:
     
    // IMPORTANT:
    // Make sure to free all COM objects before calling
    // CoUninitialize(), or you'll get an exception.

    pConvObj = NULL;
    CoUninitialize();