npm.io
0.0.1 • Published 2 years ago

gatsby-plugin-pdf-export

Licence
ISC
Version
0.0.1
Deps
5
Size
8 kB
Vulns
0
Weekly
0


Logo

gatsby-plugin-pdf-export

Export PDF versions of pages at build time

Getting Started

Installation

npm i gatsby-plugin-pdf-export

(back to top)

Usage

In your gatsby-config.js:

{
    plugins: [
        {
            resolve: 'gatsby-plugin-pdf-export',
            options: {
                targetPaths: []
            }
        }
    ]
}
Options
Target Paths

List of paths to generate PDFs for.

options: {
    targetPaths: ['/', '/events/']
}
Output Path

Directory to store generated PDF files

options: {
    outputPath: 'public/pdfs'
}
Output Prefix

Prefix for generated PDF files

options: {
    outputPrefix: 'printable-'
}
PDF Options

PDF options passed directly to Puppeteer. See https://pptr.dev/api/puppeteer.pdfoptions

options: {
    pdfOptions: {
        scale: 2
    }
}
Style Options

Style tag options passed directly to Puppeteer. See https://pptr.dev/api/puppeteer.frameaddstyletagoptions

options: {
    styleOptions: {
        content: '.copy { margin: 5em; }'
    }
}

(back to top)

Acknowledgments

(back to top)

Keywords