Solved

Printing MS-Access-Report to PDF without Save-As-Dialogbox

Posted on 2004-10-18
8
1,309 Views
Last Modified: 2013-12-02
Although this theme has already been discussed I have still no soution found for my problem.
I use WindowsXP with SP2, MS Office Prof 2000 and have installed Acrobat 6.0 Prof. (full version). Now I want to print the report from my Access-application to the PDF-Writer. Therefore I entered in the Registry the key which holds the desired filename and another key with the bDocInfo containing a zero. But every time I want to print the report will be generated but I am asked for the filename. In the meantime I did visit a lot of interesting internet pages but without success. It seems that Adobe has made serious changes in his PDF-Writer so the examples I found are now no more working.

The code is as follows:
    'Save current default printer
    sMyDefPrinter = bGetRegValue(HKEY_CURRENT_USER, "Software\Microsoft\WIndows NT\CurrentVersion\Windows", "Device")
   
    ' Set default printer to PDF Writer
    bSetRegValue HKEY_CURRENT_USER, "Software\Microsoft\Windows NT\CurrentVersion\Windows", "Device", "Adobe PDF"

    'Setting value for PDFFileName in the registry stops file dialog box from appearing
    bSetRegValue HKEY_CURRENT_USER, "Software\Adobe\Adobe PDF", "PDFFileName", sPDFPath + sPDFName
    bSetRegValue HKEY_CURRENT_USER, "Software\Adobe\Adobe PDF", "bDocInfo", 0

    DoCmd.OpenReport rptName, acViewNormal

    ' Restore default printer
    bSetRegValue HKEY_CURRENT_USER, "Software\Microsoft\WIndows NT\CurrentVersion\Windows", "Device", sMyDefPrinter

While running the program the entries in the registry are be done, printer switches to Adobe but the File Save Dialog Box still appears!

Any suggestions? Any help?
Thanks a lot for your comments.
Traindog

0
Comment
Question by:Traindog
8 Comments
 
LVL 27

Expert Comment

by:jjafferr
ID: 12342262
Hi Traindog,

Have a look here:
http://www.experts-exchange.com/Databases/MS_Access/Q_21078898.html

I hope this helps,

jaffer
0
 
LVL 41

Expert Comment

by:shanesuebsahakarn
ID: 12342593
You should be able to alter the properties of the PDF printer to bypass the save dialog (open the printer and go Printer->Properties), but this is another reason I no longer use Acrobat.
0
 
LVL 49

Accepted Solution

by:
Gustav Brock earned 84 total points
ID: 12345665
If you don't insist on using Adobe, you may wish to study FreePDF:

  http://freepdfxp.de/fpxp.htm

It is totally free and uses Ghostscript and the Apple Postscript driver.
Be sure to download the "Administration Manual" as well as the sources (some basic code samples) and perhaps even the multidocument option.

/gustav
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 27

Assisted Solution

by:jjafferr
jjafferr earned 83 total points
ID: 12392682


Here is a neat trick from
http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_20381304.html

What is happening here is:
1- You print your Report to Ms Word, here is an example on how to do that:
http://www.experts-exchange.com/Databases/MS_Access/Q_21023384.html

2- then print to pdf from Word.


reference ms word object library and acrobat distiller under project/references:

Dim obj As New Word.Application
Dim objDistiller As New ACRODISTXLib.PdfDistiller

obj.Documents.Open "C:\my documents\Test.doc"
obj.ActivePrinter = "Acrobat Distiller"
obj.PrintOut False, False, False, "C:\windows\desktop\Test.ps", , , , , , , True
obj.Quit False
Set obj = Nothing

objDistiller.FileToPDF "C:\windows\desktop\Test.ps", "c:\windows\desktop\Test.pdf", ""
Set objDistiller = Nothing



jaffer
0
 
LVL 44

Assisted Solution

by:Karl Heinz Kremer
Karl Heinz Kremer earned 83 total points
ID: 12392744
0
 
LVL 27

Expert Comment

by:jjafferr
ID: 12392869
khkremer, thanks for accepting my request to help here, much appreciated.

I have 2 suggestion:
1- Although EVERYBODy hates SendKeys, but it might get the job done here,
So when the Save dialog comes up, we Sendkey with the file Name and path, then sendkey for Carriage Return:

strAttach = "\\Torrdata\Manufacturing\RMR_Data\RMRs\RMR" & Me.RMRNum & ".pdf"
DoCmd.OpenReport "rptRMR", acnormal
SendKeys strAttach, False
SendKeys "{Enter}", False

2- Some good discussion and solutions too:
http://www.tek-tips.com/faqs.cfm?fid=1635
http://www.tek-tips.com/viewthread.cfm?qid=816439

jaffer
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

PaperPort (http://www.nuance.com/for-individuals/by-product/paperport/index.htm) is among the most important applications that I run on my Windows computers. I use it every day, for nearly all of my document and photo scanning, as well as most of my…
Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
We often encounter PDF files that are pure images, that is, they do not have text characters, but instead contain only raster graphics. The most common causes of this are document scanning software and faxing software/services that create image-only…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now