Forum OpenACS Development: Re: exec bash command pdftk within TCL page

Collapse
Posted by Iuri Sampaio on
The problem must be something else.

The code is very simple and straight forward

ad_form -extend -name files -on_submit {
ns_log Notice "ONSUBMIT "

set files [list]
for { set i 0 } { $i < $count } { incr i} {

set tmpfile [set file_${i}]

set filename "/tmp/pdf_$i.pdf"
file copy [lindex $tmpfile 1] $filename

lappend files $filename
}

set output_file "[ns_tmpnam].pdf"

ns_log Notice "INPUT: $files"
ns_log Notice "OUTPUT: $output_file"

eval { exec pdftk ${files} cat output $output_file}

ns_returnfile 200 application/pdf $output_file
}

and the error is still

[16/Aug/2011:13:04:06][976.3003374448][-default:10-] Notice: ONSUBMIT
[16/Aug/2011:13:04:06][976.3003374448][-default:10-] Notice: INPUT: /tmp/pdf_0.pdf /tmp/pdf_1.pdf
[16/Aug/2011:13:04:06][976.3003374448][-default:10-] Notice: OUTPUT: /tmp/filexx9qHV.pdf
[16/Aug/2011:13:04:07][976.3003374448][-default:10-] Warning: blank-compat: /var/www/mda/www/pdfmerge.adp uses deprecated property title instead of doc(title).
[16/Aug/2011:13:04:07][976.3003374448][-default:10-] Warning: blank-compat: /var/www/mda/www/pdfmerge.adp uses deprecated property header_stuff instead of head.
[16/Aug/2011:13:04:07][976.3003374448][-default:10-] Error: POST http://10.0.105.227:8000/pdfmerge?
referred by "http://10.0.105.227:8000/pdfmerge";
/tmp/pdf_0.pdf /tmp/pdf_1.pdf not found as file or resource.
Error: Failed to open PDF file:
/tmp/pdf_0.pdf /tmp/pdf_1.pdf
Errors encountered. No output created.
Done. Input errors, so no output created.
while executing
"exec pdftk ${files} cat output $output_file"
("eval" body line 1)
invoked from within
"eval { exec pdftk ${files} cat output $output_file}"
("uplevel" body line 20)
invoked from within
"uplevel #$level $on_submit"
("1" arm line 1)
invoked from within
"switch $errno {
0 {
# TCL_OK
}
1 {
# TCL_E..."
(procedure "ad_form" line 629)

Victor, my TCL version is

% info patchlevel
8.4.19
%