← 返回命令列表

Linux command

mdpdf 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Convert

mdpdf [input.md] -o [output.pdf]

Convert

mdpdf [input.md] -o [output.pdf] --paper [A4]

Set PDF metadata

mdpdf [input.md] -o [output.pdf] --title "[title]" --author "[author]"

Add a header

mdpdf [input.md] -o [output.pdf] --header "[header text]"

Add a footer

mdpdf [input.md] -o [output.pdf] --footer "[footer text]"

Convert multiple

mdpdf [file1.md] [file2.md] -o [combined.pdf]

说明

mdpdf is a command-line application for converting Markdown files to PDF. It supports CommonMark markdown syntax and produces clean, left-aligned PDF output using base-14 PDF fonts. The tool converts Markdown headings into PDF bookmarks for easy navigation, transforms file links into PDF attachments, and embeds images with optional captions and width specifications. Multiple input files can be combined into a single output PDF. mdpdf is designed for simplicity and minimal dependencies, relying on commonmark for Markdown parsing, PyMuPDF for PDF generation, and click for the command-line interface.

参数

-o, --output _FILE_
Destination path for the PDF output (required)
-h, --header _template_
Set a header template for each page
-f, --footer _template_
Set a footer template for each page
-t, --title _TEXT_
PDF title metadata
-s, --subject _TEXT_
PDF subject metadata
-a, --author _TEXT_
PDF author metadata
-k, --keywords _TEXT_
PDF keywords metadata
-p, --paper _letter|A4_
Paper size (default: letter)
--version
Display version information
--help
Show help message

FAQ

What is the mdpdf command used for?

mdpdf is a command-line application for converting Markdown files to PDF. It supports CommonMark markdown syntax and produces clean, left-aligned PDF output using base-14 PDF fonts. The tool converts Markdown headings into PDF bookmarks for easy navigation, transforms file links into PDF attachments, and embeds images with optional captions and width specifications. Multiple input files can be combined into a single output PDF. mdpdf is designed for simplicity and minimal dependencies, relying on commonmark for Markdown parsing, PyMuPDF for PDF generation, and click for the command-line interface.

How do I run a basic mdpdf example?

Run `mdpdf [input.md] -o [output.pdf]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -o, --output _FILE_ do in mdpdf?

Destination path for the PDF output (required)