MSAccess reports using VBA and PDFCreator-COM to create PDF?

I’m new to PDFCreator, and I am doubt what path to follow for printing MS-Access Reports using PDFCreator (including merging).

The code is design (with another PDF-creator) to:
1. Get default printer
2. set PDF-printers settings programmatically (filename/path, merging, etc.)
3. change default printer to PDFprinter
4. Print the report, with one line Print Report code (not from inside the report)
5. Reset default printer to the one in step 1

I can see (javascript) code examples using “PrinertQue”, and find it suitable if I print an actual document, BUT I do not see how this can manage printjobs send to “default printer” = The printjob will just executre, without any Queing?

I see two options - maybe none of those are the easy path:

1. Find a way to change PDFCreators default settings programmatically, and use the existing code, with PDFCreator parameters (I found some paramters for defaults - but not any parameter to control Merging).
 - or -
2. Change the code from one line with “PrintReport xxx” to manage the printing from within the Report-code and therebyu get control of this Printerque (a lot of work to code this - there are plenty reports)

Do I misunderstand something… Or don’t see an obvios way to PDF-print Access reports?
I am sooo curious :slight_smile:

…sune, Denmark…

Hi,

while this might not answer all of your questions, it will be the best place to start:
http://docs.pdfforge.org/pdfcreator/2.3/en/pdfcreator/com-interface

for merging, see
http://docs.pdfforge.org/pdfcreator/2.3/en/pdfcreator/com-interface/user-manual/how-to/merge-all-jobs/

best regards

Hello Robin,
How do tou start using the pdfCreator in access though?
DO you use early binding with the references (if so which one should I add because the .tlb does not seem to be working)
or do you use late binding? (which I don’T understand at all (do I simply
dim appPdfCreator as PDFCreator
set appPdfCreator = CreateObject(“PDFCreator.Application”)?)

I am at a real loss here.

Hi,

I think both will work, either referencing the tlb or using late binding with CreateObject(“PDFCreator.JobQueue”)

You can find a Testpage.docm with some macros in PDFCreator\COM Scrips\Word-VBA on your machine.
Here is a copy of the basic example:
Sub testPage2PDF()
Dim fullPath
Dim PDFCreatorQueue As Variant
Dim printJob As Variant

Set PDFCreatorQueue = CreateObject(“PDFCreator.JobQueue”)
fullPath = ActiveDocument.Path & "\TestPage_2Pdf.pdf "

MsgBox “Initializing PDFCreator queue…”
PDFCreatorQueue.Initialize

'Set printer if necessary
Application.ActivePrinter = “PDFCreator”

MsgBox “Printing the current active document…”
ActiveDocument.PrintOut Background:=False

MsgBox “Waiting for the job to arrive at the queue…”
If Not PDFCreatorQueue.WaitForJob(10) Then
MsgBox “The print job did not reach the queue within " & " 10 seconds”
Else
MsgBox “Currently there are " & PDFCreatorQueue.Count & " job(s) in the queue”
MsgBox “Getting job instance”
Set printJob = PDFCreatorQueue.NextJob

printJob.SetProfileByGuid (“DefaultGuid”)

MsgBox “Converting under ““DefaultGuid”” conversion profile”
printJob.ConvertTo (fullPath)

If (Not printJob.IsFinished Or Not printJob.IsSuccessful) Then
MsgBox "Could not convert the file: " & fullPath
Else
MsgBox “Job finished successfully”
End If
End If

MsgBox “Releasing the object”
PDFCreatorQueue.ReleaseCom
End Sub

should this code be working in access because i get the reeor " member of method or data not found.
the reference i added is "pdfcreator.com.tlb
I am at a com^lete loss here thanks for your help

Hi,

yes it should actually work out of the box without making any modification or adding references. Did you try running the macros from the Testpage.docm example located in PDFCreator\COM Scrips\Word-VBA on your machine?

Best regards

Robin

Hi
Im trying to integrate with Access 2016..

I have added the reference to the PDFCreator
The sub exits when it gets to the "PDFCreatorQueue.Initialize"

I can run the Word-VBA code without problems , I tried to put breakpoints in the WordVBA but the code doesn't break??

Suggestions ???