All Projects → blocknotes → wkhtmltopdf-crystal

blocknotes / wkhtmltopdf-crystal

Licence: MIT license
Crystal C bindings and wrapper for libwkhtmltox library

Programming Languages

crystal
512 projects

Projects that are alternatives of or similar to wkhtmltopdf-crystal

HtmlToPdfImage
transform html to pdf/image ,base on wkhtmltox and dotnet core 2.0
Stars: ✭ 16 (-23.81%)
Mutual labels:  wkhtmltopdf, wkhtmltox
magento2-module-pdf
Magento 2 Module for creating PDF's based on wkhtmltopdf
Stars: ✭ 55 (+161.9%)
Mutual labels:  wkhtmltopdf
dhtml2pdf
Simple, free and very easy to use PHP API that allows you to see, download or get the binary of the PDF generated from the HTML of an URL.
Stars: ✭ 27 (+28.57%)
Mutual labels:  wkhtmltopdf
pydf
PDF generation in python using wkhtmltopdf for heroku and docker
Stars: ✭ 68 (+223.81%)
Mutual labels:  wkhtmltopdf
bookjs-eazy
web print / html to pdf so eazy ,HTML自动分页插件。用于生成PDF,前端WEB打印生成PDF或后端wkhtmltopdf、chrome headless生成
Stars: ✭ 99 (+371.43%)
Mutual labels:  wkhtmltopdf
docker-alpine-wkhtmltopdf
wkhtmltopdf alpine docker container with headless qt patches
Stars: ✭ 150 (+614.29%)
Mutual labels:  wkhtmltopdf
api2pdf.php
PHP client library for the Api2Pdf.com REST API - Convert HTML to PDF, URL to PDF, Office Docs to PDF, Merge PDFs, HTML to Image, URL to Image, HTML to Docx, HTML to Xlsx, PDF to HTML, Thumbnail preview of office files
Stars: ✭ 42 (+100%)
Mutual labels:  wkhtmltopdf
Pdfkit
A Ruby gem to transform HTML + CSS into PDFs using the command-line utility wkhtmltopdf
Stars: ✭ 2,799 (+13228.57%)
Mutual labels:  wkhtmltopdf
docker-symfony
Docker Symfony (PHP-FPM - NGINX - MySQL - MailHog - Redis - RabbitMQ)
Stars: ✭ 32 (+52.38%)
Mutual labels:  wkhtmltopdf
mdconv
A CLI markdown converter written in Go, that does not depend on LaTeX.
Stars: ✭ 42 (+100%)
Mutual labels:  wkhtmltopdf
automation-report
Automation report是一款可以解决很多行业领域中设涉及到报告生成的需求,本项目最开始的初衷是为公司内部简化人工流程的一个环节,主要实现目的是将实验室检测得出的下机数据结果与对应的报告模版批量结合生成报告(.pdf)。
Stars: ✭ 13 (-38.1%)
Mutual labels:  wkhtmltopdf
wkhtmltopdf-aws-lambda-layer
AWS Lambda Layer for wkhtmltopdf
Stars: ✭ 62 (+195.24%)
Mutual labels:  wkhtmltopdf
wkhtmltopdf-flask-aas
Wkhtmltopdf Flask As a Service
Stars: ✭ 17 (-19.05%)
Mutual labels:  wkhtmltopdf
python-pdfkit-example
python-pdfkit HTML TO PDF Example
Stars: ✭ 18 (-14.29%)
Mutual labels:  wkhtmltopdf
dotnet-eud
DevExpress .NET Controls End-User Documentation
Stars: ✭ 50 (+138.1%)
Mutual labels:  wkhtmltopdf
django-invoices
Create invoices using django
Stars: ✭ 28 (+33.33%)
Mutual labels:  wkhtmltopdf
odoo-11.0-windows-installation
Install odoo-11.0 from source on Windows
Stars: ✭ 34 (+61.9%)
Mutual labels:  wkhtmltopdf
Gotenberg
A Docker-powered stateless API for PDF files.
Stars: ✭ 3,272 (+15480.95%)
Mutual labels:  wkhtmltopdf
php-pdf
Yet another HTML to PDF Converter based on wkhtmltopdf
Stars: ✭ 50 (+138.1%)
Mutual labels:  wkhtmltopdf
wkhtmltopdf-binary-edge
this is forked from tolgap/wkhtmltopdf-binary .
Stars: ✭ 70 (+233.33%)
Mutual labels:  wkhtmltopdf

WkHtmlToPdf for Crystal - PROJECT UNMAINTAINED Build Status

This project is not maintained anymore

If you like it or continue to use it fork it please.



Crystal wrapper for libwkhtmltox C library.

wkhtmltopdf and wkhtmltoimage permit to render HTML into PDF and various image formats using the Qt WebKit rendering engine - see wkhtmltopdf.org

Requirements

  • libwkhtmltox must be installed
  • pkg-config must be available

Installation

  • Add this to your application's shard.yml:
dependencies:
  wkhtmltopdf-crystal:
    github: blocknotes/wkhtmltopdf-crystal
  • If wkhtmltox library is installed but missing for Crystal compiler: copy wkhtmltox.pc (from lib/wkhtmltopdf-crystal folder) in a pkg-config folder (ex. /usr/local/lib/pkgconfig) or set the environment variable PKG_CONFIG_PATH with the path to wkhtmltox.pc before compiling
  • Optinally edit wkhtmltox.pc with the correct path to wkhtmltox (default headers path: /usr/local/include/wkhtmltox)

Usage

HTML to PDF:

require "wkhtmltopdf-crystal"
Wkhtmltopdf::WkPdf.new( "test.pdf" ).convert( "<h3>Just a test</h3>" )

Fetch URL content and convert it to JPG:

require "wkhtmltopdf-crystal"
img = Wkhtmltopdf::WkImage.new
img.set_url "http://www.google.com"
img.set_output "test.jpg"
img.set "quality", "90"
img.convert

Write to buffer (only if no output is specified):

require "wkhtmltopdf-crystal"
pdf = Wkhtmltopdf::WkPdf.new
pdf.convert "<h3>Just a test</h3>"
pdf.object_setting "footer.right", "[page] / [topage]" # Set page counter on footer
unless pdf.buffer.nil?
  puts "PDF buffer size: " + pdf.buffer.try( &.size ).to_s
end

Lib settings (available with set / object_setting methods on wrappers): libwkhtmltox pagesettings

More examples

See examples folder. Includes a Kemal example to print an ECR view in PDF.

Troubleshooting

Invalid memory access

  • If this component needs to be called multiple times it's necessary to initialize the library in the constructor and call deinitialize when all is done. Example:
require "wkhtmltopdf-crystal"
pdf = Wkhtmltopdf::WkPdf.new "", true
at_exit do
  pdf.deinitialize
end

pdf.set_output "test1.pdf"
pdf.convert "<h3>Just a test 1</h3>"

pdf.set_output "test2.pdf"
pdf.convert "<h3>Just a test 2</h3>"

Contributors

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].