Using PDF Creator from MS Access
Submitted by jasonbeach on Thu, 2007-12-06 23:54.
I am wanting to output various reports from a MS Access database I have. I can print to the PDFCreator with no problem. My question is, is there a way to print two or more reports to one pdf file? Is the an object model for the pdfCreator class?
Thanks,
Jason
It's been some time that I looked at VBA... doesn't it have an object browser?
Basically, here's what you do:
Declare and instantiate a PDFCreator.clsPDFCreator object.
IN vb.net, this goes like so:
Private WithEvents pdfMaker As New PDFCreator.clsPDFCreatorIf you do not want to consume any events, you can skip the WithEvents clause.
Then, you start it and put the PDFCreator options in a PDFCreatio.cOptions object, like so:
Dim pdfParams As String = "/NoProcessingAtStartup"If Not pdfMaker.cStart(pdfParams) Then
'we have a situation - handle it.
End If
pdfOptions = pdfMaker.cOptions
Then, we change the options we need to change, and inject our changed options object back into our PDFCreator object. An example:
pdfOptions.UseAutosave = 1.AutosaveDirectory = CurrentChannel.SaveToFolder & JobData.User & "\"
.AutosaveFilename = FileName
.AutosaveFormat = 0 '0 = PDF
pdfMaker.cOptions = pdfOptions
Then, we tell our PDFCreator object to suspend printing, like so:
pdfMaker.cPrinterStop = Trueand then we print whatever we want to get into the PDF file to the queue.
Them, we call the cCombineAll method, and we set cPrinterstop to false again.... and hey presto, we get one PDF file.
cheers,
peter