Skip to content
Snippets Groups Projects

Added the ability to generate outlines for PDFs

Merged Boris Budini requested to merge pdf-outline into master
4 files
+ 154
0
Compare changes
  • Side-by-side
  • Inline
Files
4
+ 6
0
@@ -26,6 +26,11 @@ program
@@ -26,6 +26,11 @@ program
.option('-t, --timeout [ms]', 'Set a max timeout of [ms]')
.option('-t, --timeout [ms]', 'Set a max timeout of [ms]')
.option('-x, --html', 'output html file')
.option('-x, --html', 'output html file')
.option('-b, --blockLocal', 'Disallow access to filesystem for local files')
.option('-b, --blockLocal', 'Disallow access to filesystem for local files')
 
.option('--outline-tags [tags]', 'Specifies that an outline should be ' +
 
'generated for the resulting PDF document. [tags] specifies which ' +
 
'HTML tags should be considered for that outline. ' +
 
'"h1,h2" will trigger an outline with "h1" tags as root elements ' +
 
'and "h2" elements as their childs.')
.parse(process.argv);
.parse(process.argv);
@@ -122,6 +127,7 @@ if (typeof input === "string") {
@@ -122,6 +127,7 @@ if (typeof input === "string") {
file = await printer.html(input, options);
file = await printer.html(input, options);
output = replaceExt(output, '.html');
output = replaceExt(output, '.html');
} else {
} else {
 
options.outlineTags = !program.outlineTags ? [] : program.outlineTags.split(',');
file = await printer.pdf(input, options);
file = await printer.pdf(input, options);
}
}
} else {
} else {