/dotnetpdf

Command line tool for PDF processing.

Primary LanguageC#

dotnet.pdf

A .NET-based tool for PDF processing, dotnetpdf draws inspiration from PDFtk server.

Features

dotnetpdf commands

  • split: Split a single PDF into multiple files.
  • merge: Combine multiple PDFs into one file.
  • convert: Convert PDF pages to images.
  • imagetopdf: Convert images to a PDF file.
  • text: Extract text from a PDF.
  • bookmarks: Extract PDF bookmarks (outlines).
  • info: Retrieves PDF metadata.

Installation

Install dotnetpdf as a .NET global tool:

dotnet tool install --global Emm.DotnetPdf

Usage

# Split a PDF using autogenerated names
dotnetpdf split --input <input.pdf>

# Split a PDF specifying output name
dotnetpdf split --input <input.pdf> -names '{page}_{original}_pdf'
 
# Split a PDF using bookmarks as output names, specifying range
dotnetpdf split --input <input.pdf> --use-bookmarks --range 1-5

# You can also create a text file to specify the output filenames, one filename per pdf page
dotnetpdf split --input <input.pdf> --output-script <script.txt>

# Merge PDFs
dotnetpdf merge --output <output> --input <input1> --input <input2> 

# Merge Directory PDF's
dotnetpdf merge --output <output> --input-directory <directory> --recursive false

# Convert PDF to images
dotnetpdf convert --input <input.pdf> --output <directory> --range 1-5 --encoder .png --dpi 100

# Convert image to PDF
dotnetpdf imagetopdf --input <input.png> --output <output.pdf>

# Print PDF text to stdout
dotnetpdf text --input <input.pdf> --format text

# Print PDF text to stdout as json
dotnetpdf text --input <input.pdf> --format json

# Print PDF Bookmarks to stdout
dotnetpdf bookmarks --input <input.pdf>

# Extract PDF Information
dotnetpdf info --input <input.pdf> --format json

# Print Help
dotnetpdf --help