wkhtmltopdf-crystal

Bindings / wrapper for libwkhtmltox (HTML to PDF / image converter) wkhtmltopdf wkhtmltox
0.1.0 released

wkhtmltopdf for Crystal

Crystal wrapper for C library libwkhtmltox. wkhtmltopdf and wkhtmltoimage permits to render HTML into PDF and various image formats using the Qt WebKit rendering engine - http://wkhtmltopdf.org/

Requirements

  • libwkhtmltox must be installed on the host system
  • pkg-config must be available

Installation

  • Copy wkhtmltox.pc inside one of pkg-config paths (ex. /usr/local/lib/pkgconfig)
  • Or execute before compiling (from wkhtmltopdf shard folder): export PKG_CONFIG_PATH="pwd"
  • Add this to your application's shard.yml:
dependencies:
  wkhtmltopdf-crystal:
    github: blocknotes/wkhtmltopdf-crystal

Documentation

Usage

  • HTML to PDF:
require "wkhtmltopdf"
Wkhtmltopdf::WkPdf.new( "test.pdf" ).convert( "<h3>Just a test</h3>" )
  • URL content to JPG:
require "wkhtmltopdf"
img = Wkhtmltopdf::WkImage.new
img.set_url "http://www.google.it"
img.set_output "test.jpg"
img.set "quality", "90"
img.convert

See examples folder.

Contributors

wkhtmltopdf-crystal:
  github: blocknotes/wkhtmltopdf-crystal
  version: ~> 0.1.0
License MIT
Crystal 0.20.3

Authors

Dependencies 0

Development Dependencies 0

Last synced .
search fire star recently