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 ].
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 truejnc 5-jan-2010 - Can someone give an example of how to use tcom with Acrobat-Reader? Combinding the above two, I came up with:
% package require tcom 3.9 % set pdf [::tcom::ref createobject AcroPDF.PDF] ::tcom::handle0x0303FC90 % $pdf LoadFile faa.pdf 0 %
LoadFile returns 0, nothing ever happens, nothing ever happens in the Task Manager either of Windows (I was expecting to a new Acroreader process.
See also: