Skip to main content
PdfItDown comes with a command line application from which you can comfortably convert all your files without actually touching a single line of code. Based on clap, the CLI is designed to offer a seamless experience, with almost as much control of inputs and outputs as if you were to write the flow in Rust: it is then the perfect choice if you want an easy and intuitive approach to file conversion, without getting your hands dirty with code.

Installation

Usage

Below are some example commands for using PdfItDown from the terminal, along with explanations for each option and scenario:

Convert a single file to PDF

Use this command to convert a single file (e.g., a Markdown file) to PDF:
  • -i README.md: Specifies the input file to convert.
  • -o README.pdf: Sets the output PDF file path.

Convert multiple files with custom output paths

You can convert several files at once, specifying a matching output PDF for each input:
  • Multiple -i flags: List each input file you want to convert.
  • Multiple -o flags: Provide an output path for each input file, in the same order.

Bulk convert all files in a directory

To convert every file in a directory to PDF in one go:
  • -d tests/data/testdir: Specifies the directory containing files to convert. All supported files in this directory will be converted to PDF.

Recursive directory conversion

To recursively convert all files in a directory and its subdirectories:
  • --recursive: Walks through all subdirectories and converts supported files.

Prevent overwriting existing files

To skip files that would overwrite an existing PDF:
  • --no-overwrite: If the output file already exists, the conversion will fail instead of replacing it.

For more details on available options, run: