Launch PDF from AutoCAD

If you need the ability to launch a PDF file from a menu macro, lisp file, or VBA routine, check out the code shown below. This will launch the PDF using the default registered application, just as if you had entered the file name in the Windows Start-Run dialog

This avoids any browser related issues which can arise if you use the AutoCAD “BROWSER” command.

It makes no assumptions regarding the application (or it’s version) used to open a PDF document, or the presence of a properly configured PGP file.

;;;==============================
;;;       LISP EXAMPLE
;;;==============================
(defun C:LaunchPDF (/ shell)
  (vl-load-com)
  (setq filename "\\\\server\\share\\mydoc.pdf")
  (setq shell
  (vla-getinterfaceobject
    (vlax-get-acad-object)
    "Shell.Application"
  )
  )
  (vlax-invoke-method shell 'Open filename)
  (vlax-release-object shell)
)

'================================
'      VBA EXAMPLE
'================================
Private Sub LaunchPDF()
  Dim fn As String, objShell As Object
  fn = "\\server\share\mydoc.pdf"
  Set objShell = CreateObject("Shell.Application")
  objShell.Open (fn)
  Set objShell = Nothing
End Sub