diff --git a/README.md b/README.md index c81f89a1f..258a022d5 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,8 @@ npm install -g @asyncapi/generator | version | Override the version of your application provided under `info.version` location in the specification file. | No | Version is taken from the spec file. | *Any* ([See Semver versioning](https://semver.org/)) | `1.0.0` | | singleFile | Set output into one html-file with styles and scripts inside | No | `false` | `true`,`false` | `true` | | outFilename | The filename of the output file. | No | `index.html` | *Any* | `asyncapi.html` | -| pdf | Generates output HTML as PDF | No | `false` | `true,false` | `false` | +| pdf | Generates output HTML as PDF | No | `false` | `true`, `false` | `true` | +| pdfTimeout | Timeout (in ms) used to generate the PDF | No | 30000 | >=0 | 1000 | | config | Inline stringified JSON or a path to a JSON file to override default React component config. The config override is merged with the default config using the [JSON Merge Patch](https://tools.ietf.org/html/rfc7386) algorithm. | No | `{ "show": { "sidebar": true }, "sidebar": { "showOperations": "byDefault" } }` | [JSON config for the React component](https://github.com/asyncapi/asyncapi-react/blob/next/docs/configuration/config-modification.md#definition) | `{"show":{"sidebar":false}}` | > **NOTE**: If you only generate an HTML website, set the environment variable `PUPPETEER_SKIP_CHROMIUM_DOWNLOAD` to `true` and the generator will skip downloading chromium. diff --git a/hooks/99_generatePdf.js b/hooks/99_generatePdf.js index c3b120103..cf418c785 100644 --- a/hooks/99_generatePdf.js +++ b/hooks/99_generatePdf.js @@ -31,7 +31,7 @@ module.exports = { toClick && typeof button.dispatchEvent === 'function' && button.dispatchEvent(new Event('click', { bubbles: true })); })); - await page.pdf({ format: 'A4', path: `${targetDir}/index.pdf`, printBackground: true }); + await page.pdf({ format: 'A4', path: `${targetDir}/index.pdf`, printBackground: true, timeout: parseInt(templateParams.pdfTimeout, 10) }); browser.close(); } catch(e) { console.error(e); diff --git a/package.json b/package.json index 979f4e22d..979a0916e 100644 --- a/package.json +++ b/package.json @@ -104,6 +104,11 @@ "description": "Set to `true` to get index.pdf generated next to your index.html", "default": false }, + "pdfTimeout": { + "description": "The timeout (in ms) used to generate the pdf", + "default": 30000, + "required": false + }, "config": { "description": "Stringified JSON or a path to a JSON file to override the default React component config. The config override is merged with the default config using the [JSON Merge Patch](https://tools.ietf.org/html/rfc7386) algorithm.", "default": "",