# mdpdf
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
Python command line application to convert Markdown to PDF.
## Project Features
* Bare-bones: Only supports basic [CommonMark](https://commonmark.org/)
* "One-size-fits-all" style: Left-aligned, PDF-base14 fonts. Reasonably pretty, but if you want more control, see alternatives below.
* Headings are transformed to PDF bookmarks.
* File links are transformed into attachments with PDF links.
* Images links are transformed into embedded images with optional captions and width specifier.
* Minimal requirements
- [commonmark](https://pypi.org/project/commonmark/)
- [PyMuMDF](https://pypi.org/project/PyMuPDF/)
- [click](https://pypi.org/project/click/)
## Alternatives
There are several projects that can be considered if you need something with more features. Of note:
* [pandoc](https://pandoc.org/) + [latex](https://www.latex-project.org/)
* [rst2pdf](https://github.com/rst2pdf/rst2pdf)
* [rinohtype](https://github.com/brechtm/rinohtype)
## Installation
$ pip install mdpdf
## Usage
$ mdpdf [OPTIONS] [INPUTS]...
### Options:
- `-o, --output FILE ` Destination for file output. [required]
- `-h, --header <template> ` Sets the header template.
- `-f, --footer <template> ` Footer template.
- `-t, --title TEXT ` PDF title.
- `-s, --subject TEXT ` PDF subject.
- `-a, --author TEXT ` PDF author.
- `-k, --keywords TEXT ` PDF keywords.
- `-p, --paper [letter|A4] ` Paper size (default letter).
- `--version ` Show the version and exit.
- `--help ` Show this message and exit.
### Templates:
The `<template>` is a quoted, comma-
delimited string, containing the left, centre,
and right, fields for the header/footer. Format is `"[left],[middle],[right]"`.
Possible values to put here are:
- Empty string
- Arbitrary text
- Special variables:
- `{page}` current page number
- `{header}` current top-level body text heading
- `{date}` current date
Example:
$ mdpdf -o article.pdf article.md
$ mdpdf -o article.pdf --footer "{date},{heading},{page}" article.md
Raw data
{
"_id": null,
"home_page": "https://github.com/normanlorrain/mdpdf",
"name": "mdpdf",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "",
"author": "Norman Lorrain",
"author_email": "normanlorrain@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/99/4f/90d6dd1276e9726f59c4efccb12782eef2b125610f5a7f766938d1880316/mdpdf-0.0.18.tar.gz",
"platform": null,
"description": "# mdpdf\r\n\r\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\r\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\r\n\r\nPython command line application to convert Markdown to PDF.\r\n\r\n## Project Features\r\n\r\n* Bare-bones: Only supports basic [CommonMark](https://commonmark.org/)\r\n* \"One-size-fits-all\" style: Left-aligned, PDF-base14 fonts. Reasonably pretty, but if you want more control, see alternatives below.\r\n* Headings are transformed to PDF bookmarks.\r\n* File links are transformed into attachments with PDF links.\r\n* Images links are transformed into embedded images with optional captions and width specifier.\r\n* Minimal requirements\r\n - [commonmark](https://pypi.org/project/commonmark/)\r\n - [PyMuMDF](https://pypi.org/project/PyMuPDF/)\r\n - [click](https://pypi.org/project/click/)\r\n\r\n\r\n## Alternatives\r\nThere are several projects that can be considered if you need something with more features. Of note: \r\n* [pandoc](https://pandoc.org/) + [latex](https://www.latex-project.org/)\r\n* [rst2pdf](https://github.com/rst2pdf/rst2pdf)\r\n* [rinohtype](https://github.com/brechtm/rinohtype)\r\n\r\n## Installation\r\n\r\n $ pip install mdpdf\r\n\r\n## Usage\r\n $ mdpdf [OPTIONS] [INPUTS]...\r\n\r\n### Options:\r\n- `-o, --output FILE ` Destination for file output. [required]\r\n- `-h, --header <template> ` Sets the header template.\r\n- `-f, --footer <template> ` Footer template.\r\n- `-t, --title TEXT ` PDF title.\r\n- `-s, --subject TEXT ` PDF subject.\r\n- `-a, --author TEXT ` PDF author.\r\n- `-k, --keywords TEXT ` PDF keywords.\r\n- `-p, --paper [letter|A4] ` Paper size (default letter).\r\n- `--version ` Show the version and exit.\r\n- `--help ` Show this message and exit.\r\n\r\n### Templates:\r\n\r\nThe `<template>` is a quoted, comma-\r\n delimited string, containing the left, centre,\r\n and right, fields for the header/footer. Format is `\"[left],[middle],[right]\"`.\r\n\r\nPossible values to put here are:\r\n- Empty string\r\n- Arbitrary text\r\n- Special variables:\r\n - `{page}` current page number\r\n - `{header}` current top-level body text heading\r\n - `{date}` current date\r\n\r\nExample:\r\n\r\n $ mdpdf -o article.pdf article.md\r\n\r\n $ mdpdf -o article.pdf --footer \"{date},{heading},{page}\" article.md\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python command line application to convert Markdown to PDF.",
"version": "0.0.18",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "81d4d69d262eb7cf9c3cab221fd92a7f",
"sha256": "be135cfca4a0c4fde86004670b06780744432671c3272e4ff064790e2e572665"
},
"downloads": -1,
"filename": "mdpdf-0.0.18-py3-none-any.whl",
"has_sig": false,
"md5_digest": "81d4d69d262eb7cf9c3cab221fd92a7f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 14760,
"upload_time": "2022-11-14T15:35:14",
"upload_time_iso_8601": "2022-11-14T15:35:14.182886Z",
"url": "https://files.pythonhosted.org/packages/ed/2a/1be7477288707b4cd3e25a53c05c87adc62fb8658cfbb3178d39fd5172d1/mdpdf-0.0.18-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "b98529567405837eb1f1fe989d1f75c9",
"sha256": "2465e47ef772554f09662ce359ac5924eddce1564cb4df685f7bf3ca8d0e6a7c"
},
"downloads": -1,
"filename": "mdpdf-0.0.18.tar.gz",
"has_sig": false,
"md5_digest": "b98529567405837eb1f1fe989d1f75c9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 13974,
"upload_time": "2022-11-14T15:35:15",
"upload_time_iso_8601": "2022-11-14T15:35:15.878751Z",
"url": "https://files.pythonhosted.org/packages/99/4f/90d6dd1276e9726f59c4efccb12782eef2b125610f5a7f766938d1880316/mdpdf-0.0.18.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-11-14 15:35:15",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "normanlorrain",
"github_project": "mdpdf",
"travis_ci": false,
"coveralls": true,
"github_actions": false,
"requirements": [
{
"name": "build",
"specs": []
},
{
"name": "twine",
"specs": []
},
{
"name": "flake8",
"specs": []
},
{
"name": "black",
"specs": []
},
{
"name": "pytest",
"specs": []
}
],
"lcname": "mdpdf"
}