Code Monkey home page Code Monkey logo

chrome-headless-pdf-maker's Introduction

Headless Chrome PDF Maker

Usage:

Note: this server requires the HTML to be provided by a server, it doesn't work on bare .html files. The easiest way to do that is to host a local server by running python3 -m http.server 8000.

Then, provide the script with a URL to the file, e.g. http://127.0.0.1:8000/my-file.html.

node chrome-headless-pdf-maker --url url/to/html --pdf path/for/output/pdf
Options:
  -u, --url      URL to html file                            [string] [required]
  -p, --pdf      path to output pdf                          [string] [required]
  -f, --format   All the valid paper format types when printing a PDF, a full
                 list of them at
                 https://pptr.dev/api/puppeteer.lowercasepaperformat/
                                                        [string] [default: "a4"]
      --version  Show version number                                   [boolean]
      --help     Show help                                             [boolean]

Flags:
(Can also be executed with --no-[flag] prefix to set the flag to false)

      --display-header-footer  Whether to show the header and footer
                                                      [boolean] [default: false]
      --omit-background        Hides default white background and allows
                               generating pdfs with transparency
                                                      [boolean] [default: false]
      --landscape              Whether to print in landscape orientation
                                                      [boolean] [default: false]
      --prefer-css-page-size   Give any CSS @page size declared in the page
                               priority over what is declared in the width or
                               height or format option [boolean] [default: true]
      --print-background       Set to true to print background graphics
                                                       [boolean] [default: true]

Requirements

  • Node.js >= 14.10

chrome-headless-pdf-maker's People

Contributors

tomaszair avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  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.