Commit e927d9b4 authored by Fred Chasen's avatar Fred Chasen

Added a max timeout option

parent 9cfe48eb
Pipeline #619 skipped
......@@ -28,6 +28,7 @@ vivliostyle-electron ./path/to/index.html -o result.pdf
-h --height [size] Print to Page Height [weight]
-m, --page-margin [margin] Print with margin [margin]
-n, --hyphenate [lang] Hyphenate with language [language] such as "en-us"
-t, --timeout [ms] Set a max timeout of [ms]
```
## Hyphenation
......
......@@ -18,9 +18,15 @@ program
.option('-h --height [size]', 'Print to Page Height [weight]')
.option('-m, --page-margin [margin]', 'Print with margin [margin]')
.option('-n, --hyphenate [lang]', 'Hyphenate with language [language] such as "en-us"')
.option('-t, --timeout [ms]', 'Set a max timeout of [ms]')
.parse(process.argv);
var input = program.inputs || program.args[0];
if (!input) {
return console.error("You must include an input path");
}
var dir = process.cwd();
var relativePath = path.resolve(dir, input);
......@@ -49,7 +55,8 @@ renderer = new Renderer(tmpPath || input, output, {
landscape: program.landscape,
width: program.width,
height: program.height,
debug: program.debug
debug: program.debug,
timeout: program.timeout
}).then(function (result) {
if (tmpPath && tmpPath != relativePath) {
fs.unlinkSync(tmpPath);
......
......@@ -38,7 +38,8 @@ function Renderer(inputPath, outputPath, _options) {
landscape: options.landscape || false,
width: options.width,
height: options.height,
debug: options.debug || false
debug: options.debug || false,
timeout: options.timeout || undefined
};
var url = 'file://' + basePath + "renderer.html?url=" + encodeURIComponent(relativePath);
......@@ -65,6 +66,10 @@ function Renderer(inputPath, outputPath, _options) {
url += '&debug=' + settings.debug;
}
if (settings.timeout) {
conversion.timeout = parseInt(settings.timeout);
}
console.log("Processing", inputPath, url);
return new Promise(function (resolve, reject) {
......
{
"name": "vivliostyle-electron",
"version": "0.0.1",
"version": "0.0.2",
"description": "Render Html to PDFs using Vivliostyle.js and Electron",
"repository": {
"type": "git",
......
......@@ -23,7 +23,8 @@ function Renderer(inputPath, outputPath, _options) {
landscape: options.landscape || false,
width: options.width,
height: options.height,
debug: options.debug || false
debug: options.debug || false,
timeout: options.timeout || undefined
};
var url = 'file://' + basePath + "renderer.html?url=" + encodeURIComponent(relativePath);
......@@ -50,6 +51,10 @@ function Renderer(inputPath, outputPath, _options) {
url += '&debug=' + settings.debug;
}
if (settings.timeout) {
conversion.timeout = parseInt(settings.timeout);
}
console.log("Processing", inputPath, url);
return new Promise(function(resolve, reject) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment