note 36289 deleted from ref.com by cmb
| From: | cmb@php.net | Date: | Sun, 30 Jun 2019 07:50:18 +0000 |
| Subject: | note 36289 deleted from ref.com by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-211419@lists.php.net to get a copy of this message | ||
Note Submitter:
----
Convert Microsoft word document .DOC to adobe acrobat .PS or .PDF files:
Drawback: if any dialog boxes pop up, the conversion will become non-automated.
<?php
// You must have word and adobe acrobat distiller on
// your system, although theoretically any printer driver
// that makes .PS files would work.
// starting word
$word = new COM("word.application") or die("Unable to instanciate Word");
print "Loaded Word, version {$word->Version}\n";
// bring it to front
$word->Visible = 1;
// Select the acrobat distiller as the active printer.
// I presume that you could also use the Acrobat PDF writer // driver that comes with Acrobat full
version.
$word->ActivePrinter = "Acrobat Distiller";
// Open a word document, or anything else that word
// can read
$word->Documents->Open($input);
// This will create a .PS file called $output
$word->ActiveDocument->PrintOut(0, 0, 0, $output);
// If you need a .pdf instead, use the acrobat
// distiller's watched folder option.
// closing word
$word->Quit();
// free the object
$word->Release();
$word = null;
?>