{"id":24727392,"url":"https://github.com/sayhellogmbh/hello-post-to-pdf","last_synced_at":"2025-07-09T19:38:33.355Z","repository":{"id":78920051,"uuid":"188028931","full_name":"SayHelloGmbH/hello-post-to-pdf","owner":"SayHelloGmbH","description":"WordPress plugin: adds a URL suffix which allows the site visitor to download the selected Post as a PDF.","archived":false,"fork":false,"pushed_at":"2024-04-24T20:18:43.000Z","size":119,"stargazers_count":4,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-03T09:04:25.655Z","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/SayHelloGmbH.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,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2019-05-22T11:55:43.000Z","updated_at":"2021-07-28T21:04:58.000Z","dependencies_parsed_at":"2023-02-25T04:45:24.214Z","dependency_job_id":null,"html_url":"https://github.com/SayHelloGmbH/hello-post-to-pdf","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/SayHelloGmbH/hello-post-to-pdf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SayHelloGmbH%2Fhello-post-to-pdf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SayHelloGmbH%2Fhello-post-to-pdf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SayHelloGmbH%2Fhello-post-to-pdf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SayHelloGmbH%2Fhello-post-to-pdf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SayHelloGmbH","download_url":"https://codeload.github.com/SayHelloGmbH/hello-post-to-pdf/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SayHelloGmbH%2Fhello-post-to-pdf/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264502493,"owners_count":23618619,"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":"2025-01-27T14:58:46.387Z","updated_at":"2025-07-09T19:38:33.114Z","avatar_url":"https://github.com/SayHelloGmbH.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Post To PDF\n\n## Description\n\nAdds a URL suffix which allows the site visitor to download the selected Post as a PDF.\n\nPDF generation occurs using an HTML document formatted with CSS, using [Michael Härtl's PHP code](https://github.com/mikehaertl/phpwkhtmltopdf) and the [wkhtmltopdf](https://wkhtmltopdf.org/) command line tool.\n\n## Usage\n\n* Install the plugin. This will flush the rewrite hooks, so that the custom rewrite endpoint `shpdf` becomes available.\n* Call your Post using the additional URL suffix `shpdf/` (e.g. https://example.com/2019/03/my-post/shpdf/).\n* The plugin contains a default, very simple PDF template. You can override it simply by adding your own template to your Theme or by passing an array of possible template paths.\n\n### Allowed post types\n\nBy default, only Posts of type `post` and `page` are permitted. To allow rendering of other Post Types, use the following hook in your Theme.\n\n```php\nadd_filter('hello-post-to-pdf/allowed-post-types', function(array $allowed_post_types){\n\t$allowed_post_types[] = 'custom-post-type';\n\treturn $allowed_post_types;\n}, 10, 1);\n```\n\n### Template override: predefined file\n\nIf a file named _single-hello-post-to-pdf.php_ exists in the root folder of your Theme, this will be used in preference over the plugin's own template.\n\n### Template override: hook\n\nThe best way to override the rendering with your own template is through the use of the following hook in your Theme.\n\nYou need to always return an array of file paths which are relative to the Theme root folder. Even if you want to use one specific template.\n\nExample:\n\n```php\nadd_filter('hello-post-to-pdf/theme-templates', function(array $template_paths){\n\t$template_paths = [\n\t\t'templates/' .get_post_type($post_id). 'post-to-pdf.php',\n\t\t'templates/post-to-pdf.php'\n\t]\n\treturn $template_paths;\n}, 10, 1);\n```\n\n### Modifying the PDF generation wrapper options\n\nYou can modify the standard set of [PDF wrapper options](https://github.com/mikehaertl/phpwkhtmltopdf#wrapper-options) by using the `hello-post-to-pdf/generation-settings` hook.\n\n```php\nadd_filter('hello-post-to-pdf/generation-settings', function(array $settings){\n\treturn array_merge($settings, [\n\t\t'margin-top' =\u003e 20,\n\t\t'margin-bottom' =\u003e 20\n\t]);\n}, 10, 1);\n```\n\n## Changelog\n\n### 2.0.1\n\n* Fix security warning advised by Github.\n\n### 2.0.0\n\n* Improves previous code.\n* Adds safety checks.\n* Adds `hello-post-to-pdf/generation-settings` filter.\n* Extends README and provides licensing information.\n\n### 1.1.0\n\n* Fixes for Coding Standards.\n* More complete config example.\n* Adds language suffix to filename if WPML is active.\n\n### 1.0.1\n\n* Fix allowed post types sequencing.\n\n### 1.0.0\n\n* Add simple template.\n* Add hooks.\n* Add PDF rendering.\n* Add usage instructions.\n\n### 0.0.1\n\n* Initial development version.\n\n## Contributors\n\n* Say Hello GmbH - Mark Howells-Mead (mark@sayhello.ch)\n\n## License\n\n* [phpwkhtmltopdf by Mike Härtl](https://github.com/mikehaertl/phpwkhtmltopdf/) is provided under the terms of the [MIT](https://github.com/mikehaertl/phpwkhtmltopdf/blob/master/LICENSE) license.\n* The [wkhtmltopdf](https://github.com/wkhtmltopdf/wkhtmltopdf) command line tool is provided under the terms of the GPL v3 license.\n* The remaining code in the plugin is provided under the terms of the GPL v3 license.\n\nUse of this code provides and implies no guarantee.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsayhellogmbh%2Fhello-post-to-pdf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsayhellogmbh%2Fhello-post-to-pdf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsayhellogmbh%2Fhello-post-to-pdf/lists"}