pdfcpu

Logo

PDF tooling for Go and the command line.

View the Project on GitHub pdfcpu/pdfcpu


Changelog
Future Directions

Validate

Any PDF file you would like to process with pdfcpu needs to pass validation.

This command validates inFile against:


Validation can also check for broken links.


Have a look at some examples.

Usage

pdfcpu validate inFile... [flags]

Flags

namedescriptionrequiredvaluesdefault
m(ode)validation modenostrict, relaxedrelaxed
l(inks)check linksno
opt, optimizeoptimize resourcesno

Common Flags


Arguments

namedescriptionrequired
inFilePDF input file, use - to read from stdinyes

Mode

Strict

This mode validates against PDF 32000-1:2008 (PDF 1.7) and performs basic PDF 2.0 checks.

Relaxed

This is the default mode for validation.
It behaves like strict but does not complain about common seen violations of the specification by PDF writers.


Examples

An example using strict validation:

$ pdfcpu validate test.pdf --mode strict
validating(mode=strict) test.pdf ...
validation ok

An example using default validation:

$ pdfcpu validate test.pdf
validating(mode=relaxed) test.pdf ...
validation ok

Check for broken links:

$ pdfcpu val PDF32000_2008.pdf -l
validating(mode=relaxed) PDF32000_2008.pdf ...
validating URIs..
...........................
Page 8: http://www.aiim.org/pdfrefdocs status=404
Page 10: http://adobe.com/go/pdf_ref_bibliography status=404
Page 10: http://www.adobe.com/go/pdf_ref_bibliography status=404
Page 11: http://www.aiim.org/pdfnotes status=404
Page 753: http://developer.apple.com/fonts/TTRefMan/ status=404
Page 754: http://www.agfamonotype.com/printer/pan1.asp status=404
Page 755: http://www.rsasecurity.com/rsalabs/node.asp?id=2125 status=404
validation error: broken links detected

Validate a PDF streamed from S3:

$ aws s3 cp s3://acme-invoices/invoice.pdf - \
   | pdfcpu validate -