Socket
Book a DemoInstallSign in
Socket

@isneezy/pdf-generator-cli

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@isneezy/pdf-generator-cli

A powerful and versatile command line interface for converting HTML pages, templates, and URLs into high-quality PDF documents.

0.0.1
latest
Source
npmnpm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

@isneezy/pdf-generator-cli

@isneezy/pdf-generator-cli is a command line interface for the @isneezy/pdf-generator library, it allows you to easily generate PDFs from the command line.

The package provides a single command pdf-generator that you can use to generate PDFs from a URL, HTML content or handlebars template with the context data.

Installation

To install the package, you can use npm or yarn.

npm install -g @isneezy/pdf-generator-cli
yarn global add @isneezy/pdf-generator-cli

Usage

The package provides a single command pdf-generator that you can use to generate PDFs.

pdf-generator [options]
OptionTypeDefaultDescription
-V, --versionOutput the version number
-g, --gotostringURL to the HTML content/handlebars template to be converted to PDF. If provided, it takes priority over the template option.
-t, --templatestringPath to HTML/handlebars template or string containing HTML/handlebars template to be converted to PDF. If a goto option is provided, this option will be ignored.
-c, --contextstringPath to json file or json or json string with the data to be passed to the HTML template
-f, --formatstringA4Sets the paper format to be used when printing a PDF. Accepted values include: letter, legal, tabloid, ledger, a0, a1, a2, a3, a4, a5, a6.
-H, --header-templatestringString containing the template to the header, if set this takes priority over the header template in the document
-F, --footer-templatestringString containing the template to the footer, if set this takes priority over the footer template in the document
-L, --landscapebooleanfalseUse this flag to switch the orientation from portrait to landscape
-M, --marginstring10mmSet the page margins. The margin option can be set in the following formats:
  • "margin" : sets the same margin for all four sides (top, bottom, left, right). Eg: 10mm
  • "top-bottom,left-right" : sets the same margin for top and bottom, and the same margin for left and right. Eg: 10mm,5mm
  • "top,bottom,left,right" : sets different margins for each side. Eg: 3mm,10mm,4mm,9mm
-o, --outputstringPath to the output PDF file

The command takes the same options as the generate method in the @isneezy/pdf-generator library, and it generates the PDF file in the specified output path.

Here is an example of how to use the command to generate a PDF from a handlebars template and context data:

pdf-generator -t "path/to/template.html" -c "path/to/context.json" -o "path/to/output.pdf"
# Or you can pass the template and context strings directly
pdf-generator -t "<p>My {{ name }}</p>" -c '{ name: "template"}' -o "path/to/output.pdf"

Keywords

HTML

FAQs

Package last updated on 23 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.