note 36289 modified in ref.com by danbrown

From: Date: Mon, 21 Dec 2009 17:14:21 +0000
Subject: note 36289 modified in ref.com by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-164227@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. <?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; ?> --was-- 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; ?> http://php.net/manual/en/ref.com.php

« previous php.notes (#164227) next »