0.0
No commit activity in last 3 years
No release in over 3 years
A lightweight HTML to PDF generation GEM
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.17
~> 10.0
 Project Readme

PuppeteerPdf

PuppeteerPdf is using Puppeteer library organized by Google. It's a lightest gem to generate PDF's using URL. PuppeteerPdf is using Headless to open webpage and then simply convert it into PDF.

Prerequisite

Before installing puppeteer_pdf gem system must have puppeteer library installed, it can be installed by

- npm install 8
- npm i puppeteer  # or "yarn add puppeteer"

or visit https://developers.google.com/web/tools/puppeteer/

Installation

Once all prerequisites are installed add this line to your application's Gemfile:

gem 'puppeteer_pdf'

And then execute:

$ bundle

Or install it yourself as:

$ gem install puppeteer_pdf

Usage

require 'puppeteer_pdf'
url = 'https://developers.google.com/web/tools/puppeteer'
output_path = '/system_path/test.pdf'
PuppeteerPdf.generate_pdf(url, output_path) # '/system_path/test.pdf'

Options

opts = {
    height: 600,
    width: 1225,
    layout: 'Landscape',
    format: 'A4',
    timeout: 10000,
    header_text: 'Company Name',
    footer_text: 'Any Text Information',
    print_background: true,
    include_page_numbers: true,
    }
PuppeteerPdf.generate_pdf(url, output_path, opts)

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/muneeb0011/puppeteer_pdf. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the PuppeteerPdf project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.