From 584b499a6847e8b804bca9ab791e77cc00cab348 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Thu, 30 Nov 2023 00:07:10 +0100 Subject: [PATCH] pdf export function --- invoices.cgi | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/invoices.cgi b/invoices.cgi index bbf85d0..22d3da3 100755 --- a/invoices.cgi +++ b/invoices.cgi @@ -57,6 +57,19 @@ serverkey' >.gitignore fi REDIRECT "$PATH_INFO" ;; + pdf_export) + id="$(POST id)" file="$_DATA/${id}.kvd" tmp="$(randomid)" + type="$(DBM "$file" get type)" + [ -d "${_EXEC}/${type}/" ] \ + && . "${_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" + rm -- "export/${id}.html" + redirect "/pdf/${id}/$(URL "${filenamestring}.pdf")" + ;; *) REDIRECT / ;; -- 2.39.5