note 36289 added to ref.com
| From: | php-general at lists dot php dot net | Date: | Fri, 03 Oct 2003 16:55:48 +0000 |
| Subject: | note 36289 added to ref.com | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-57772@lists.php.net to get a copy of this message | ||
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.
<?
// 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;
?>
----
Manual Page -- http://www.php.net/manual/en/ref.com.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+36289
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+36289&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+36289&report=yes