{"id":18948871,"url":"https://github.com/pdfkit/pdfkit-clj","last_synced_at":"2025-04-15T23:31:08.090Z","repository":{"id":10243701,"uuid":"12348763","full_name":"pdfkit/pdfkit-clj","owner":"pdfkit","description":"Clojure library for generating PDFs using wkhtmltopdf.","archived":false,"fork":false,"pushed_at":"2017-12-23T03:05:09.000Z","size":16,"stargazers_count":30,"open_issues_count":0,"forks_count":10,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-10-28T13:39:05.851Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Clojure","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"hanakamer/git-lyk2016","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pdfkit.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":"2013-08-24T19:38:38.000Z","updated_at":"2021-11-25T00:36:39.000Z","dependencies_parsed_at":"2022-08-20T13:31:19.743Z","dependency_job_id":null,"html_url":"https://github.com/pdfkit/pdfkit-clj","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pdfkit%2Fpdfkit-clj","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pdfkit%2Fpdfkit-clj/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pdfkit%2Fpdfkit-clj/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pdfkit%2Fpdfkit-clj/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pdfkit","download_url":"https://codeload.github.com/pdfkit/pdfkit-clj/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223688650,"owners_count":17186299,"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-11-08T13:14:54.333Z","updated_at":"2024-11-08T13:14:54.807Z","avatar_url":"https://github.com/pdfkit.png","language":"Clojure","funding_links":[],"categories":["\u003ca name=\"Clojure\"\u003e\u003c/a\u003eClojure"],"sub_categories":[],"readme":"# pdfkit-clj\n\nA Clojure library for generating PDFs from HTML. Uses wkhtmltopdf, and insipred by Ruby's [pdfkit](https://github.com/pdfkit/pdfkit) and [ring-wicked-pdf](https://github.com/gberenfield/ring-wicked-pdf).\n\n### Install\n\nLeiningen installation:\n\n```\n[pdfkit-clj \"0.1.7\"]\n```\n\n### Usage\n\n```clojure\n(require '[pdfkit-clj.core :refer :all])\n(def html \"\u003chtml\u003e\u003cbody\u003eHello!\u003c/body\u003e\u003c/html\u003e\")\n\n(gen-pdf html)\n\n#\u003cFile /tmp/pdfkit-20130821T161228935Z.pdf\u003e\n```\n\nYou can also convert your file to an InputStream, ready for consumption by a browser (helpful for Ring applications):\n\n```clojure\n(as-stream (gen-pdf html))\n\n#\u003cBufferedInputStream java.io.BufferedInputStream@43bda1e0\u003e\n```\n\npdfkit-clj's `gen-pdf` can also accept HTML nodes (e.g. Enlive):\n\n```clojure\n(defsnippet my-snippet\n  ...)\n\n(gen-pdf (my-snippet) ...)\n```\n\n### Options:\n\n```clojure\n(gen-pdf html\n         :asset-path \"public\" ; Relative to your \"resources\" directory\n         :stylesheets [\"stylesheets/main.css\" ; Local file \n                       \"stylesheets/invoices.css\"\n                       \"https://public.yourdomain.com/stylesheets/main.css\"] ; External asset\n         :path \"bin/wkhtmltopdf-amd64\"\n         :margin {:top 20 :right 15 :bottom 50 :left 15}\n         :page-size \"A4\"\n         :tmp \"other/tmp\")\n```\n\n#### Defaults:\n\n```clojure\n:path \"wkhtmltopdf\"\n:tmp \"/tmp\"\n:asset-path \"resources/public\"\n:margin {:top 10 :right 10 :bottom 10 :left 10} ;; in mm\n:page-size \"A4\"\n```\n\n### Images\n\nRight now, pdfkit-clj requires your image tags reference an absolute URL or URI on disk. Simply upload your image to S3, for example, and wkhtmltopdf will have access to it via the file's full URL.\n\n### Heroku\n\nIf you're like me, everything must work on Heroku. Here's the setup:\n\n#### 1. Download wkhtmltopdf to the `./bin` directory of your Leiningen project.\n\n```\nmkdir bin\ncd bin\nwget https://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.9.9-static-amd64.tar.bz2\n```\n\nFinally, Unzip the file and rename it to `wkhtmltopdf`.\n\n#### 2. Call `gen-pdf` with appropriate paths:\n\n```clojure\n(gen-pdf html :path \"bin/wkhtmltopdf\")\n```\n\n### License\n\nCopyright © 2018 Banzai Inc.\n\nDistributed under the Eclipse Public License, the same as Clojure.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpdfkit%2Fpdfkit-clj","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpdfkit%2Fpdfkit-clj","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpdfkit%2Fpdfkit-clj/lists"}