UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Vba To Print Pdf W/o Adobe, Access 2013    
 
   
ry94080
post Apr 8 2020, 11:10 AM
Post#1



Posts: 1,024
Joined: 27-July 05



Hi all,

Is there a way around printing a PDF document without having Adobe Reader installed?

I have a server that I'd like to have print PDF's, but it's pretty locked down by our security department.
Go to the top of the page
 
theDBguy
post Apr 8 2020, 11:38 AM
Post#2


UA Moderator
Posts: 78,095
Joined: 19-June 07
From: SunnySandyEggo


Hi. Printing from Access? If so, a report? You could use the OutputTo method to do that.

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
June7
post Apr 8 2020, 12:10 PM
Post#3



Posts: 1,394
Joined: 25-January 16
From: The Great Land


Wouldn't OutputTo create a PDF but not print it?

It is possible to send document to print with right click menu in Windows Explorer. Likely the file's native program still needs to be installed; i.e. Adobe Reader would still have to be installed for PDF to print, even though PDF is not actually opened. Windows Shell commands in VBA can print a file. https://stackoverflow.com/questions/5090666...-files-with-vba

--------------------
Attachments Manager is below the edit post window. To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Go to the top of the page
 
theDBguy
post Apr 8 2020, 12:22 PM
Post#4


UA Moderator
Posts: 78,095
Joined: 19-June 07
From: SunnySandyEggo


Oops, sorry. I guess I misunderstood the problem. Good luck!

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
ADezii
post Apr 8 2020, 12:29 PM
Post#5



Posts: 2,989
Joined: 4-February 07
From: USA, Florida, Delray Beach


QUOTE
Is there a way around printing a PDF document without having Adobe Reader installed?

There is one way, but it is a little convoluted, and you may lose some formatting. Give it a shot, and see if it will work for you.
  1. Starting from Version 2013, Microsoft Word had the capability of Opening *.pdf Files.
  2. The following Code, using Early Binding, will Open a *.pdf File whose Path is defined by the Constant conFILE_NAME as indicated below:
    CODE
    '********** USER DEFINED SECTION **********
    Const conFILE_NAME = "C:\Test\Test.pdf"
    '******************************************
  3. Word will Open, be Visible, and probably reside in the Taskbar.
  4. Click on the Word Icon and a Conversion Dialog Box will appear (see Image). Check the Don't show this message again Check Box, then OK.
  5. The *.pdf is now converted to Word Format and you should never see the Conversion Dialog Box again, it should automatically convert *.pdfs to Word Format in the future.
  6. Print the Document as you would Print any other.
  7. Complete Code Definition:
    CODE
    Dim appWord As Word.Application
    Dim docWord As Word.Document
    '********** USER DEFINED SECTION **********
    Const conFILE_NAME = "C:\Test\Test.pdf"
    '******************************************

    Set appWord = New Word.Application

    With appWord
      appWord.Visible = True
      .Documents.Open FileName:="C:\Test\Test.pdf", ConfirmConversions:=False, ReadOnly:= _
                                 False, AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:= _
                                "", Revert:=False, WritePasswordDocument:="", WritePasswordTemplate:="", _
                                 Format:=wdOpenFormatAuto, XMLTransform:=""
    End With
  8. Now comes the interesting part. After you execute the Code for the first time, you can directly Print the *.pdf File, as in:
    CODE
    Dim appWord As Word.Application
    Dim docWord As Word.Document
    '********** USER DEFINED SECTION **********
    Const conFILE_NAME = "C:\Test\Test.pdf"
    '******************************************

    Set appWord = New Word.Application

    With appWord
      appWord.Visible = True

      Set docWord = appWord.Documents.Open(conFILE_NAME)
          docWord.PrintOut
    End With

    docWord.Close False
    appWord.Quit
    Set docWord = Nothing
    Set appWord = Nothing
  9. Hope this works for you and should you have any other questions, we are here.

This post has been edited by ADezii: Apr 8 2020, 01:00 PM
Attached File(s)
Attached File  Word.JPG ( 35.16K )Number of downloads: 9
 
Go to the top of the page
 
projecttoday
post Apr 8 2020, 03:49 PM
Post#6


UtterAccess VIP
Posts: 12,168
Joined: 10-February 04
From: South Charleston, WV


I was wondering why this would be an issue since there is a free version of Adobe Reader.

--------------------
Robert Crouser
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    25th May 2020 - 08:57 PM