{"id":15922138,"url":"https://github.com/boundstate/yii2-htmlconverter","last_synced_at":"2025-07-01T03:34:25.871Z","repository":{"id":32068381,"uuid":"35640246","full_name":"boundstate/yii2-htmlconverter","owner":"boundstate","description":null,"archived":false,"fork":false,"pushed_at":"2015-05-14T22:28:24.000Z","size":116,"stargazers_count":9,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-19T03:41:33.285Z","etag":null,"topics":[],"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/boundstate.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":"2015-05-14T22:26:53.000Z","updated_at":"2021-05-05T15:28:46.000Z","dependencies_parsed_at":"2022-09-11T07:40:52.283Z","dependency_job_id":null,"html_url":"https://github.com/boundstate/yii2-htmlconverter","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boundstate%2Fyii2-htmlconverter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boundstate%2Fyii2-htmlconverter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boundstate%2Fyii2-htmlconverter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boundstate%2Fyii2-htmlconverter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/boundstate","download_url":"https://codeload.github.com/boundstate/yii2-htmlconverter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245261060,"owners_count":20586515,"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":[],"created_at":"2024-10-06T20:05:24.502Z","updated_at":"2025-03-24T11:32:25.251Z","avatar_url":"https://github.com/boundstate.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# yii2-htmlconverter\n\n  Extension for the Yii2 framework that converts HTML to PDF or images using [wkhtmltopdf].\n\n## Installation\n\n  This extensions relies on `wkhtmltopdf`.  Installation insructions are provided on the [wkhtmltopdf website] [wkhtmltopdf].\n\n  The preferred way to install this extension is through [composer](http://getcomposer.org/download/).\n\n  Either run\n\n    php composer.phar require --prefer-dist boundstate/yii2-htmlconverter \"*\"\n\n  or add\n\n    \"boundstate/yii2-htmlconverter\": \"*\"\n\n  to the require section of your `composer.json` file.\n\n## Usage\n\n  Setup the components in your config:\n\n    'htmlToPdf' =\u003e [\n        'class' =\u003e 'boundstate\\htmlconverter\\HtmlToPdfConverter',\n        'bin' =\u003e '/usr/bin/wkhtmltopdf',\n        // global wkhtmltopdf command line options\n        // (see http://wkhtmltopdf.org/usage/wkhtmltopdf.txt)\n        'options' =\u003e [\n            'print-media-type',\n            'disable-smart-shrinking',\n            'no-outline',\n            'page-size' =\u003e 'letter',\n            'load-error-handling' =\u003e 'ignore',\n            'load-media-error-handling' =\u003e 'ignore'\n        ],\n    ],\n    'htmlToImage' =\u003e [\n        'class' =\u003e 'boundstate\\htmlconverter\\HtmlToImageConverter',\n        'bin' =\u003e '/usr/bin/wkhtmltoimage',\n    ],\n    'response' =\u003e [\n        'formatters' =\u003e [\n            'pdf' =\u003e [\n                'class' =\u003e 'boundstate\\htmlconverter\\PdfResponseFormatter',\n                // Set a filename to download the response as an attachments (instead of displaying in browser)\n                'filename' =\u003e 'attachment.pdf'\n            ],\n            'image' =\u003e [\n                'class' =\u003e 'boundstate\\htmlconverter\\ImageResponseFormatter',\n            ],\n        ]\n    ],\n\n  Now you can format a response as a PDF:\n\n    Yii::$app-\u003eresponse-\u003eformat = 'pdf';\n\n  Or format a response as an image:\n\n    Yii::$app-\u003eresponse-\u003eformat = 'image';\n\n  You can also manually generate a PDF from HTML:\n\n    $html = $this-\u003erender('hello-word');\n    $header = $this-\u003erender('hello-world-header');\n    $pdf = Yii::$app-\u003ehtmlToPdf-\u003econvert($html, ['page-size' =\u003e 'A4', 'header-html' =\u003e $header]);\n\n  Or manually generate an image from HTML:\n\n    $html = $this-\u003erender('hello-word');\n    $pdf = Yii::$app-\u003ehtmlToImage-\u003econvert($html);\n\n[wkhtmltopdf]: http://wkhtmltopdf.org/","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboundstate%2Fyii2-htmlconverter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fboundstate%2Fyii2-htmlconverter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboundstate%2Fyii2-htmlconverter/lists"}