-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsavePdf.js
More file actions
executable file
·29 lines (28 loc) · 929 Bytes
/
savePdf.js
File metadata and controls
executable file
·29 lines (28 loc) · 929 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
var system = require('system');
var args = system.args;
var url = args['1'];
var name = args['2'];
var filename = args['3'];
var filetime = args['4'];
var dirPath = "/data/resources/system/export/export_policy";
// var dirPath = "/Users/lizhen/Desktop/resurce/export_policy";
openPage(url);
function openPage(url) {
var page = require('webpage').create();
page.open(url, function (status) {
setTimeout(function () {
console.log(status)
if (status === "success") {
page.paperSize = {
format: 'A4',
orientation: 'portrait',
border: '1cm'
};
page.render(dirPath+'/'+(filename+filetime)+'/'+name + ".pdf");
} else {
console.log("Page failed to load.");
}
phantom.exit(0);
}, 3000);
});
}