Enable printing in Docify

This commit is contained in:
Xuan Sang LE
2021-01-30 17:45:45 +00:00
parent 752b2a6f1d
commit b0c2e088f9
15 changed files with 155 additions and 9 deletions

View File

@ -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

View File

@ -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

View File

@ -13,4 +13,13 @@ canvas[data-id = "preview-canvas"]
{
display: block;
margin:0 auto;
}
afx-app-window[data-id = "DocifyPrintDialog"] i.label-text {
font-weight: bold;
}
afx-app-window[data-id = "DocifyPrintDialog"] input[type="radio"] {
margin: 0;
height: 12px;
margin-left: 10px;
}

File diff suppressed because one or more lines are too long

View File

@ -7,7 +7,7 @@
"author": "",
"email": ""
},
"version":"0.0.5-a",
"version":"0.0.6-a",
"category":"Other",
"iconclass":"fa fa-adn",
"mimes":["none"],

View File

@ -26,7 +26,7 @@
<div style="text-align: right;" data-height="30" >
<afx-button text="__(Open)" data-id="btopen" ></afx-button>
<afx-button text="__(Download)" data-id="btdld" ></afx-button>
<afx-button text="__(Print)" data-id="btopen" ></afx-button>
<afx-button text="__(Print on server)" data-id="btprint" ></afx-button>
</div>
</afx-vbox>
</afx-hbox>

Binary file not shown.