pdfcpu

Logo

A PDF processor written in Go.

View the Project on GitHub pdfcpu/pdfcpu


Changelog

Page Selection

The --pages -p flag allows you to select specific pages for processing when using the following commands:

Syntax

The value of this flag is a string which is a comma separated list of expressions containing page numbers or page number ranges:

expressionpage selection
eveninclude even pages
oddinclude odd pages
#include page #
#-#include page range
!#exclude page #
!#-#exclude page range
#-include page # - last page
-#include first page - page #
!#-exclude page # - last page
!-#exclude first page - page #
linclude last page
nlexclude last page
#-l-1include page # - (last page-1)

You can use either ! or n for negating an expression.
! needs to be escaped with single quotes on the command line.


Examples

Select the first three pages, page 5 and page 7 up to the end of the document:

--pages -3,5,7-

Select pages 4 to 7 but exclude page 6:

--pages '4-7,!6'

Select all pages other than page 5:

--pages '1-,!5' 

Select all odd pages and exclude page 1 and the last page:

-p odd,n1,nl

Select all even pages and ensure the last page:

-p even,l