dim C
Set C=CreateObject("HTMLConverter.HTMLConverterX")
C.Convert "c:\source.HTML", "c:\dest.JPG", "-cJPG -log c:\html.log"
C.Convert "https://www.coolutils.com/", "c:\URL Page.PDF", "-cPDF -log c:\html.log"
set C = nothing
#include
static const CLSID CLSID_HTMLConverterX =
{0x39A777C6, 0x70A9,0x4D65,{0x84, 0x43, 0x26, 0xC7, 0x7E, 0xAA, 0x0C, 0x92}};
static const IID IID_IHTMLConverterX =
{0x152F4691, 0x8F0B,0x4D96,{0x82, 0x52, 0x2A, 0x68, 0x28, 0xCD, 0xCE, 0xB9}};
#undef INTERFACE
#define INTERFACE IHTMLConverterX
DECLARE_INTERFACE_(IHTMLConverterX, 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 = "HTMLConverter.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_HTMLConverterX, &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;
}
IHTMLConverterX *pIN;
hr = pCF->lpVtbl->CreateInstance (pCF, 0, &IID_IHTMLConverterX, (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.HTML", "test.pdf","-cPDF");
printf ("hr Convert: %d\n", hr);
if (!SUCCEEDED (hr)) {
printf ("Error in Convert.");
return -1;
}
return 0;
}
var c = new ActiveXObject("HTMLConverter.HTMLConverterX");
c.Convert("C:\\test\\source.html", "C:\\test\\dest.pdf", "-c PDF");
if (c.ErrorMessage!="")
alert(c.ErrorMessage)
string src="C:\\test\\Source.HTML";
string dest="C:\\test\\Dest.PDF";
HTMLConverterX Cnv = new HTMLConverterX();
Cnv.Convert(src, dest, "-c PDF -log c:\\test\\HTML.log");
MessageBox.Show("Convert complete!");
$src="C:\test.htm";
$dest="C:\test.pdf";
if (file_exists($dest)) unlink($dest);
$c= new COM("HTMLConverter.HTMLConverterX");
$c->convert($src,$dest, "-c pdf -log c:\html.log");
if (file_exists($dest)) echo "OK"; else echo "fail:".$c->ErrorMessage;
uses Dialogs, Vcl.OleAuto;
var
c: OleVariant;
begin
c:=CreateOleObject('HTMLConverter.HTMLConverterX');
C.Convert('c:\test\source.pas', 'c:\test\dest.pdf', '-cPDF -log c:\test\HTML.log');
IF c.ErrorMessage<> Then
ShowMessage(c.ErrorMessage);
end;
use Win32::OLE;
my $src="C:\\test\\test.html";
my $dest="C:\\test\\test.pdf";
my $c = CreateObject Win32::OLE 'HTMLConverter.HTMLConverterX';
$c->convert($src,$dest, "-c pdf -log c:\\test\\HTML.log");
print $c->ErrorMessage if -e $dest;
import win32com.client
import os.path
c = win32com.client.Dispatch("HTMLConverter.HTMLConverterX")
src="C:\\test\\test.html";
dest="C:\\test\\test.pdf";
c.convert(src, dest, "-c PDF -log c:\\test\\HTML.log");
if not os.path.exists(file_path):
print(c.ErrorMessage)
require 'win32ole'
c = WIN32OLE.new('HTMLConverter.HTMLConverterX')
src="C:\\test\\test.html";
dest="C:\\test\\test.pdf";
c.convert(src,dest, "-c PDF -log c:\\test\\HTML.log");
if not File.exist?(dest)
puts c.ErrorMessage
end