{"id":13482866,"url":"https://github.com/blocknotes/wkhtmltopdf-crystal","last_synced_at":"2025-03-27T13:32:59.122Z","repository":{"id":68600565,"uuid":"77627971","full_name":"blocknotes/wkhtmltopdf-crystal","owner":"blocknotes","description":"Crystal C bindings and wrapper for libwkhtmltox library","archived":true,"fork":false,"pushed_at":"2020-04-12T15:59:40.000Z","size":84,"stargazers_count":22,"open_issues_count":0,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-08-01T17:33:07.756Z","etag":null,"topics":["crystal","wkhtmltopdf","wkhtmltox"],"latest_commit_sha":null,"homepage":"","language":"Crystal","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/blocknotes.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-12-29T17:17:13.000Z","updated_at":"2023-06-19T08:45:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"fa38ec7e-1cc5-4b0b-9a75-82e7cf4da950","html_url":"https://github.com/blocknotes/wkhtmltopdf-crystal","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blocknotes%2Fwkhtmltopdf-crystal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blocknotes%2Fwkhtmltopdf-crystal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blocknotes%2Fwkhtmltopdf-crystal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blocknotes%2Fwkhtmltopdf-crystal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/blocknotes","download_url":"https://codeload.github.com/blocknotes/wkhtmltopdf-crystal/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222262571,"owners_count":16957605,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["crystal","wkhtmltopdf","wkhtmltox"],"created_at":"2024-07-31T17:01:06.208Z","updated_at":"2024-10-30T16:31:49.764Z","avatar_url":"https://github.com/blocknotes.png","language":"Crystal","funding_links":[],"categories":["Converters"],"sub_categories":[],"readme":"# WkHtmlToPdf for Crystal - PROJECT UNMAINTAINED [![Build Status](https://travis-ci.org/blocknotes/wkhtmltopdf-crystal.svg)](https://travis-ci.org/blocknotes/wkhtmltopdf-crystal)\n\n\u003e *This project is not maintained anymore*\n\u003e\n\u003e *If you like it or continue to use it fork it please.*\n\n* * *\n* * *\n\nCrystal wrapper for libwkhtmltox C library.\n\n*wkhtmltopdf* and *wkhtmltoimage* permit to render HTML into PDF and various image formats using the Qt WebKit rendering engine - see [wkhtmltopdf.org](http://wkhtmltopdf.org)\n\n## Requirements\n\n- *libwkhtmltox* must be installed\n- *pkg-config* must be available\n\n## Installation\n\n- Add this to your application's `shard.yml`:\n\n```yml\ndependencies:\n  wkhtmltopdf-crystal:\n    github: blocknotes/wkhtmltopdf-crystal\n```\n\n- 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\n- Optinally edit *wkhtmltox.pc* with the correct path to wkhtmltox (default headers path: /usr/local/include/wkhtmltox)\n\n## Usage\n\nHTML to PDF:\n\n```ruby\nrequire \"wkhtmltopdf-crystal\"\nWkhtmltopdf::WkPdf.new( \"test.pdf\" ).convert( \"\u003ch3\u003eJust a test\u003c/h3\u003e\" )\n```\n\nFetch URL content and convert it to JPG:\n\n```ruby\nrequire \"wkhtmltopdf-crystal\"\nimg = Wkhtmltopdf::WkImage.new\nimg.set_url \"http://www.google.com\"\nimg.set_output \"test.jpg\"\nimg.set \"quality\", \"90\"\nimg.convert\n```\n\nWrite to buffer (only if no output is specified):\n\n```ruby\nrequire \"wkhtmltopdf-crystal\"\npdf = Wkhtmltopdf::WkPdf.new\npdf.convert \"\u003ch3\u003eJust a test\u003c/h3\u003e\"\npdf.object_setting \"footer.right\", \"[page] / [topage]\" # Set page counter on footer\nunless pdf.buffer.nil?\n  puts \"PDF buffer size: \" + pdf.buffer.try( \u0026.size ).to_s\nend\n```\n\nLib settings (available with `set` / `object_setting` methods on wrappers): [libwkhtmltox pagesettings](http://wkhtmltopdf.org/libwkhtmltox/pagesettings.html)\n\n## More examples\n\nSee [examples](https://github.com/blocknotes/wkhtmltopdf-crystal/tree/master/examples) folder. Includes a Kemal example to print an ECR view in PDF.\n\n## Troubleshooting\n\n#### Invalid memory access\n\n- 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.\nExample:\n\n```ruby\nrequire \"wkhtmltopdf-crystal\"\npdf = Wkhtmltopdf::WkPdf.new \"\", true\nat_exit do\n  pdf.deinitialize\nend\n\npdf.set_output \"test1.pdf\"\npdf.convert \"\u003ch3\u003eJust a test 1\u003c/h3\u003e\"\n\npdf.set_output \"test2.pdf\"\npdf.convert \"\u003ch3\u003eJust a test 2\u003c/h3\u003e\"\n```\n\n## Contributors\n\n- [Mattia Roccoberton](http://blocknot.es) - creator, maintainer\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblocknotes%2Fwkhtmltopdf-crystal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblocknotes%2Fwkhtmltopdf-crystal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblocknotes%2Fwkhtmltopdf-crystal/lists"}