| CARVIEW |
Select Language
HTTP/2 302
server: nginx
date: Tue, 03 Feb 2026 19:46:15 GMT
content-type: text/plain; charset=utf-8
content-length: 0
x-archive-redirect-reason: found capture at 20101021043709
location: https://web.archive.org/web/20101021043709/https://github.com/jdpace/PDFKit
server-timing: captures_list;dur=0.724326, exclusion.robots;dur=0.061871, exclusion.robots.policy;dur=0.048613, esindex;dur=0.010618, cdx.remote;dur=41.706339, LoadShardBlock;dur=347.678097, PetaboxLoader3.datanode;dur=144.222889, PetaboxLoader3.resolve;dur=82.464269
x-app-server: wwwb-app244-dc8
x-ts: 302
x-tr: 427
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
set-cookie: wb-p-SERVER=wwwb-app244; path=/
x-rl: 0
x-na: 0
x-page-cache: BYPASS
server-timing: BYPASS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
x-location: _pdf
HTTP/2 200
server: nginx
date: Tue, 03 Feb 2026 19:46:16 GMT
content-type: text/html; charset=utf-8
x-archive-orig-server: nginx/0.7.67
x-archive-orig-date: Thu, 21 Oct 2010 04:37:09 GMT
x-archive-orig-connection: close
x-archive-orig-status: 200 OK
x-archive-orig-etag: "29500850ee7e2ce843479c31c683bfbc"
x-archive-orig-x-runtime: 118ms
x-archive-orig-content-length: 40758
x-archive-orig-cache-control: private, max-age=0, must-revalidate
x-archive-guessed-content-type: text/html
x-archive-guessed-charset: utf-8
memento-datetime: Thu, 21 Oct 2010 04:37:09 GMT
link: ; rel="original", ; rel="timemap"; type="application/link-format", ; rel="timegate"
content-security-policy: default-src 'self' 'unsafe-eval' 'unsafe-inline' data: blob: archive.org web.archive.org web-static.archive.org wayback-api.archive.org athena.archive.org analytics.archive.org pragma.archivelab.org wwwb-events.archive.org
x-archive-src: 52_18_20101021023550_crawl102-c/52_18_20101021043641_crawl101.arc.gz
server-timing: captures_list;dur=0.789759, exclusion.robots;dur=0.017593, exclusion.robots.policy;dur=0.007726, esindex;dur=0.015483, cdx.remote;dur=30.225739, LoadShardBlock;dur=301.271429, PetaboxLoader3.datanode;dur=132.506107, PetaboxLoader3.resolve;dur=158.660108, load_resource;dur=166.254125
x-app-server: wwwb-app244-dc8
x-ts: 200
x-tr: 618
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
x-rl: 0
x-na: 0
x-page-cache: BYPASS
server-timing: BYPASS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
x-location: _pdf
content-encoding: gzip
jdpace's PDFKit at master - GitHub
- Source
- Commits
- Network (33)
- Issues (13)
- Wiki (2)
- Graphs
-
Branch:
master
click here to add a description
click here to add a homepage
Sending Request…
Downloads
PDFKit /
README.md
PDFKit
Create PDFs using plain old HTML+CSS. Uses wkhtmltopdf on the backend which renders HTML using Webkit.
Install
PDFKit
gem install pdfkit
wkhtmltopdf
-
Automatic:
sudo pdfkit --install-wkhtmltopdf
install latest version into /usr/local/bin
(overwrite defaults with e.g. ARCHITECTURE=amd64 TO=/home/foo/bin) - By hand: https://code.google.com/p/wkhtmltopdf/downloads/list
Usage
# PDFKit.new takes the HTML and any options for wkhtmltopdf
# run `wkhtmltopdf --extended-help` for a full list of options
kit = PDFKit.new(html, :page_size => 'Letter')
kit.stylesheets << '/path/to/css/file'
# Git an inline PDF
pdf = kit.to_pdf
# Save the PDF to a file
file = kit.to_file('/path/to/save/pdf')
# PDFKit.new can optionally accept a URL or a File.
# Stylesheets can not be added when source is provided as a URL of File.
kit = PDFKit.new('https://google.com')
kit = PDFKit.new(File.new('/path/to/html'))
# Add any kind of option through meta tags
PDFKit.new('<html><head><meta name="pdfkit-page_size" content="Letter")
Configuration
If you're on Windows or you installed wkhtmltopdf by hand to a location other than /usr/local/bin you will need to tell PDFKit where the binary is. You can configure PDFKit like so:
# config/initializers/pdfkit.rb
PDFKit.configure do |config|
config.wkhtmltopdf = '/path/to/wkhtmltopdf'
config.default_options = {
:page_size => 'Legal',
:print_media_type => true
}
end
Middleware
PDFKit comes with a middleware that allows users to get a PDF view of any page on your site by appending .pdf to the URL.
Middleware Setup
Non-Rails Rack apps
# in config.ru
require 'pdfkit'
use PDFKit::Middleware
Rails apps
# in application.rb(Rails3) or environment.rb(Rails2)
require 'pdfkit'
config.middleware.use PDFKit::Middleware
With PDFKit options
# options will be passed to PDFKit.new
config.middleware.use PDFKit::Middleware, :print_media_type => true
TODO
- add amd64 support in --install-wkhtmltopdf
Note on Patches/Pull Requests
- Fork the project.
- Setup your development environment with: gem install bundler; bundle install
- Make your feature addition or bug fix.
- Add tests for it. This is important so I don't break it in a future version unintentionally.
- Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
- Send me a pull request. Bonus points for topic branches.
Copyright
Copyright (c) 2010 Jared Pace. See LICENSE for details.
- © 2010 GitHub Inc. All rights reserved.
- Terms of Service
- Privacy
- Security
Keyboard Shortcuts
Site wide shortcuts
- s
- Focus site search
- ?
- Bring up this help dialog
Commit list
- j
- Move selected down
- k
- Move selected up
- t
- Open tree
- p
- Open parent
- c or o or enter
- Open commit
Pull request list
- j
- Move selected down
- k
- Move selected up
- o or enter
- Open issue
Issues
- j
- Move selected down
- k
- Move selected up
- x
- Toggle select target
- o or enter
- Open issue
- I
- Mark selected as read
- U
- Mark selected as unread
- e
- Close selected
- y
- Remove selected from view
- c
- Create issue
- l
- Create label
- i
- Back to inbox
- u
- Back to issues
- /
- Focus issues search
Network Graph
- ← or h
- Scroll left
- → or l
- Scroll right
- ↑ or k
- Scroll up
- ↓ or j
- Scroll down
- t
- Toggle visibility of head labels
- shift ← or shift h
- Scroll all the way left
- shift → or shift l
- Scroll all the way right
- shift ↑ or shift k
- Scroll all the way up
- shift ↓ or shift j
- Scroll all the way down