COM in PHP : Help on the script

2006-08-13 17:30:48 by zagrad

Hi,

Could someone help me to get this to work in PHP?
I currently have the following script:


$PDFC = New COM("PDFCreator.clsPDFCreator");

$PDFC->cStart("/NoStart");

$PDFC->cOptions['UseAutoSave'] = 1;
$PDFC->cOptions["UseAutosaveDirectory"] = 1;
$PDFC->cOptions["AutosaveFormat"] = 0; //0 = PDF format
$DefaultPrinter = $PDFC->cDefaultprinter;
$PDFC->cDefaultprinter = "PDFCreator";
$PDFC->cClearCache();

$PDFC->cOptions['AutosaveFilename'] = "PHP_test.pdf";
$PDFC->cOptions['AutosaveDirectory'] = "D:\\HomeFTP\\";

$file = "D:\\HomeFTP\\mReport.html";

if (!$PDFC->cIsPrintable($file)){
die('Not printable');
}

$PDFC->cPrintfile($file);
$PDFC->cPrinterStop = false;

$PDFC->cDefaultprinter = $DefaultPrinter;
$PDFC->cClearcache();

unset($PDFC);

echo "end";
?>

But simply the script prints "end" and nothing more. Someone knows what I do wrong?

Gr,
Paul


2006-08-13 17:32:34 by zagrad

The script above missed some lines in the beginning:

$PDFC = New COM("PDFCreator.clsPDFCreator");
com_load_typelib("PDFCreator.clsPDFCreator");

$PDFC->cStart("/NoStart");