Skip to content

Commit

Permalink
Added command line arguments to add author, subject, and title pdf me…
Browse files Browse the repository at this point in the history
…ta data.
  • Loading branch information
copart authored and astefanutti committed Sep 30, 2021
1 parent e52928a commit 2e78896
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions decktape.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,25 @@ parser.script('decktape').options({
list : true,
help : 'Additional argument to pass to the Chrome instance, can be repeated',
},
// PDF meta data
metaAuthor : {
full : 'pdf-author',
metavar : '<arg>',
type : 'string',
help : 'String to set as the author of the resulting pdf document',
},
metaTitle : {
full : 'pdf-title',
metavar : '<arg>',
type : 'string',
help : 'String to set as the title of the resulting pdf document',
},
metaSubject : {
full : 'pdf-subject',
metavar : '<arg>',
type : 'string',
help : 'String to set as the subject of the resulting pdf document',
},
});

function parseSize(size) {
Expand Down Expand Up @@ -201,6 +220,12 @@ process.on('unhandledRejection', error => {
await page.emulateMediaType('screen');
const pdf = await PDFDocument.create();
pdf.setCreator('Decktape');
if (options.metaAuthor)
pdf.setAuthor(options.metaAuthor);
if (options.metaSubject)
pdf.setSubject(options.metaSubject);
if (options.metaTitle)
pdf.setTitle(options.metaTitle);

page
.on('console', async msg => {
Expand Down

0 comments on commit 2e78896

Please sign in to comment.