Giter Site home page Giter Site logo

zzyandzzy / html2pdf Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ilaborie/html2pdf

0.0 0.0 0.0 136 KB

Just a CLI over the headless_chrome https://crates.io/crates/headless_chrome crate to render a PDF from a local HTML file

License: Apache License 2.0

Rust 92.07% Just 7.93%

html2pdf's Introduction

html2pdf

Docs Crates.io

Just a CLI over the headless_chrome crate to create PDF.

Install

Need the Rust toolchain: https://rustup.rs/.

cargo install html2pdf

Usage

html2pdf path/to/file.html

To remove logs, set the env var RUST_LOG to none :

RUST_LOG="none" html2pdf path/to/file.html

Options

Just run html2pdf --help :

html2pdf 0.4.0
Generate a PDF from a local HTML file using a headless chrome

USAGE:
    html2pdf [FLAGS] [OPTIONS] <input>

FLAGS:
        --background       Allow print background
    -h, --help             Prints help information
        --landscape        Use landscape mode
        --disable-sandbox  Disable Chrome sandbox. Not recommended, unless running on docker

    -V, --version          Prints version information

OPTIONS:
        --footer <footer>  HTML template for the print footer. Should use the same format as the headerTemplate
        --header <header>  HTML template for the print header. Should be valid HTML markup with following classes used
                           to inject printing values into them: date for formatted print date, title for document
                           title, url for document location, pageNumber for current page number, totalPages for total
                           pages in the document. For example, `<span class=title></span>` would generate span
                           containing the title
        --margin <margin>  Margin in inches You can define margin like this: '0.4' the value is applied for all side,
                                  '0.4 0.4' : first value is applied for top and bottom, second for left and right, '0.4 0.4
                                  0.4 0.4' : first value is applied for top then, right, then bottom, and last for left
    -o, --output <output>  Output file. By default, just change the input extension to PDF
        --paper <paper>    Paper size. Supported values: A4, Letter, A3, Tabloid, A2, A1, A0, A5, A6
        --range <range>    Paper ranges to print, e.g. '1-5, 8, 11-13'
        --scale <scale>    Scale, default to 1.0
        --wait <wait>      Time to wait in ms before printing. Examples: 150ms, 10s

ARGS:
    <input>    Input HTML file

html2pdf's People

Contributors

ilaborie avatar complexia avatar dburriss avatar zzyandzzy avatar randommm 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.