Index: openacs-4/packages/acs-tcl/tcl/utilities-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/utilities-procs.tcl,v diff -u -N -r1.142 -r1.143 --- openacs-4/packages/acs-tcl/tcl/utilities-procs.tcl 7 Aug 2017 23:48:00 -0000 1.142 +++ openacs-4/packages/acs-tcl/tcl/utilities-procs.tcl 13 Sep 2017 16:50:35 -0000 1.143 @@ -10,6 +10,36 @@ namespace eval util {} +ad_proc util::pdfinfo { + file +} { + Calls the pdfinfo command line utility on a given pdf + file. pdfinfo must be installed on the server for this to work. On + linux this is usually part of the poppler-utils + (https://poppler.freedesktop.org/). + + @param file absolute path to the pdf file + + @return a dict containing all the pdfinfo returned fields as keys + and their respective values +} { + set pdfinfo [util::which pdfinfo] + + if {$pdfinfo eq ""} { + error "pdfinfo command not found on the system" + } + + set retval [dict create] + foreach line [split [exec $pdfinfo $file] \n] { + lassign [split $line ":"] name value + set name [string trim $name] + set value [string trim $value] + dict set retval $name $value + } + + return $retval +} + ad_proc util::zip { -source:required -destination:required