> ## Documentation Index
> Fetch the complete documentation index at: https://pdfitdown.eu/llms.txt
> Use this file to discover all available pages before exploring further.

# Command Line Interface

> PdfItDown offers a modern CLI application to convert your files without ever leaving your terminal

**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](https://github.com/clap-rs/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

```bash theme={null}
# Install from crates.io
cargo install pdfitdown

# With parallelization support
cargo install pdfitdown --features rayon

# Or build from source
git clone https://github.com/AstraBert/PdfItDown.git
cd PdfItDown
cargo install --path crates/pdfitdown
```

## 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:

```bash theme={null}
pdfitdown -i README.md -o README.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:

```bash theme={null}
pdfitdown -i test0.png -i test1.md -o testoutput0.pdf -o testoutput1.pdf
```

* 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:

```bash theme={null}
pdfitdown -d tests/data/testdir
```

* `-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:

```bash theme={null}
pdfitdown -d tests/data/testdir --recursive
```

* `--recursive`: Walks through all subdirectories and converts supported files.

### Prevent overwriting existing files

To skip files that would overwrite an existing PDF:

```bash theme={null}
pdfitdown -i README.md -o README.pdf --no-overwrite
```

* `--no-overwrite`: If the output file already exists, the conversion will fail instead of replacing it.

***

For more details on available options, run:

```bash theme={null}
pdfitdown --help
```
