
With PDFKit options # options will be passed to PDFKit.newĬ PDFKit::Middleware, :print_media_type => true Rails apps # in application.rb(Rails3) or environment.rb(Rails2)
#PDFKIT RAILS PDF#
PDFKit comes with a middleware that allows users to get a PDF view of any page on your site by appending. # Use only if your external hostname is unavailable on the server.Ĭonfig.root_url = " config.verbose = false You can configure PDFKit like so: # config/initializers/pdfkit.rbĬonfig.wkhtmltopdf = '/path/to/wkhtmltopdf' If you are on Windows, want to point PDFKit to a different binary, or are having trouble with getting PDFKit to find your binary, please manually configure the wkhtmltopdf location. PDFKit will try to intelligently guess at the location of wkhtmltopdf by running the command which wkhtmltopdf. If you're on Windows or you would like to use a specific wkhtmltopdf you installed, you will need to tell PDFKit where the binary is. Kit.stylesheets :cookie_val1, => :cookie_val2) Kit = PDFKit.new(html, :page_size => 'Letter')


# run `wkhtmltopdf -extended-help` for a full list of options Usage # PDFKit.new takes the HTML and any options for wkhtmltopdf Note: The automated installer has been removed. Try using the wkhtmltopdf-binary-edge gem (mac + linux i386) gem install wkhtmltopdf-binary Uses wkhtmltopdf on the back-end which renders HTML using Webkit.
