diff --git a/Docify/README.md b/Docify/README.md index 303c22b..6b3a96f 100644 --- a/Docify/README.md +++ b/Docify/README.md @@ -2,6 +2,7 @@ Simple PDF document manager ## Change logs +- v0.0.6-a: Add print dialog (support server side printing) - v0.0.5-a: Fix delete file bug - v0.0.4-a: Display file size in entry meta-data - v0.0.3-a: Fix document moved bug, sort entries by year, month, day \ No newline at end of file diff --git a/Docify/api/api.lua b/Docify/api/api.lua index 4c87db7..9fb4241 100644 --- a/Docify/api/api.lua +++ b/Docify/api/api.lua @@ -396,6 +396,33 @@ handle.delete = function(param) end end +handle.printdoc = function(opt) + local cmd = "lp " + if opt.printer and opt.printer ~= "" then + cmd = cmd .. " -d "..opt.printer + end + if opt.side == 0 then + cmd = cmd.. " -o sides=one-sided" + elseif opt.side == 1 then + cmd = cmd.. " -o sides=two-sided-long-edge" + elseif opt.side == 2 then + cmd = cmd .. " -o sides=two-sided-short-edge" + end + -- orientation landscape + if opt.orientation == 1 then + cmd = cmd.." -o orientation-requested=5" + end + + if opt.range == 1 then + cmd = cmd.." -P "..opt.pages + end + + cmd = cmd.. " "..vfs.ospath(opt.file) + print(cmd) + os.execute(cmd) + return result("A print job has been posted on server. Check if it successes") +end + if arg.action and handle[arg.action] then -- check if the database exits diff --git a/Docify/assets/scheme.html b/Docify/assets/scheme.html index df9e332..e0c0bcd 100644 --- a/Docify/assets/scheme.html +++ b/Docify/assets/scheme.html @@ -26,7 +26,7 @@