Skip to content

Latest commit

 

History

History
54 lines (40 loc) · 2.21 KB

README.md

File metadata and controls

54 lines (40 loc) · 2.21 KB

MrinDoc logo

RapiPDF

Custom element for Open-API to PDF generation

This is a fork from https://mrin9.github.io/RapiPdf, replacing font with SourceHanSans and SourceHanMono for Chinese, and add a cli to generate pdf for better automation.

The repository is not marked as a fork in github since I migrate some font-related files to lfs which rewrites the history.

Features

  • Supports Swagger 2.0 and OpenAPI 3.0
  • Generate PDF using Web-Component
  • Generate PDF with commandline
  • Works with any framework or with no framework
  • Plenty of customizing options, including selection of brand colors
  • Supported on Chrome, FireFox and Safari. (Not yet tested on Edge)

Documentation

Web-based usage

Check out the usage and examples

Commandline usage

node dist/rapipdf-cli.js -i ~/projects/higis/api-core/dist/hipo.yml -o ~/Downloads/hipo.pdf

Build Process

We recommend yarn over npm as we use yarn resolutions to keep the bundle size smaller. As of this writing this feature is not supported in npm natively

# Clone / Download the project then
yarn install

# build will generate rapipdf-min.js and rapipdf-cli.js 
# rapipdf-min.js: use it in the script tag of your html <script type="text/javascript" src="rapidoc-min.js"></script></body>
# rapipdf-cli.js: use it with commandline
# You may need to run `NODE_OPTIONS="--max-old-space-size=8192" yarn build` in case there's an insufficient-memory error
yarn build

# for developement use yarn serve (this will start an webserver at port 8080, then navigate to localhost:8080)
yarn serve

# alternative to yarn serve: (this will start an webserver at port 8080 listening to all adapters)
yarn serve-everyone