docusaurus-pdf icon indicating copy to clipboard operation
docusaurus-pdf copied to clipboard

Add option to pick PDF margins and format (A4/A3/etc.)

Open aloisklink opened this issue 5 years ago • 1 comments

Note: Leaving this as a draft pull request until the style changes in #19 has been merged, since currently, the changes are mixed up with the style changes.

Adds the --format and --margin field to specify the formatting of the PDF file, and adds tests to make sure we don't break anything, and resolves #18.

The --margin command accepts a string specifier for top, right, bottom, left like the CSS Margin field.

For example, the following will pass margin: {top: "1cm", right: "2cm", bottom: "1cm", left: "2cm"} to puppeteer:

npx docusaurus-pdf "https://v2.docusaurus.io/docs/2.0.0-alpha.56/lifecycle-apis" --margin '1cm 2cm 1cm 2cm'

Additionally, I've made --no-sandbox a global option, so it works on all commands, including the default docusaurus command.

aloisklink avatar Jul 05 '20 17:07 aloisklink

Sorry for marking this ready-to-review, then draft, then ready-to-review again, I had to do some git cherry-pick because I squashed-and-merge the other pull request.

aloisklink avatar Jul 07 '20 09:07 aloisklink