New Forum | Previous | Next | (P-PDF) Developers
Topic: Automating Distiller and PDFWriter [was: Save As Dialog Box with
Conf: (P-PDF) Developers, Msg: 51885
Date: 5/29/2002 04:48 PM
Take a look at the PDFWriter API Reference Manual from the Acrobat
_Developer Support Web Page. It documents all of the available
methods for programmatically controlling PDFWriter. The Acrobat
Distiller API Reference documents the methods for controlling Acrobat
Your main problem in doing this is that PDFWriter is a printer
driver. As such the APIs it can make available are limited.
Applications printing to PDFWriter have all the control they need
using the DOCINFO/DEVMODE structs and the printer escapes documented
in the above technotes but if you are using OLE to control Word (or
some other application) you do not have access to either this struct
or the Device Context needed to use the printer escapes. The registry
and .ini file entries are sort of a backdoor to help out in these
situations. They work in some situations but do not amount to a
The main issue is that PDFWriter initially reads the registry when a
Device Context for it is acquired. If PDFWriter is the default
printer, some applications will acquire a DC at some point before
printing. This means that changes you make to the .ini or registry
after that will not affect the first print job. There can be other
synchronization issues if you are driving an application via OLE to
print to PDFWriter and modifying the registry each time to specify
the output filename. Although it has been difficult to reproduce
there have been multiple reports of PDFWriter popping a dialog in the
middle of batch processing.
In general this means that using the registry/.ini file to control
PDFWriter works reasonably well for single or small batch print jobs
but is not recommended as a commercial grade large batch printing
solution, although in some environments it may work fine.
Another option is to use Distiller. Distiller supports an OLE
automation interface as well as Windows Messages and a command line
interface. Distiller works well for batch creation of PDF files as
long as you already have a PostScript File.
One way to get a PostScript file is to set up a new port as described here:
Once you have the port set up, use the AdobePS5.x setup utility to
create a new PostScript printer using the Distiller PPD file from:
Acrobat4.0\Distillr\Xtras. Specify the port you set up above as the
port. Now every time you print to that printer, you will know exactly
where the PostScript file is as well as the name. You could simply
use a command line like:
acrodist /0 excel_cell.pdf out.ps
Or use one of the other interfaces to do something fancier.
>------ AcroBuddies Forum | http://www.acrobuddies.com ------
>I am currently working on a VB6 project where I am populating a Word
>template with data from a SQL Server database.
>When the data has been merged into the Word template it needs to be
>saved as a PDF so that it cannot be edited by users.
>I have found a way of disabling the PDFWriter's Save As dialog box
>by editing the PDF.INI files in the relevant NT system
>directory.(Courtesy of Jim Osieczonek article on 9/9/99 and the link
>to Adobe's support page)
>My problem is that I need to specify a filename to save the PDF. The
>Adobe support article states that only one specific file name can be
>used in the INI file and that unless the PDF file is renamed it will
>get overwritten. There must be a way to dynamically pass in a file
>name to PDFWriter without using the Save As dialog box. Someone
>Does the Adobe Distiller driver do what I want ?
>Jago Managing Agency Limited
>------ Powered by www.BinaryThing.com & www.PlanetPDF.com ---------
> Learn more about PDF from world-class experts:
> PDF 2000 Conference, June 5-7, Scottsdale, Arizona