Version 6 of HowTo open PDF with Adobe Acrobat using tcom

Updated 2009-07-24 11:40:31 by ALX

This page provides an example of how to open PDF with Adobe [L1 ] Acrobat using the tcom package. For more information see DeveloperFAQ.pdf [L2 ], IACOverview.pdf [L3 ] and IACReference.pdf [L4 ].

Alexander Schöpe


 package require tcom

 if {[catch {::tcom::ref createobject AcroExch.AVDoc} application]} {
   puts stderr "tcom: $application"
   exit 1
 }

 set rc [$application Open {C:\IACReference.pdf} {Opened by Tcl}]

ABU 1-oct-2006

Note that the above script does not work if you only installed Acrobat-Reader. It requires Acrobat *Writer* .

If your PC is equipped with Acrobat-Reader only, you can use the following script for browsing a PDF:

Note that optcl package is used instead of tcom

  package require optcl

  set pdfTop .pdf ; # your toplevel window
  set page   1    ; # which page to display
  set docName "c:/tmp/zzz.pdf"

   ### use Acrobat Browser Control AcroPDF.PDF
   if { [catch {
           set h [optcl::new -start -window ${pdfTop}.x {AcroPDF.PDF}]
        }] } {
        tk_messageBox -icon error -title "Acrobat Reader" \
           -message "Verificare che Acrobat Reader \nsia stato installato correttamente."
   }
   catch {
    $h LoadFile $docName
    $h setShowToolbar 0
    $h setCurrentPage $page
    $h setView Fit
   }
   pack ${pdfTop}.x -fill both -expand true



ALX: HowTo open PDF with Adobe Acrobat or Reader using DDE ALX: HowTo open PDF with Adobe Acrobat or Acrobat Reader using optcl