Socket
Socket
Sign inDemoInstall

@isneezy/pdf-generator-service

Package Overview
Dependencies
9
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @isneezy/pdf-generator-service

A powerful and versatile web service for converting HTML pages, templates, and URLs into high-quality PDF documents.


Version published
Weekly downloads
7
Maintainers
1
Created
Weekly downloads
 

Readme

Source

@isneezy/pdf-generator-service

@isneezy/pdf-generator-service is a web service that allows you to easily generate PDFs from a web interface. It uses the @isneezy/pdf-generator library to generate the PDFs and provides an HTTP API that you can use to generate PDFs from a web application.

The package is available in three forms:

  • as a command line interface
  • as a container image

Installation

Command Line Interface

You can install the package as a command line interface using npm or yarn.

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

Container Image

The package is also available as a container image on quay.io. It's suggested to check the available tags here before pulling the image.

To run the service in a container, you can use the docker run command and specify the necessary environment variables and ports.

For example:

docker run -p 3000:3000 quay.io/isneezy/pdf-generator-service

This command will start the service and make it accessible on port 3000.

Usage

Command Line Interface

To start the service, you can use the pdf-generator-service command.

pdf-generator-service [options]
OptionTypeDefaultDescription
-V, --versionOutput the version number
-p, --portnumber3000Specify the port in which the service will be listening
-c, --corsbooleanfalseEnable CORS (Cross-Origin Resource Sharing)
-l, --log-levelstringinfoSpecify the log level (info, warn, error, silent)

It's important to note that when using the container image, the options should be passed as environment variables.

HTTP API

The service exposes a single endpoint: POST /v1/generate.

You can use this endpoint to generate a PDF by making a POST request with the following options as the request body.

OptionTypeDefaultDescription
gotostringURL to the HTML content/handlebars template to be converted to PDF. If set this takes priority over template option
templatestringHandlebars template to be converted to PDF
headerTemplatestringHandlebars template to be rendered as page header
footerTemplatestringHandlebars template to be rendered as page footer
contextobject{}Data to be passed to the HTML template
formatstringA4Sets paper format type to be used when printing a PDF (default: "A4")
landscapebooleanfalseUse this flag to switch the orientation from portrait to landscape (default: false)
marginobject{top: "10mm", bottom: "10mm", left: "10mm", right: "10mm"}Set the page margins (default: "10mm")

Keywords

FAQs

Last updated on 23 Jan 2023

Did you know?

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc