Join our Discord community for support and discussions! Connect with us →

Tutorials

Command Line Syntax

The command syntax for PDF Optimizer must include:

The command syntax for PDF Optimizer must include:

  • pdfoptimizer — the executable file name
  • -i [--input] — name of the PDF input file you want to optimize
  • -o [--output] — name you want to assign to the output PDF file
  • -j [--profile] — name of the JSON profile file

For each command line option, you can use the short (-i) or long (--input) notation.

These parameters are optional:

  • -q [--quiet] — suppress the results summary on the command line
  • -l [--log] — save detailed results to an output text file

A basic command statement looks like this:

pdfoptimizer --input March_Report.pdf --output March_ReportB.pdf --profile compressionMedium.json

You don't need to include paths if the input file and profile are stored in the same directory as the executable and you are saving output there too. If you need to reference files in different directories, include the full path:

pdfoptimizer --input C:\Datalogics\OptimizedFiles\AnnualReport2016.pdf --output C:\Datalogics\OutputFiles\AnnualReport2016-B.pdf --profile compressionMedium.json

If any file or path names contain spaces, wrap them in quotes:

pdfoptimizer --input "C:\Datalogics\Optimized Files\Annual Report 2016.pdf" --output C:\Datalogics\OutputFiles\AnnualReport2016-B.pdf --profile C:\Datalogics\profiles\images.json

PDF Optimizer also supports a legacy syntax that omits the option flags entirely, for compatibility with earlier workflows:

pdfoptimizer MarchReport2016.pdf MarchReport2016-B.pdf compressionMedium.json

After running PDF Optimizer, a summary appears on your command line by default. Use --quiet to suppress it:

pdfoptimizer --input March_Report.pdf --output March_ReportB.pdf --profile compressionMedium.json --quiet

Generate a detailed Results Report saved to a text file with --log:

pdfoptimizer --input March_Report.pdf --output March_ReportB.pdf --profile compressionMedium.json --log MarchResults.txt

Specify a folder path for the results report:

pdfoptimizer --input March_Report.pdf --output March_ReportB.pdf --profile compressionMedium.json --log C:\Datalogics\Results\MarchResults.txt
You can combine --quiet and --log in the same statement to suppress the console summary while still generating a detailed output report file.
The Windows installer adds the PDF Optimizer executable to %PATH%, so you can run pdfoptimizer.exe from any directory. On Linux, you need to add the executable location to your PATH variable manually.