ggrossetie/asciidoctor-web-pdf

How to use asciidoctor-web-pdf with node.js script?

stefaneidelloth opened this issue · 1 comments

Currently I use asciidoctor.js as shown below. How can I integrate asciidoctor-web-pdf in that worklfow to also produce pdf output and open the pdf file? I tried as denoted by the comments but it did not work.

// Run this file using npm from main directory: "npm run doc"
// Documentation of asciidoctor.js:
// https://docs.asciidoctor.org/asciidoctor.js/latest/setup/quick-tour/

const asciidoctor = require('asciidoctor')(); // eslint-disable-line import/no-extraneous-dependencies
//const asciidoctorPdf = require('asciidoctor-web-pdf')(); // eslint-disable-line import/no-extraneous-dependencies
const open = require('open'); // eslint-disable-line import/no-extraneous-dependencies

// create html output
asciidoctor.convertFile('doc/index.adoc', { safe: 'safe', to_dir: './public', mkdirs: true });

//create pdf output
//asciidoctorPdf.convertFile('doc/index.adoc', { safe: 'safe', to_dir: './public', mkdirs: true });

// open html output in default browser
open('./public/index.html');

Related:

asciidoctor/asciidoctor.js#1703

Please direct usage question to the project chat at chat.asciidoctor.org. You can find more information about the support policy on the following page in the docs: docs.asciidoctor.org/about/support.