[AccessD] Printing to file as PDF w/specific path?

MartyConnelly martyconnelly at shaw.ca
Fri May 14 14:55:19 CDT 2004


Ahh, but the method does depend on the driver used and the OS

If you want to do it yourself see methods below, however for $50
you can get PDF And E-Mail  Class Library for Microsoft Access
http://ourworld.compuserve.com/homepages/attac-cg/acgsoft.htm
The Library supports many different PDF drivers so you dont have to
write and test all the drivers and OS registry keys.

 Adobe Acrobat PDF drivers from Adobe Systems
       Supports Acrobat 3, 4, 5 & 6
 Win2PDF and Win2PDF Pro from Dane Prairie Systems
 pdfFactory and pdfFactory Pro from Fine Print Software 
 PDF995 and 995 Tools from Software995
 PDF4U from PDF Bean, Inc.
 Amyuni PDF Creator Amyuni Technologies, Inc.

To do it yourself

For example Assuming you have Acrobat 5 Write installed

Here is method of setting default printer via code
 also this handles pdf files on Win95 and WinNT systems with win.ini files
Reports: Save a report's output as a PDF file*
http://www.mvps.org/access/reports/rpt0011.htm

Here is another method of changing default printer via code
http://www.attcanada.net/~kallal.msn/msaccess/msaccess.html

Here's the detail for coding the intitiation of the report: with Adobe 
PDF Writer Version 5
The registry keys may change for 6.0

1. First thing you need to do is read/understand this article and copy 
the code into your db as a module. This gives you the functions to poke 
& peek the registry. 
<http://support.microsoft.com/support/kb/articles/Q145/6/79.asp>

2. Once you have done step 1, you are in a position to create the 
required registry key and set it with the filename you want to save your 
pdf as. Put this code in a sub or function some where and pass it your 
filename.

Const conRoot = "HKEY_CURRENT_USER"
    Const conPath = "Software\Adobe\Acrobat PDFWriter"
    Const conKey = "PDFFileName"

CreateNewKey conPath & "\" & conKey, HKEY_CURRENT_USER
    SetKeyValue conPath, conKey, "c:\myfolder\myfilename.pdf" , REG_SZ

3. Now when you run your report, it will print to the PDF Writer printer 
driver and will save the results to the file name you have set above.
4 . not sure of this After the PDF Writer creates the file, it deletes 
the registry key for you.

Generally most PDF drivers have some method of setting file name with 
the registry.

Christopher Hawkins wrote:

>I'm not really married to any particular PDF driver, I'm just looking
>for code that will let me use that driver to print to file, and
>specify a path.
>
>-C-
>
>---- Original Message ----
>From: mikedorism at adelphia.net
>To: accessd at databaseadvisors.com, 
>Subject: RE: [AccessD] Printing to file as PDF w/specific path?
>Date: Fri, 14 May 2004 13:43:17 -0400
>
>  
>
>>We use PDF995 on a server to accomplish this but there are lots of 
>>other PDF
>>choices out there.
>>
>>Doris Manning
>>Database Administrator
>>Hargrove Inc.
>>www.hargroveinc.com
>>
>>
>>-----Original Message-----
>>From: accessd-bounces at databaseadvisors.com
>>[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of 
>>Christopher
>>Hawkins
>>Sent: Friday, May 14, 2004 12:43 PM
>>To: accessd at databaseadvisors.com
>>Subject: [AccessD] Printing to file as PDF w/specific path?
>>
>>
>>With the recent thread about manipulatinig printers through code, I 
>>decided
>>tolook into both the Printer API and the newere Printers object.  So 
>>far,
>>I've not figured out how to do what I'm trying to do.
>>
>>My Challenge:
>>
>>Let's say all my invoices for the month of March are ready to go 
>>out, and I
>>want to drop a copy in each client's folder.  Rather than Print 
>>Preview each
>>one in order to save it as a pdf, I'd like to click one button that 
>>will
>>kick off a routine looping through all my client records and print 
>>their
>>invoices out to a pdf file, saving the file at the path stored in the
>>client's record.
>>
>>Now, looping through each client and opening or previewing the 
>>report?
>>Easy.  I can even set the default printer in code, no sweat. The 
>>part I
>>cannot figure out is how to print to a pdf file, and stick my own 
>>path in
>>there.  I looked ad DoCmd.OutputTo at first, but it only works with 
>>the
>>predefined formats Access ships with.
>>
>>Surely I'm not the first guy to need to do this?  Any ideas?
>>
>>-Christopher-
>>
>>
>>    
>>
>
>
>  
>

-- 
Marty Connelly
Victoria, B.C.
Canada






More information about the AccessD mailing list