Code Monkey home page Code Monkey logo

docusaurus-wkhtmltopdf's Introduction

Docusaurus PDF Generator Using WKHTMLTOPDF

Note: This is a fork and complete re-write of docusaurus-prince-pdf. It has been re-purposed to use wkhtmltopdf instead of Prince PDF. This project is a work in progress, use at your own discretion!

npm version

Extract rendered data from Docusaurus and generate PDF, the hard way

Usage

Install Wkhtmltopdf first.

Run the following commands to generate PDF:

# Genrate PDF from specific site under `docs` scope
npx docusaurus-wkhtmltopdf -u https://meshtastic.org/docs/getting-started

# Change generating scope to `/docs/xxx/`
npx docusaurus-wkhtmltopdf -u https://meshtastic.org/docs/xxx

# Custom working (output) directory
npx docusaurus-wkhtmltopdf -u https://meshtastic.org/docs/getting-started --dest ./pdf-output

# Custom output file name
npx docusaurus-wkhtmltopdf -u https://meshtastic.org/docs/getting-started --output docs.pdf

To generate PDF from a local Docusaurus instance. You need to first build the site locally:

# Build the site
yarn build

# Serve built site locally
yarn serve

# Generate PDF from local Docusaurus instance
npx docusaurus-wkhtmltopdf -u http://localhost:4000/docs # Change port to your serving port

See help screen for more usages:

npx docusaurus-wkhtmltpdf -h

How it works

Like mr-pdf, this package looks for the next pagination links on generated Docusaurus site. Collect them in a list and then pass the list to wkhtmltopdf to generate the PDF.

You can specify the CSS selector if you're using custom Docusaurus theme:

npx docusaurus-wkhtmltopdf -u https://meshtastic.org/docs/getting-started --selector 'nav.custom-pagination-item--next > a'

docusaurus-wkhtmltopdf's People

Contributors

nuxnik avatar sparanoid avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.