Links for resources on PDF Tools
Access 2007 Has PDF support built in thru a Microsoft Add-In
Download the 2007 PDF driver from here
(first you have to install some version validation software from Microsoft)
http://www.microsoft.com/downloads/details.aspx?FamilyId=4D951911-3E7E-4AE6-B059-A2E79ED87041&displaylang=en
Once
installed, here is the vba code to export to PDF
DoCmd.OutputTo
acOutputReport, "All Open Projects", _
"PDFFormat(*.pdf)", "c:\afile.pdf", False, "", 0, acExportQualityPrint
Once installed, here is the code to
convert to PDF and email someone the file. Pretty simple really
DoCmd.SendObject acReport,
"All Open Projects", _
"PDFFormat(*.pdf)", "BlaBlaBla@blablabla.com", "", "", "subject line", "bla
bla ", True, ""
Download and read more on save as PDF in Office 2007
Older Versions Of Access
Read our review of Nitro Pro PDF
Our readers gave us some other ideas on PDF tools after the
following article at vb123.com (in no particular order)
Save Reports As PDF
Files From Access
1) On the subject of creating PDFs, there's a totally free alternative
- have a look at
http://zipguy.012webpages.com/freepdf.htm
for more info. It's a little more complex to get installed - you need to install
RedMon, GhostScript and FreePDF....but hey, it's free.
Just installed the FreePDF pgm after a tip-off
in WAW. After a bit of a fiddly install, it works very well. You obviously have
Acrobat, but for programmers like me, this allows me to create
PDF files from
any Office app .. Word, Access etc. Just print to the relevant printer, one more
click, and Voila - PDF!
1a) Another free PDF writer to add to to this page is the freeware and
opensource PDFCreator from
http://sourceforge.net/projects/pdfcreator
It's much easier to install than FreePDF, and installs as a virtual printer,
allowing you to create PDFs from any application.
Note that the latest version (0.9) has a few minor issues with the installation,
but the 0.8 betas also work fine. "from Martin"
2) Here is a company that supplies a "Software Developers Toolkit" for
creating royalty free PDF files. We have embedded their function calls into our
Access products so that any of our reports can be "printed" or sent as PDF
files. It works extremely well. They also supply various tools for PDF
manipulation. All you pay for is the toolkit rather than a fee for each
workstation.
http://www.docu-track.com/
3) "I was just scrounging around your site and noticed the page
on using Adobe Distiller to generate PDFs
As I am cheap, I use Win2PDF to do the same thing. www.win2pdf.com
I think it was about $20.00. Might be worth your readers taking a look at.
4) And yet another low cost alternative
http://www.pdf995.com/
Sarah writes. I can expand on the PDF995 entry (no. 4)
There is a free version but a) you get popups which you wouldn't want to inflict
on a client and b) it won't run silently
The paid version costs under £10 per seat
"How can I set up PDF995 as a shared network printer?"
http://www.pdf995.com/faq.html
Code to make it run silently (must be installed on each pc)
http://www.freeware995.com/misc/vbacode.txt
Had a few hiccups over write permissions to the PDF shared folder but otherwise
works a treat considering the price!
5)
May I direct you to another
piece of PDF software, 100% free and very easy to install: it involves two
files, one of which is an installation wizard. The end result is a virtual PDF
printer that can be used anywhere in the Windows environment. The program is
called CutePDF and is pretty basic - you don't get all the options you find in
Acrobat, but you do get a good PDF document.
Kind regards, Gabriel
http://www.cutepdf.com/
6) I came across your recommendations for
printing to pdf and thought I'd make one more suggestion....
I use a relatively inexpensive yet very robust program called docuPrinter Pro
from www.neevia.com.
It is not only fast and cooperates well with other programs, but has a lots of
options (watermark, background, security) and can even be used as an ActiveX
control....
A Simple example:
Set dp = CreateObject("docuPrinter.SDK")
Dim defprinter
defprinter = dp.GetDefaultPrinter
dp.SetDefaultPrinter ("docuPrinter")
dp.ApplySettings
Set dp = CreateObject("docuPrinter.SDK")
dp.HideSaveAsWindow = True
dp.DocumentOutputFolder = Me.txtFolder
dp.DocumentOutputFormat = "PDF"
sFileName = Trim(oSet(Me.SourceForFilenames).Value & "")
sFileName = Util.FileNameFixer(sFileName) '
removes invalid filename characters
If sFileName = "" Then sFileName = "NoName"
dp.DocumentOutputName = sFileName
dp.ViewDocumentAfterConversion = False
dp.ApplySettings
DoCmd.OpenReport Me.cboReports.Value
dp.Create
dp.SetDefaultPrinter (defprinter)
dp.HideSaveAsWindow = False
dp.ApplySettings
MsgBox "Finished"
Shell "explorer """ & Me.txtFolder & """", vbMaximizedFocus
And a more complicated example (which hopefully works as I removed stuff for
this example)
Sub Print2PDF(sReportName As String,
sPDFFileName As String, Optional bDeleteAnyExistingFileFirst As Boolean,
Optional sFormOverlayPathFileName As String, Optional sWhere As String, Optional
bPrintPreview As Boolean, Optional bOpenPDFWhenDone As Boolean)
Dim sFileName As String, nFileLen As Long
If Not Util.Exists("Report", sReportName) Then
MsgBox "Unable to find report: " & sReportName
Exit Sub
End If
If IsEmpty2(sPDFFileName) Then
MsgBox "expecting Print2PDF() to give a PDF Filename other than blank, using
Test"
sPDFFileName = "Test"
End If
sFileName = "C:\" & sPDFFileName & ".pdf"
If File(sFileName) Then
Kill sFileName
DoEvents
If File(sFileName) Then
MsgBox "Please close the file: " & sFileName
Kill sFileName
DoEvents
End If
End If
'Dim dp as Object ' does not require
pre-registration, but you loose auto-complete functionality
Dim dp As docuprinter.SDK ' optional - allows
autocomplete, however requires pre-registration of the docuprint.dll
Set dp = CreateObject("docuPrinter.SDK")
dp.HideSaveAsWindow = True
dp.DocumentOutputFolder = "C:\"
dp.DocumentOutputFormat = "PDF"
dp.DocumentOutputName = sPDFFileName
dp.ViewDocumentAfterConversion = bOpenPDFWhenDone
dp.DefaultAction = 2
' background/watermark (tax form)
If Not IsEmpty2(sFormOverlayPathFileName) Then
If File(GL.gsTDir(True) & sFormOverlayPathFileName) Then
dp.StationeryFile = GL.gsTDir(True) & sFormOverlayPathFileName
dp.StationeryPages = "0"
Else
dp.StationeryPages = ""
End If
Else
dp.StationeryPages = ""
End If
dp.ApplySettings
On Error Resume Next
Dim nPreview As Long
If bPrintPreview Then
nPreview = A_PREVIEW
nPreview = acViewPreview
Else
nPreview = A_NORMAL
nPreview = acViewNormal
End If
If Trim(sWhere) = "" Then
DoCmd.OpenReport sReportName, nPreview
Else
DoCmd.OpenReport sReportName, nPreview, , sWhere
End If
If Err.Number <> 0 And Err.Number <> 2501 Then ' 2501 when there is no data to
print and the report closed itself
MsgBox "Unable to open the report named: " & sReportName & " ERROR " &
Err.Number & " occurred:" & Err.Description
Exit Sub
End If
On Error Resume Next
If bPrintPreview Then
If Screen.ActiveReport.NAME = sReportName Then
If Err.Number <> 0 Then Exit Sub 'the report is already closed
DoEvents
If vbYes = MsgBox("Send this report to the printer now?", 4 + 32, "Print or
Preview") Then
AppActivate "MyProgram" 'in case LotusNotes
changed focus
SendKeys "%FP{Enter}", True
End If
End If
Else
DoEvents
If Util.IsOpen(acReport, sReportName) Then
DoCmd.Close acReport, sReportName, acSaveNo
End If
End If
dp.Create
End Sub
Kevin
7) l noticed, that you have not mentioned the
recent update / release from Stephen Lebans, about creating PDF's The details
can be found at the page
http://www.lebans.com/reporttopdf.htm
My one of the challenges for one of my
applications, is to produce PDF's but often large numbers of them at a time. My
users will printed anywhere from 1 to 100 reports at a one sitting. Each report
consists of 1 or max of 2 pages. Each one refers to a room within a building,
when they are produced they each need a unique name (let the nightmare begin !)
I resolved that issue, so that each report has its own individual name.
However actually producing the PDF was another story, distiller was not even in
the picture my company already has a PDF printer driver installed, which does
not seem to have a programmatic interface :-( So l had to find another way,
which l did using Ghostscript and a little bit of VB to press a button (this was
a year ago, before l saw the your latest tip). However this was cumbersome, and
not ideal, the code for it was not the best. When saw the page on Stephen Lebans
site (via a note on UtterAccess) l could not believe my eyes. All l can say is
it works, and very well, meaning l no longer have to install GhostScript on the
clients machine or mess around with virtual printer drivers etc.
His method might not suit everyone, but its ideal my application, and has given
me much, much, much fewer support issues. Just means my users now want other
funky features, typical architects ;-) Robert
8) FreePDF XP
Hi Garry
We use and recommend this free tool, FreePDF XP, very nice:
http://freepdfxp.de/fpxp.htm
It's in German but the manual (e) is in English an language can be selected to
English. It uses Ghostscript as well.
/gustav
Other Pages
Read our review
of Nitro Pro PDF
Backing Up Your
Access Data With XML
Building A Smart Access eBook
Click on the
button for the next links page.