[input type=hidden name=tid value="$(transid "$file")"]
[input type=hidden name=session_key value="$SESSION_KEY"]
[button type=submit name=action value=update_invoice . $(_ Update)]
+ [button type=submit name=action value=pdf_export . $(_ PDF)]
]
EOF
done
;;
pdf_export)
id="$(POST id)" file="$_DATA/${id}.kvd" tmp="$(randomid)"
- type="$(DBM "$file" get type)"
- [ -d "${_EXEC}/${type}/" ] \
- && . "${_EXEC}/${type}/print.sh"
+ DB3 open "$file"
+ type="$(DB3 get type)"
+ . "${_EXEC}/${type}/form.sh"
+ . "${_EXEC}/${type}/print.sh"
- yield_html >"$_DATA/export/${tmp}.html"
- lowriter --convert-to pdf --outdir "export/" "export/${tmp}.html" >/dev/null
- pdftk "export/${tmp}.pdf" background "$_EXEC/$type/Background.pdf" output "export/${tmp}.pdf"
- mv -- "export/${tmp}.pdf" "export/${id}.pdf"
+ yield_html >"$_DATA/export/${id}.html"
+ lowriter --convert-to pdf --outdir "export/" "export/${id}.html" >/dev/null
+ if [ -f "$_EXEC/$type/print.pdf" ]; then
+ pdftk "export/${id}.pdf" burst output "export/${id}_%04d.pdf"
+ pdftk "export/${id}_0001.pdf" background "$_EXEC/$type/print.pdf" output "export/${tmp}.pdf"
+ mv -- "export/${tmp}.pdf" "export/${id}_0001.pdf"
+ pdftk "export/${id}"_*.pdf cat output "export/${id}.pdf"
+ rm -- "export/${id}"_*.pdf "export/doc_data.txt"
+ fi
rm -- "export/${id}.html"
- redirect "/pdf/${id}/$(URL "${filenamestring}.pdf")"
+ REDIRECT "/pdf/${id}/$(URL "${filenamestring}.pdf")"
;;
*)
REDIRECT /
&& . "${_EXEC}/${type}/form.sh"
yield_form
;;
+ /pdf/*/*.pdf)
+ id="${PATH_INFO#/pdf/}" id="${id%%/*}"
+ FILE "$_DATA/export/${id}.pdf"
+ ;;
*) REDIRECT /
;;
esac