CoolUtils Logo
German  Italian  Dutch  Spanish  Korean  Russian

Convert PDF Files On Web Servers With Total PDF ConverterX

FREE DOWNLOAD
Buy Total PDF Converter X NOW!
(only $159.90)
Example C++:
#include 

static const CLSID CLSID_PDFConverterX =
  {0x6B411E7E, 0x9503,0x4793,{0xA2, 0x87, 0x1F, 0x3B, 0xA8, 0x78, 0xB9, 0x1C}};
static const IID IID_IPDFConverterX =
  {0xEF633BED, 0xC414,0x49B0,{0x91, 0xFB, 0xC3, 0x9C, 0x3F, 0xE0, 0x08, 0x0D}};

#undef INTERFACE
#define INTERFACE IPDFConverterX
DECLARE_INTERFACE_(IPDFConverterX, IDispatch)
{
    STDMETHOD(QueryInterface)(THIS_ REFIID, PVOID*) PURE;
    STDMETHOD(Convert)(THIS_ LPCTSTR, LPCTSTR, LPCTSTR) PURE;
    STDMETHOD(About)(THIS) PURE;
    //const SourceFile: WideString; const DestFile: WideString; const Params: WideString; safecall;
};

typedef HRESULT (__stdcall *hDllGetClassObjectFunc) (REFCLSID, REFIID, void **);

int main () {
  HRESULT hr;
  if (CoInitialize(NULL)) {
    printf ("Error in CoInitialize.");
    return -1;
  }

  LPCTSTR lpFileName = "PDFConverter.dll";
  HMODULE hModule;
  hModule = LoadLibrary (lpFileName);
  printf ("hModule: %d\n", hModule);
  if (hModule == 0) {
    printf ("Error in LoadLibrary.");
    return -1;
  }

  hDllGetClassObjectFunc hDllGetClassObject = NULL;
  hDllGetClassObject = (hDllGetClassObjectFunc) GetProcAddress (hModule, "DllGetClassObject");
  if (hDllGetClassObject == 0) {
    printf ("Error in GetProcAddress.");
    return -1;
  }
  IClassFactory *pCF = NULL;
  hr = hDllGetClassObject (&CLSID_PDFConverterX, &IID_IClassFactory, (void **)&pCF);
  /* Can't load with different ID */
  printf ("hr hDllGetClassObject: %d\n", hr);
  if (!SUCCEEDED (hr)) {
    printf ("Error in hDllGetClassObject.");
    return -1;
  }
  IPDFConverterX *pIN;
  hr = pCF->lpVtbl->CreateInstance (pCF, 0, &IID_IPDFConverterX, (void **)&pIN);
  printf ("hr CreateInstance: %d\n", hr);
  if (!SUCCEEDED (hr)) {
    printf ("Error in hDllGetClassObject.");
    return -1;
  }
  hr = pCF->lpVtbl->Release (pCF);
  printf ("hr Release: %d\n", hr);
  if (!SUCCEEDED (hr)) {
    printf ("Error in Release.");
    return -1;
  }
  hr = pIN->lpVtbl->About (pIN);
  printf ("hr About: %d\n", hr);
  if (!SUCCEEDED (hr)) {
    printf ("Error in About.");
    return -1;
  }
  hr = pIN->lpVtbl->Convert (pIN, "test.pdf", "test.html","-cHTML");
  printf ("hr Convert: %d\n", hr);
  if (!SUCCEEDED (hr)) {
    printf ("Error in Convert.");
    return -1;
  }

  return 0;
}

If you need examples on other languages please contact us. We will create any example specially for you.

Note that ActiveX is 32-bit only. If you are trying to use activeX under 64-bit internet information server (IIS) activeX will not work. Use command line version instead (it works with both 32- and 64-bit servers).

More examples

Back to Total PDF Converter X Home

Buy Total PDF Converter X NOW!
    FREE DOWNLOAD  
(only $159.90)
   Updated Tue, 15 Aug 2017
Total PDF Converter X Preview1Total PDF Converter X Preview2Total PDF Converter X Preview3



Site Map  |  Contacts |  Press Center | Resellers | About |  Privacy Policy |    Copyright © 1998-2017 CoolUtils Development. All rights reserved.   GPlus