Results 1 to 5 of 5

Thread: Article: Printing Access Reports To A PDF File

  1. #1
    Administrator Ken Puls's Avatar
    Join Date
    Mar 2011
    Location
    Nanaimo, BC, Canada
    Posts
    2,027
    Articles
    79
    Blog Entries
    14

    Article: Printing Access Reports To A PDF File



    Register for a FREE account, and/
    or Log in to avoid these ads!

    Ken Puls, FCPA, FCMA, MS MVP (Excel)

    Master your data with Power Query: Purchase your copy of my book M is for Data Monkey today!

    Main Site: http://www.excelguru.ca -||- Blog: http://www.excelguru.ca/blog -||- Forums: http://www.excelguru.ca/forums
    Check out the Excelguru Facebook Fan Page -||- Follow Me on Twitter

    If you've been given VBA code (a macro) for your solution, but don't know where to put it, CLICK HERE.

  2. #2
    Just wanted to say thanks for this piece of code. I have a modified version of this working with Access 10 on Windows 7, PDFCreator 1.2.2. It has really saved our bacon workwise this year. Thanks.

  3. #3
    Hi,Have tried running the exact code, but keep getting "fail to initialize error". running pdfcreator 1.6.2 and windows 7 access 2010. Never had problems in the past, but now not getting it to work. Any suggestions are appreciated.Thanks Eric

  4. #4
    Quote Originally Posted by EricMooiweer View Post
    Hi,Have tried running the exact code, but keep getting "fail to initialize error". running pdfcreator 1.6.2 and windows 7 access 2010. Never had problems in the past, but now not getting it to work. Any suggestions are appreciated.Thanks Eric
    . I am progressing slightly. Latest is that the access report opens, yet it stays in the Do Until pdfjob.cCountOfPrintjobs = 1
    DoEvents
    Loop endlessly. Any suggestions? it does not seem to add the printerjob to the printingqueu. What am I doing wrong? Suggestions are much appreciated. Thanks for your time, Eric

  5. #5

    How to set color printing instead of grey scale?

    Hello all,
    I've modified the code because I need as output not a pdf file but a png file. It works but the image is in greyscale, how should I modify the code in order to get colors?
    Many thanks.

    Code:
    SetMyPdfToJPEG()
    
    
        Dim pdfjob As PDFCreator.clsPDFCreator
        Dim sPDFName As String
        Dim sPDFPath As String
        Dim sPrinterName As String
        Dim sReportName As String
        Dim lPrinters As Long
        Dim lPrinterCurrent As Long
        Dim lPrinterPDF As Long
        Dim prtDefault As Printer
    
    
        Dim sReportName1 As String
        '/// Change the report and output file name here! ///
        sReportName = "ST" 'scheda tecnica
        sReportName1 = "ST_1" 'scheda tecnica1
        sPDFName = sReportName & Format(Date, "yyyymmdd") & ".png"
        sPDFPath = Environ$("Userprofile") & "\Desktop\"  '& sPDFName & "_copy"
        
    Set pdfjob = New PDFCreator.clsPDFCreator
        
        With pdfjob
            If .cStart("/NoProcessingAtStartup") = False Then
                MsgBox "Can't initialize PDFCreator.", vbCritical + _
                        vbOKOnly, "PrtPDFCreator"
                Exit Sub
            End If
            
            .cOption("UseAutosave") = 1
            .cOption("UseAutosaveDirectory") = 1
            .cOption("AutosaveDirectory") = sPDFPath
            .cOption("AutosaveFilename") = sPDFName
            .cOption("AutosaveFormat") = 1    ' 0 = PDF  1=PNG , 2= JPEG
            .cClearCache
        End With
        
        DoCmd.PrintOut acSelection, , , acHigh, 1, True
        
        
         'waiting for printing completion
        Do Until pdfjob.cCountOfPrintjobs = 1
            DoEvents
        Loop
        pdfjob.cPrinterStop = False
    
    
        'waiting routine completion
        Do Until pdfjob.cCountOfPrintjobs = 0
            DoEvents
        Loop
        pdfjob.cClose
        Set pdfjob = Nothing

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •