# Command Line Interface Merge documents, split them, and extract or remove pages straight from the terminal with the groupdocs-merger command that installs with the package. No Python script required. Installing the `groupdocs-merger-net` package also puts a `groupdocs-merger` command on your `PATH`. It runs the Python API for the jobs where a script is more than you need: shell pipelines, Make rules, CI steps and one-off tasks. The command arrived with version 26.12. ## Prerequisites The command ships inside the package, so nothing else needs installing. Install `groupdocs-merger-net` as described in [Installation]({{< ref "merger/python-net/getting-started/installation.md" >}}), then check that the command is available: ```bash groupdocs-merger --version ``` ```text groupdocs-merger 26.12.0 ``` {{< alert style="info" >}} If the shell does not find `groupdocs-merger`, the package's script folder is not on your `PATH`. `python -m groupdocs.merger` runs the same command, for example `python -m groupdocs.merger --version`. {{< /alert >}} ## Sample files The examples on this page use these sample files. Download them into one folder and run the commands from there: - [north-pier-report.pdf](https://docs.groupdocs.com/merger/python-net/_sample_files/getting-started/command-line-interface/north-pier-report.pdf): a report of three pages. - [cold-store-audit.pdf](https://docs.groupdocs.com/merger/python-net/_sample_files/getting-started/command-line-interface/cold-store-audit.pdf): an audit of two pages. - [board-pack.pdf](https://docs.groupdocs.com/merger/python-net/_sample_files/getting-started/command-line-interface/board-pack.pdf): six pages, each headed by its reference, BP-1 to BP-6. - [budget-2027-pss.pdf](https://docs.groupdocs.com/merger/python-net/_sample_files/getting-started/command-line-interface/budget-2027-pss.pdf): two pages, protected with the password `p@ss`. - [ledger-2026-01.xlsx](https://docs.groupdocs.com/merger/python-net/_sample_files/getting-started/command-line-interface/ledger-2026-01.xlsx) and [ledger-2026-02.xlsx](https://docs.groupdocs.com/merger/python-net/_sample_files/getting-started/command-line-interface/ledger-2026-02.xlsx): one worksheet each, a header row and 12 orders. - [photo-card-1.png](https://docs.groupdocs.com/merger/python-net/_sample_files/getting-started/command-line-interface/photo-card-1.png) (720 × 405 pixels) and [photo-card-2.png](https://docs.groupdocs.com/merger/python-net/_sample_files/getting-started/command-line-interface/photo-card-2.png) (480 × 360 pixels). ## Commands The command has four subcommands. Run `groupdocs-merger --help` for the full list of options, or `groupdocs-merger --help` for one subcommand. Page lists count from 1: `1,3,5-7` lists pages, and `5-` runs to the last page. ### merge Join two or more documents in the order given. The result keeps the format of the first document, so the output file takes its extension. ```bash groupdocs-merger merge north-pier-report.pdf cold-store-audit.pdf -o north-pier.pdf ``` `north-pier.pdf` holds the three pages of the report followed by the two pages of the audit. The command prints the path of the file it wrote. These options tune the join for a format: | Option | Applies to | Effect | | :- | :- | :- | | `--image-layout vertical\|horizontal` | Images | Stack the images (the default) or place them side by side. | | `--word-mode default\|continuous\|disable-section-breaks` | Word documents | Start each document on a new page (the default), continue on the same page, or drop the section breaks. | | `--sheet-mode worksheets\|rows` | Spreadsheets | Add the worksheets of each workbook (the default), or append its rows below the existing data. | | `--skip-rows N` | Spreadsheets, with `--sheet-mode rows` | Skip the first N rows of each joined workbook, such as its header row. | | `--password PASSWORD` | Any format | The password of the first document, if it is protected. | ```bash # Append February's orders below January's, without February's header row groupdocs-merger merge ledger-2026-01.xlsx ledger-2026-02.xlsx -o ledger-2026.xlsx --sheet-mode rows --skip-rows 1 # Place two pictures side by side groupdocs-merger merge photo-card-1.png photo-card-2.png -o photo-cards.png --image-layout horizontal ``` `ledger-2026.xlsx` has one worksheet: the header row and the 24 orders of both months. `photo-cards.png` is 1200 × 405 pixels, the two pictures side by side. ### split Split a document into several files in a folder, which is created if it is missing. `--pages` writes one file per listed page, and `--at` starts a new file at each listed page. ```bash # Three files: pages 1-2, pages 3-5, and page 6 to the end groupdocs-merger split board-pack.pdf -o parts --at 3,6 # One file per page, named page-1.pdf to page-6.pdf groupdocs-merger split board-pack.pdf -o pages --pages 1- --name page-{0}.pdf ``` The first command writes `board-pack_0.pdf` (pages 1 and 2), `board-pack_1.pdf` (pages 3 to 5) and `board-pack_2.pdf` (page 6) into the `parts` folder. The command prints the path of each file it wrote, and the number of files to standard error. | Option | Effect | | :- | :- | | `--pages LIST` | One file per listed page. | | `--at LIST` | A new file starts at each listed page: `3,6` gives pages 1-2, 3-5 and 6 to the end. | | `--name PATTERN` | The names of the files. `{0}` stands for the page number with `--pages`, and for the part's index, counted from 0, with `--at`. The default is the input's name followed by `_{0}` and its extension. | | `--odd`, `--even` | Only the odd or the even pages of the list. | | `--password PASSWORD` | The password of the document, if it is protected. | A text file is split by lines: the lists then give line numbers, and `{0}` is the part's index, counted from 0. ### extract Keep only the listed pages: ```bash groupdocs-merger extract board-pack.pdf -o board-pack-2-4.pdf --pages 2-4 ``` `board-pack-2-4.pdf` holds pages 2, 3 and 4. The options are `--odd`, `--even` and `--password`. ### remove Drop the listed pages: ```bash # Remove the even pages: pages 1, 3 and 5 are left groupdocs-merger remove board-pack.pdf -o board-pack-odd.pdf --pages 1- --even ``` The options are `--odd`, `--even` and `--password`. A list that would remove every page is refused. ### Protected documents `--password` opens a protected document: ```bash groupdocs-merger extract budget-2027-pss.pdf -o budget-summary.pdf --pages 1 --password p@ss ``` `budget-summary.pdf` holds page 1 and opens without a password. Without `--password`, the command stops with exit code `1` and suggests passing one. ## License `--license SOURCE` applies a license file, or the URL of one, before the subcommand runs. Place it before the subcommand's name: ```bash groupdocs-merger --license GroupDocs.Merger.lic merge north-pier-report.pdf cold-store-audit.pdf -o north-pier.pdf ``` The command also reads the `GROUPDOCS_LIC_PATH` environment variable, as the Python API does, so with the variable set you can omit `--license`. See [Licensing and Evaluation]({{< ref "merger/python-net/getting-started/licensing-and-subscription.md" >}}) for both. Without a license, the command runs in evaluation mode: a result holds at most three pages and carries an evaluation notice. A license that cannot be read or applied stops the command with exit code `1` and a message that says why. ## Exit codes | Code | Meaning | | :- | :- | | `0` | Success. | | `2` | A mistake in the command line, such as a missing input file, a page past the end of the document, or an output extension that differs from the input's. Nothing is written. | | `1` | The document or the license could not be processed. The reason is printed to standard error. | These codes make the command easy to branch on in shell scripts and CI pipelines. ## When to use the Python API instead The command joins and splits files on disk. For anything beyond that, use the Python API: streams and in-memory documents, page previews, document information, adding, changing and removing passwords, moving, swapping and rotating pages, and importing documents as OLE objects or attachments. See the [Developer Guide]({{< ref "merger/python-net/developer-guide/_index.md" >}}) for runnable examples of each. ## Next steps - [Hello, World!]({{< ref "merger/python-net/getting-started/hello-world.md" >}}): merge two documents with the Python API. - [Quick Start Guide]({{< ref "merger/python-net/getting-started/quick-start-guide.md" >}}): three short examples that merge, extract pages and split.