{"id":36977888,"url":"https://github.com/ivanpepelko/php-wkhtmltopdf","last_synced_at":"2026-01-13T22:47:14.275Z","repository":{"id":56994795,"uuid":"66348791","full_name":"ivanpepelko/php-wkhtmltopdf","owner":"ivanpepelko","description":"wkhtmltopdf php bindings","archived":true,"fork":false,"pushed_at":"2016-08-23T11:20:24.000Z","size":114,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-15T21:08:02.276Z","etag":null,"topics":["php","php-wkhtmltopdf","webkit","wkhtmltopdf"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ivanpepelko.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-08-23T08:32:14.000Z","updated_at":"2024-11-07T07:36:51.000Z","dependencies_parsed_at":"2022-08-21T13:20:36.776Z","dependency_job_id":null,"html_url":"https://github.com/ivanpepelko/php-wkhtmltopdf","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/ivanpepelko/php-wkhtmltopdf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanpepelko%2Fphp-wkhtmltopdf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanpepelko%2Fphp-wkhtmltopdf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanpepelko%2Fphp-wkhtmltopdf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanpepelko%2Fphp-wkhtmltopdf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ivanpepelko","download_url":"https://codeload.github.com/ivanpepelko/php-wkhtmltopdf/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanpepelko%2Fphp-wkhtmltopdf/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28403023,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T14:36:09.778Z","status":"ssl_error","status_checked_at":"2026-01-13T14:35:19.697Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["php","php-wkhtmltopdf","webkit","wkhtmltopdf"],"created_at":"2026-01-13T22:47:14.178Z","updated_at":"2026-01-13T22:47:14.266Z","avatar_url":"https://github.com/ivanpepelko.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"## What is this?\nBasically: wkhtmltopdf php bindings.\n\n## Installation?\nStraightforward:\n```\ncomposer require ivanpepelko/php-wkhtmltopdf\n```\n\n## Get it running...\n...easily:\n```php\n\u003c?php\n\nuse WkHtmlToPdf\\WkHtmlToPdf;\n\nrequire_once 'vendor/autoload.php';\n\n$pdf = new WkHtmlToPdf('/usr/local/bin/wkhtmltopdf');\n$pdf-\u003esetInputPath('html/invoice.html')\n    -\u003esetOutputPath('pdf/invoice.pdf')\n    -\u003euseRecommendedOptions()\n    -\u003econvert()\n;\n```\nor:\n```php\n\u003c?php\n\nuse WkHtmlToPdf\\WkHtmlToPdf;\n\nrequire_once 'vendor/autoload.php';\n\n$pdf = new WkHtmlToPdf('/usr/local/bin/wkhtmltopdf');\n\nheader(\"Content-type:application/pdf\");\nheader(\"Content-Disposition:attachment;filename='hello.pdf'\");\n\necho $pdf-\u003esetInputHtml('\n        \u003c!DOCTYPE html\u003e\n            \u003chtml\u003e\n                \u003chead\u003e\u003ctitle\u003eHello world!\u003c/title\u003e\u003c/head\u003e\n                \u003cbody\u003e\u003ch1\u003eHello\u003c/h1\u003e\u003cp\u003eworld!\u003c/p\u003e\u003c/body\u003e\n            \u003c/html\u003e\n        \u003c/html\u003e\n        ')\n        -\u003euseRecommendedOptions()\n        -\u003econvert()\n        -\u003eoutput()\n;\n```\nor something like that.\n\nThe first parameter passed to constructor is path to wkhtmltopdf binary. I recommend these (wkhtmltopdf with patched qt):\n* [h4cc/wkhtmltopdf-amd64](https://packagist.org/packages/h4cc/wkhtmltopdf-amd64)\n* [h4cc/wkhtmltopdf-i386](https://packagist.org/packages/h4cc/wkhtmltopdf-i386)\n\n\n## Other stuff\n[Full docs](https://ivanpepelko.github.io/php-wkhtmltopdf/)\n\n### Headers \u0026 Footers\n```php\n\u003c?php\n$pdf-\u003esetFooterCenterText($text)\n    -\u003esetHeaderLeftText($text)\n    -\u003esetFooterSpacing($spacing)\n    -\u003esetHeaderFontName($name)\n    -\u003esetFooterHtml($html); // etc, you get the point\n```\n\nIn header and footer text string the following variables will be substituted:\n* `[page]`       Replaced by the number of the pages currently being printed\n* `[frompage]`   Replaced by the number of the first page to be printed\n* `[topage]`     Replaced by the number of the last page to be printed\n* `[webpage]`    Replaced by the URL of the page being printed\n* `[section]`    Replaced by the name of the current section\n* `[subsection]` Replaced by the name of the current subsection\n* `[date]`       Replaced by the current date in system local format\n* `[isodate]`    Replaced by the current date in ISO 8601 extended format\n* `[time]`       Replaced by the current time in system local format\n* `[title]`      Replaced by the title of the of the current page object\n* `[doctitle]`   Replaced by the title of the output document\n* `[sitepage]`   Replaced by the number of the page in the current site being converted\n* `[sitepages]`  Replaced by the number of pages in the current site being converted\n\nAlso, you are able to define additional variables with `addHeaderFooterVar()` or `addHeaderFooterVars()` methods:\n```php\n\u003c?php\n$pdf-\u003eaddHeaderFooterVar('var1', 'value2')\n\t-\u003eaddHeaderFooterVars(['var3' =\u003e 'value4']);\n```\n**Note:** this will not work with html (`setHeaderHtml()` or `setFooterHtml()`).\n\n**Note 2:** wkhtmltopdf has an issue with html headers and footer where it adds them gray background ([issue#2416](https://github.com/wkhtmltopdf/wkhtmltopdf/issues/2416) - to be fixed in 0.12.4).\n\n### Caching:\n```php\n\u003c?php\n$pdf-\u003esetCacheDir($dir);\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivanpepelko%2Fphp-wkhtmltopdf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fivanpepelko%2Fphp-wkhtmltopdf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivanpepelko%2Fphp-wkhtmltopdf/lists"}