Solved

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

Posted on 2004-10-18
8
1,318 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 50

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
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

752 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