Supressing the 'Save As...' dialog with Acrobat PDFWriter 5.0
I noticed over on Jason Bock's blog he had been writing a little bit about some PDF development he'd been doing - so I thought it might be appropriate for me to chime in with a little helpful info of my own involving PDF development.
The application I'm currently working on requires using some older technology (VB6/ActiveX/ASP 3.0/ADO). In addition, some of the output needs to be exported into PDF documents. One of the tools we're using (ActiveReports) has native support for exporting to PDF but, the other tool does not. So our solution (rather than buying a 3rd-party PDF component) was to just print the document to the Acrobat PDFWriter printer driver, thus giving us a PDF document.
The only problem is that this application is part of an automated service that processes these documents on a server and it can't require any user interaction. This is a problem because when you print to the Acrobat PDFWriter with Acrobat 5.0, before you can get a PDF file you get this:
Seeing as how I couldn't allow this, I needed a way to programmatically provide the name of the PDF file to the Acrobat PDFWriter printer driver before printing. While this isn't exactly the “Adobe API” way to do it - there is a simple registry hack that solves the problem and works quite smoothly.
Creating a String Value named PDFFileName under the registry key shown in the status bar above, the Acrobat PDFWriter printer driver will use that value (“C:\PDF6.pdf” in the image above) and print to the PDF file without asking for anything from the user. While I wouldn't exactly call this robust, it works. (Be careful though - after the Acrobat PDFWriter printer uses the value, it removes it entirely from the collection of values, so you have to add the value back before each printing). I'm simply using the Registry API (RegCreateKeyEx) from within VB6 to accomplish this.
For those of you developing with Adobe Acrobat Distiller (Version 6.0 of Adobe Acrobat) the “Adobe PDF” printer driver and Distiller have a much more robust and powerful API. The Acrobat PDFWriter printer driver is nowhere to be found as of version 6.0. It's all about Distiller for Adobe going forward.