Socket
Socket
Sign inDemoInstall

pdf-forger

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    pdf-forger

A simple HTML to PDF converter using headless_chrome and napi-rs


Version published
Maintainers
1
Created

Readme

Source

pdf-forger

A simple HTML to PDF converter using headless_chrome and napi-rs.

Installation

npm install pdf-forger

Usage

// Basic usage
const result = htmlToPdf(HTML_CONTENT);

// Options for chrome
export interface BrowserOptions {
  headless?: boolean
  sandbox?: boolean
  enableGpu?: boolean
  enableLogging?: boolean
  windowSize?: WindowSize
  port?: number
  ignoreCertificateErrors?: boolean
  path?: string
  userDataDir?: string
  disableDefaultArgs?: boolean
  idleBrowserTimeout?: number
  processEnvs?: Record<string, string>
}

// Options for PDF
export interface PdfOptions {
  landscape?: boolean
  displayHeaderFooter?: boolean
  printBackground?: boolean
  scale?: number
  paperWidth?: number
  paperHeight?: number
  marginTop?: number
  marginBottom?: number
  marginLeft?: number
  marginRight?: number
  pageRanges?: string
  ignoreInvalidPageRanges?: boolean
  headerTemplate?: string
  footerTemplate?: string
  preferCssPageSize?: boolean
  transferMode?: string
}

// Advance usage
const result = htmlToPdf(HTML_CONTENT, {...browserOptions}, {...pdfOptions});

Keywords

FAQs

Last updated on 16 Mar 2024

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