1
0
mirror of https://github.com/lxsang/antd-web-apps synced 2025-07-23 17:19:47 +02:00

allow download pdf file

This commit is contained in:
Xuan Sang LE
2018-09-11 10:35:02 +02:00
parent 9d8e0916a2
commit 4710f183e1
8 changed files with 96 additions and 1 deletions

View File

@ -50,3 +50,17 @@ end
function IndexController:actionnotfound(...)
return self:notoc(table.unpack({...}))
end
function IndexController:pdf(...)
local tmp_file = "/tmp/lxsang_cv.pdf"
local cmd = "wkhtmltopdf "..HTTP_ROOT.."/index/notoc "..tmp_file
local r = os.execute(cmd)
if r then
local mime = std.mimeOf(tmp_file)
std.header(mime)
std.fb(tmp_file)
return false
else
return self:error("Sorry.Problem generate PDF file")
end
end