{"id":25546849,"url":"https://github.com/sectasy0/zhtml2pdf","last_synced_at":"2025-09-09T21:32:32.055Z","repository":{"id":276470386,"uuid":"929099665","full_name":"sectasy0/zhtml2pdf","owner":"sectasy0","description":"WebKit2-based HTML-to-PDF converter with simple API","archived":false,"fork":false,"pushed_at":"2025-02-20T18:15:00.000Z","size":28,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-30T12:31:32.728Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"wtfpl","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sectasy0.png","metadata":{"files":{"readme":"README.md","changelog":null,"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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-07T20:04:56.000Z","updated_at":"2025-02-16T07:42:54.000Z","dependencies_parsed_at":"2025-02-16T08:18:46.552Z","dependency_job_id":null,"html_url":"https://github.com/sectasy0/zhtml2pdf","commit_stats":null,"previous_names":["sectasy0/zhtml2pdf"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sectasy0/zhtml2pdf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sectasy0%2Fzhtml2pdf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sectasy0%2Fzhtml2pdf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sectasy0%2Fzhtml2pdf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sectasy0%2Fzhtml2pdf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sectasy0","download_url":"https://codeload.github.com/sectasy0/zhtml2pdf/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sectasy0%2Fzhtml2pdf/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274366267,"owners_count":25272293,"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","status":"online","status_checked_at":"2025-09-09T02:00:10.223Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2025-02-20T09:18:11.917Z","updated_at":"2025-09-09T21:32:31.989Z","avatar_url":"https://github.com/sectasy0.png","language":"Zig","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `libzhtml2pdf` - WebKit2-based HTML-to-PDF Converter with Simple API\r\n\r\n`libzhtml2pdf` is a C-based library designed for converting HTML documents into PDF format. This library uses **WebKit2GTK-4.0** as its rendering engine for HTML content, allowing you to create high-quality PDFs from HTML with ease. It offers a simple API that can be integrated into various applications and projects.\r\n\r\n---\r\n\r\n## Prerequisites\r\n\r\nBefore compiling `libzhtml2pdf`, you need to ensure that the following dependencies are installed on your system:\r\n\r\n### 1. **WebKit2GTK-4.0**\r\n   - **Version**: `4.0` (or later)\r\n\r\n### 2. **Zig Compiler**\r\n   - **Version**: `0.13` (or later)\r\n\r\n---\r\n\r\n## Building `libzhtml2pdf`\r\n\r\nOnce you have the prerequisites installed, you can proceed to compile `libzhtml2pdf` on your system. Follow these steps:\r\n\r\n1. **Clone the Repository**:\r\n\r\n   First, clone the `libzhtml2pdf` repository from GitHub or another source:\r\n   ```bash\r\n   git clone https://github.com/your-repository/libzhtml2pdf.git\r\n   cd libzhtml2pdf\r\n   build zig\r\n   ```\r\n\r\n   After successfully compilation it will produce static library to `zig-out/lib`\r\n\r\n\r\n## CAPI Example usage\r\n\r\n```c\r\n#include \"zhtml2pdf.h\"\r\n\r\nint main() {\r\n    init_zhtml2pdf();\r\n\r\n    const char* html_content = \"\u003chtml\u003e\u003cbody\u003e\u003ch1\u003eSample PDF\u003c/h1\u003e\u003cp\u003eThis is a test PDF generated from HTML.\u003c/p\u003e\u003c/body\u003e\u003c/html\u003e\";\r\n\r\n    unsigned char* pdf_data = NULL;\r\n    int size = zhtml2pdf_convert(html_content);\r\n    if (size \u003c 0) {\r\n        printf(\"Failed to convert html to pdf!\\n\");\r\n        return -1;\r\n    }\r\n\r\n    printf(\"PDF successfully created!\\n\");\r\n    // Do whatever you want with pdf, output is in base64\r\n\r\n    zhtml2pdf_free(pdf_data);\r\n    deinit_zhtml2pdf();\r\n\r\n    return 0;\r\n}\r\n\r\n```\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsectasy0%2Fzhtml2pdf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsectasy0%2Fzhtml2pdf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsectasy0%2Fzhtml2pdf/lists"}