Step by step - Learn how to use callas productscallas pdfToolboxQuick FixQuick Fix configuration essentials: String comparison operators and page selection expressions

Quick Fix configuration essentials: String comparison operators and page selection expressions

General considerations

QuickFixes are optimized for speed. for example, all changes are applied to a PDF file in the form of an "incremental update operation" – changes are written to the end of PDF file in a manner that relevant existing data is logically (but not 'physically') overwritten or removed. While the PDF may become slightly larger, it does not need to be completely rewritten – a significant time saver especially for larger PDFs. 

Furthermore, the QuickFix engine executes one incremental save operation per QuickFix step in a Process Plan, and combines QuickFixes of the same type – e.g renaming several spot colors or manipulating different page geometry boxes on different page ranges – into a single operation. As a consequence – whenever more than QuickFix feature is to be applied to a PDF file – it is advised to combine all needed QuickFix features into one QuickFix step inside a Process Plan, instead of having several QuickFix based Process Plan steps.

The order of execution always follows the order in which QuickFix processing instructions are defined in a QuickFix. This can be important for example for renaming spot colors – specific instructions could be defined first, and following instructions could then rename remaining spot colors in a more generic fashion.

Important configuration options

Many QuickFixes use two types of configuration options that in many cases are highly relevant for efficient execution.

String comparison operators

For some QuickFix features – for example, spot color renaming – flexible string handling is very important. For this purpose, the following string operators are offered in a number of QuickFix configurations:

  • “noop”
  • "regex"
  • "begins_with"
  • "contains"
  • "does_not_begin_with"
  • "does_not_contain"
  • "does_not_end_with"
  • "ends_with"
  • "equal_to"
  • "is_contained_in"
  • "is_not_contained_in"
  • "unequal_to"

These string comparison operators work in the same way as the (similarly named)  comparison operators in checks and Fixups.

Page selection

For some QuickFix features – for example, adjusting page geometry boxes – it is very important to have a flexible option to determine which pages to process and which pages not to process (e.g. only the first two and the last pages, or only even pages, or every 4th page, etc.). For this purpose, a flexible syntax is used to express the desired groups of pages or page ranges. This is the same syntax as used for split schemes (--splitscheme=<expression>) in the "Split and merge" feature – see Split and merge for details.

Split Scheme

A split scheme expression may be a number with an asterisk "*" or a more complex string. If it is a number with an asterisk "*" it creates groups of pages where each group has the defined number of pages. E.g. if the expression is "3*" it would group the PDF into groups of 3 pages.

Expressions
Type
Syntax
Example

Simple
expression
number[-number]
1-5
Page 1 to 5:
[1,2,3,4,5]


5-1
Page 5 to 1:
[5,4,3,2,1]


8
Only page 8


-1
Last page


-3--1
Last 3 pages:
[n, n-1, n-2]


-1--3
Last 3 pages
in reverse
order: [n-2,
n-1, n]


-1-3
Last n - 2
pages in
reverse order:
[n, n-1, ... ,3]


*2(2)
[2][4][6]...
Simple
expression
with Simple
Range
number[-number]_
number[-number]
1-2_-2--1
First and last 2
pages: [1,2,n-
1,n]


1-2_-2--1,$
First and
last 2 pages
[1,2,n-1,n]
and remaining
inner pages
[3, ... ,n-2]


1_1_1_1
4 times page
1: [1,1,1,1]
Type
Syntax
Example

Multipage
expression
even_pages
even
even
All even pages
(same as
*2(2))

uneven_pages
uneven
odd
uneven
All uneven
pages (same
as *2(1))

Package
number*
[(start_page)]
5*
Packages of 5
pages


5*(2)
Packages of 5
pages, starting
with page
2

Intervall
*number
[(start_page)]
*5
Every 5th page


*5(2)
Every 5th
page, starting
with page 2


*5(-20)
Every 5th page
of the last
20 pages of
a document
(totally 4
pages)
Simple
expression
list
simple_expression
{","
simple_expression}
[ "," joker ]
1-5,8,-3--1
1 PDFs with
page 1-5, page
8 and the last
3 pages of the
input PDF


1-5,8,-1--3
1 PDFs with
page 1-5, page
8 and the last
3 pages of the
input PDF, but the last 3 pages in reverse order


5*(2)
Packages of 5
pages, starting
with page
2


*5(2)
Every 5th
page, starting
with page 2


*5(-20)
Every 5th page
of the last
20 pages of
a document
(totally 4
pages)
Joker
<expression>,$

Can be combined with other expressions (has to be the last item in a list) in order to group all pages that are not part of any other expression into their own group.

Example

1-5,8,-3--1,$

would create groups of pages with pages 1-5, page 8, the last 3 pages and the rest of the pages of the PDF.