Results 1 to 3 of 3
  1. #1
    mcpearce is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Apr 2014
    Location
    Perth
    Posts
    20

    Print hyperlinked documents direct from database

    Hi Guys,



    I have a table, tblDocuments, with a field 'Link' which is a hyperlink to a PDF file.

    I have made a form, frmWorkbook, where I select a number of documents from tblDocuments, and enter the number of copies I need of each.

    I would like to develop some code to open and print the necessary number of each document rather than opening each document individually, but I have no idea where to start and I can't seem to find any applicable threads.

    Any suggestions or other Threads you could recommend I looked at?

    Regards,

    Mitch

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    It has been a while since I have written code for this type of thing. Back in the day, printer drivers only spooled a few file types, eg Raw and Prn. I can't remember all of the details but I believe it is a two step process. Convert the file to prn or acceptable file format and then spool it. I think what I did was use the printer driver to do the conversion to prn and then used the FileSystemObject's copy method to spool. Here is some code from one of my DB's.

    Code:
    '    '   Use the copy file method to send RAW files to a printer device
        'Print a RAW file
        Dim FSO As FileSystemObject
        Set FSO = New FileSystemObject
        FSO.CopyFile strMapFile, strPrinter
        Set FSO = Nothing
    Did not find anything on the conversion process yet. You might be able to simply copy the PDF directly to the printer.

    Edit:
    I was able to use adobe reader to send a pdf to the default printer using Shell and Command Line
    The trick here is to close the new window after Adobe launches. This code opens the window maximized so I can see what is going on. After you get it working to your liking, you could use minimized.
    Code:
    Dim stAppName As String
    Dim strPrintSwitch As String
    Dim strPath As String
    stAppName = ""
    strPrintSwitch = ""
    strPath = ""
    
    strPrintSwitch = "/t "
    strPath = "C:\Test\test.pdf"
    
        stAppName = "C:\Program Files (x86)\Adobe\Reader 10.0\Reader\AcroRd32.exe " & strPrintSwitch & strPath
        Call Shell(stAppName, 1)
    Last edited by ItsMe; 06-06-2014 at 06:58 AM. Reason: Add some info

  3. #3
    mcpearce is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Apr 2014
    Location
    Perth
    Posts
    20
    Thanks sometimes helpful! Looks reasonably straight forward. Will try it soon and report back with the final results

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 03-22-2014, 04:10 PM
  2. Replies: 6
    Last Post: 12-06-2013, 11:00 AM
  3. Replies: 1
    Last Post: 10-29-2013, 09:46 AM
  4. adding images & documents to database
    By ksosnick in forum Database Design
    Replies: 2
    Last Post: 10-26-2011, 01:48 PM
  5. how to play mp3 direct from database
    By sean in forum Access
    Replies: 0
    Last Post: 10-20-2009, 08:27 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums