{"id":13856744,"url":"https://github.com/ljpengelen/markdown-to-pdf","last_synced_at":"2025-10-18T16:48:17.173Z","repository":{"id":43223803,"uuid":"159975277","full_name":"ljpengelen/markdown-to-pdf","owner":"ljpengelen","description":"A script to convert Markdown to PDF","archived":false,"fork":false,"pushed_at":"2025-02-18T12:11:47.000Z","size":1354,"stargazers_count":74,"open_issues_count":0,"forks_count":24,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-30T19:05:38.824Z","etag":null,"topics":["css","markdown","pdf-generation","python"],"latest_commit_sha":null,"homepage":"https://www.theguild.nl/good-looking-pdfs-with-css-for-paged-media-and-markdown/","language":"Python","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/ljpengelen.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,"publiccode":null,"codemeta":null}},"created_at":"2018-12-01T18:33:51.000Z","updated_at":"2025-03-19T20:23:46.000Z","dependencies_parsed_at":"2024-03-15T10:27:09.292Z","dependency_job_id":"72896797-e1c1-4c67-b327-9e6641ded0ee","html_url":"https://github.com/ljpengelen/markdown-to-pdf","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/ljpengelen%2Fmarkdown-to-pdf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ljpengelen%2Fmarkdown-to-pdf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ljpengelen%2Fmarkdown-to-pdf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ljpengelen%2Fmarkdown-to-pdf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ljpengelen","download_url":"https://codeload.github.com/ljpengelen/markdown-to-pdf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247543591,"owners_count":20955865,"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":["css","markdown","pdf-generation","python"],"created_at":"2024-08-05T03:01:11.488Z","updated_at":"2025-10-18T16:48:17.066Z","avatar_url":"https://github.com/ljpengelen.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# Markdown to PDF\n\nThis repository contains a simple script that converts Markdown and CSS into PDF documents.\nThe heavy lifting is done by [Python-Markdown](https://python-markdown.github.io/), a tool for generating HTML from Markdown, and [WeasyPrint](https://weasyprint.org), a tool for generating PDF documents from HTML and CSS.\nWith this script, [my CV in Markdown](https://github.com/ljpengelen/markdown-to-pdf/blob/master/examples/cv.md) is converted into [a PDF document](https://github.com/ljpengelen/markdown-to-pdf/blob/master/examples/cv.pdf).\n\n## Getting Started\n\n1. Install [pyenv](https://github.com/pyenv/pyenv), a tool for managing [Python](https://www.python.org/) versions.\n1. The file `.python-version` in the root folder specifies the Python version required by the conversion script.\n  Navigate to the root folder and execute `pyenv install` to install this Python version.\n1. Install `cairo`, `pango`, and `gdk-pixbuf`.\n  On macOS, these tools can be installed with `brew`.\n1. Install [pipenv](https://pypi.python.org/pypi/pipenv) by executing `pip install pipenv`.\n  There's an [issue related to language and region settings](https://github.com/kennethreitz/pipenv/issues/538) that you might run into on Macs, but it's easy to resolve.\n1. Create a new virtual environment with all dependencies by executing `pipenv install --dev --ignore-pipfile`.\n  The flag `ignore-pipfile` is used to indicate that the exact versions of the dependencies as specified in `Pipfile.lock` should be installed.\n  The flag `dev` is used to also install development dependencies.\n\n## Activating the virtual environment\n\nBefore executing any of the commands below, you need to activate the virtual environment.\nYou can do so by executing `pipenv shell`.\nYour command prompt should now indicate that you've activated the virtual environment.\nIt can be deactivated by executing `exit`.\n\n## Generating PDFs\n\nThe `examples` folder contains a CV and a quotation.\n\n* Execute `python md2pdf.py convert examples/cv.md examples/cv.css` to generate a PDF version of the CV.\n* Execute `python md2pdf.py convert examples/quotation.md examples/quotation.css` to generate a PDF version of the quotation.\n\nWhen writing or designing documents, you can use `python md2pdf.py watch \u003cdocument_name\u003e.md \u003cstylesheet_name\u003e.css`.\nThis will watch the given files and generate new output when they change.\nBoth an HTML document and a PDF document are generated.\nThe HTML document is generated because it's convenient to be able to play around with the CSS in a browser.\n\n## CSS for print\n\nIf you want to design your own documents, take a look at [designing for print with CSS](https://www.smashingmagazine.com/2015/01/designing-for-print-with-css/) by Rachel Andrew.\n\n## Docker\n\nIf you don't want to install Python and the rest of the tools directly, you can also run the conversion script from within a Docker container.\nFirst, execute `docker build -t md2pdf .` to build an image.\nAfterwards, execute `docker run -v $(pwd)/examples:/app/examples md2pdf python3 md2pdf.py convert examples/cv.md examples/cv.css` to generate a PDF version of the example CV.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fljpengelen%2Fmarkdown-to-pdf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fljpengelen%2Fmarkdown-to-pdf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fljpengelen%2Fmarkdown-to-pdf/lists"}