Quick Fix features

Spot color QuickFixes

Rename spot color

This QuickFix feature simply renames spot colors. Using the operator in conjunction with the "Current spot color name" allows for flexible renaming – whether for just one specific spot color name or a list of names or mappings that could be expressed using RegEx. The table below illustrates this with a couple of examples.

Operator Current spot color name
New spot color name Effect
equal to red Logo Red If there is a spot color whose name is exactly "red" it will be renamed to "Logo Red"
contains red Logo Red All spot color names that contain "red" ("Deep red", "Fred", "ingredient", ... ) will get renamed to "Logo Red". By implication all these spot colors containing "red" in their name will be merged into a single new spot color "Logo Red"
regex .* Logo $0 All spot colors will be renamed by prefixing their current name with "Logo ".
{
    "quickfixes": [
        {
            "quickfix": "rename_spot",
            "version": "1.0",
            "instructions": [
                {
                    "operator": "equal_to",
                    "old_spot": "Panettone 101 C old",
                    "new_spot": "Panettone 101 C new"
                },
                {
                    "operator": "regex",
                    "old_spot": "(P.*)(\\d*)",
                    "new_spot": "Panettone $2"
                }
            ]
        }
    ]
}

If there are several instructions in a QuickFix step, each spot color will only be "touched" once (if at all). If repeated modifications are desired (change a spot color name, then change that already modified spot color name again), the respective instruction have to be put inside separate QuickFix steps.

Adjust spot colors

This QuickFix is an extended version of the "Rename spot color" QuickFix. In addition to the new spot color name it is also possible to specify the appearance of that new spot color, using DevciceCMYK, DeviceRGB, sRGB, Lab D50, Lab D65, sRGB, DeviceGray (or an ICC profile by means of an <icc-profil-file-path>) with the appropriate number of color values.

If the new spot color name is left empty, only the appearance will be  changed. if the alternate color space and color values aree left empty, only renaming will be applied (same effect as with thee "Rename spot color" QuickFix).

{
    "quickfixes": [
        {
            "quickfix": "adjust_spot",
            "version": "1.0",
            "instructions": [
                {
                    "operator": "contains",
                    "old_spot": "Red",
                    "new_spot": "Company red",
                    "alt" : "sRGB",
                    "c0" : 1.0,
                    "c1" : 0.0,
                    "c2" : 0.0
                }
            ]
        }
    ]
}

Merge spot colors

The "Merge Spot color" QuickFix  differs from the "Rename spot color" QuickFix insofar, as on both sides – "Spot colors to be merged" and spot color to be merged into ("Merge into this spot color") – an operator can be used. If more than one spot color name matches the condition expressed by the operator combined with the value of "Merge into this spot color", the first occurrence – in the order in which QuickFix analyses the PDF file (which often will not coincide what one would expect from looking at the PDF) – of one of the matching spot colors will become the spot color, into which the other spot colors are merged.

In general, it is recommended to make the combination of operator and "Merge into this spot color" specific enough to identify that one spot color in the PDF into which the other spot colors are to be merged. The combination of operator and "Spot colors to be merged" may be as generic or as specific as makes sense for the given use case.

{
    "quickfixes": [
        {
            "quickfix": "merge_spot",
            "version": "1.0",
            "instructions": [
                {
                    "master_spot": "Company Red",
                    "operator1": "equal_to",
                    "slave_spot": "red",
                    "operator2": "contains",
                }
            ]
        }
    ]
}

Page geometry (and Pages tree)

Adjust document Pages Tree

This QuickFixes will hardly ever be of relevant use of its own. It is always executed implicitly if any of the QuickFixes dealing with page geometry are executed.

Due to the flexibility of the PDF syntax, there are numerous ways to put pages and  their accompanying page geometry boxes (at least a MediaBox must always be specified) inside a PDF. The "Adjust document Pages Tree" QuickFix "normalizes" page organisation in PDFs. For multi-page PDFs it makes sure, no more than the number of pages specified in "Page tree node size" are present in a page tree node (this only has practical implications for retrieving pages in PDFs with a large number of pages). In addition, and entries for page geometry boxes – which could be present in intermediate page tree nodes and would then apply to all pages under that node – are moved to the page to which they apply, such that each page stands on its own feet regarding page geometry boxes (and makes thim independent of all other pages). Again, this is relevant for fast processing of page related information.

{
    "quickfixes": [
        {
            "quickfix": "adjust_pages_tree",
            "version": "1.0",
            "instructions": [
                {
                    "pages_size": 100
                }
             ]

Set MediaBox to origin

This QuickFix does a very specific thing: it makes sure, that the lower left of the MediaBox sits at 0:0. Page geometry manipulations can easily lead to situations where this is not the case. Strictly speaking this does not matter anyway – as long as width and height of page geometry boxes – and their relative position towards each other – are correct, everything else is irrelevant. The lower left of the MediaBox could be at 2000:-900 and there would not be a problem. Except with some output or other PDF processing systems that got used to the fact that especially in the earlier days of PDF all MediaBoxes would sit at 0:0. These systems struggle with PDFs whose MediaBox does not sit at 0:0 and might create 'unexpected' output.

{
    "quickfixes": [
        {
            "quickfix": "set_mediabox_to_origin",
            "version": "1.0",
            "instructions": [
                {
                    "page_selector": "all"
                }
            ]
        }
    ]
}

Apply Rotate key

This will have an effect only if a given page has a Rotate entry, and if that Rotate entry is not equal zero. The fact of the Rotate key is then incorporated into the page description, and the Rotate key is removed. In addition, the page geometry boxes and the positions of annotations and form fields are adjusted accordingly.

{
    "quickfixes": [
        {
            "quickfix": "apply_rotate_key",
            "version": "1.0",
            "instructions": [
                {
                    "page_selector": "all"
                }
            ]

Auto-correct page geometry boxes

Works in the same way as the respective fixup, except that in the QuickFix it is possible to define the pages whose page geometry boxes are to be auto-corrected:

Automatically corrects nesting of page geometry boxes (TrimBox or ArtBox, BleedBox, CropBox, MediaBox – in that order), if necessary, on all pages defined by the Page selector.

In addition, for these  pages the lower left of the MediaBox is set to the origin

{
    "quickfixes": [
        {
            "quickfix": "auto_correct_page_boxes",
            "version": "1.0",
            "instructions": [
                {
                    "page_selector": "all"
                }
            ]

Remove page geometry boxes

Works in the same way as the respective fixup:

Removes the selected page geometry box(es) from the pages defined by the Page selector.

{
    "quickfixes": [
        {
            "quickfix": "remove_page_box",
            "version": "1.0",
            "instructions": [
                {
                    "page_selector": "all|splitscheme_expression",
                    "which_box": "CropBox|BleedBox|TrimBox|ArtBox"
                }
            ]

Set page geometry box

Works in the same way as the respective fixup:

Sets page geometry boxes either relative to an existing page geometry box or to absolute coordinates.

{
    "quickfixes": [
        {
            "quickfix": "set_page_box",
            "version": "1.0",
            "instructions": [
                {
                    "page_selector": "all",
                    "which_box": "CropBox",
                    "from_box_or_absolute":  "BleedBox",
                    "left": 5.0,
                    "bottom": 5.0,
                    "right": 5.0,
                    "top": 05.0,
                    "unit": "mm",
                    "when": "always"
                }
             ]

Set page geometry box (with dimensions)

Works in the same way as the respective fixup:

Sets page geometry boxes by specifying page box dimensions.

{
    "quickfixes": [
        {
            "quickfix": "set_page_box_by_dimensions",
            "version": "1.0",
            "instructions": [
                {
                    "page_selector": "all",
                    "which_box": "CropBox",
                    "relative_to": "center",
                    "from_box_or_origin":  "TrimBox",
                    "hor_offset": 0.0,
                    "vert_offset": 0.0,
                    "width": 210.0,
                    "width_is_relative": false,
                    "height": 297.0,
                    "height_is_relative": false,
                    "unit": "mm",
                    "when": "always"
                }
             ]

Scale/rotate/flip pages

Scale pages

Works in the same way as the respective fixup:

Scales all pages in the PDF defined by the Page selector. In addition, for these  pages the lower left of the MediaBox is set to the origin (0:0).

{
    "quickfixes": [
        {
            "quickfix": "scale_pages",
            "version": "1.0",
            "instructions": [
                {
                    "page_selector": "all",
                    "short_edge": 210,
                    "long_edge": 297,
                    "unit": "percent|mm",
                    "page_scale_mode": "fit_from_inside_add_white_space"
                }
            ]

Scale page content only

Works in the same way as the respective fixup:

Scales the page content  to a given percentage without changing page dimensions for all pages defined by th Page selector.  In addition, for these  pages the lower left of the MediaBox is set to the origin

{
    "quickfixes": [
        {
            "quickfix": "scale_page_content_only",
            "version": "1.0",
            "instructions": [
                {
                    "page_selector": "all",
                    "relative_to": "center",
                    "scale_to_percent": 110
                }
            ]

Enlarge page

Works in the same way as the respective fixup:

Enlarges the page area without modifying the page content for all pages defined by the Page selector.  In addition, for these  pages the lower left of the MediaBox is set to the origin

{
    "quickfixes": [
        {
            "quickfix": "enlarge_pages",
            "version": "1.0",
            "instructions": [
                {
                    "page_selector": "all",
                    "which_edges": "top_and_bottom",
                    "enlarge_by": 10,
                    "unit": "mm"
                }
            ]

Rotate pages

Works mostly in the same way as the respective fixup:

Rotates pages defined by the Page selector by the defined angle. If there is a page rotation parameter it is applied.  In addition, for these  pages the lower left of the MediaBox is set to the origin.

{
    "quickfixes": [
        {
            "quickfix": "rotate_pages",
            "version": "1.0",
            "instructions": [
                {
                    "page_selector": "all",
                    "rotate_by": -90
                }
            ]

Flip pages

Works in the same way as the respective fixup:

Flips the pages horizontally or vertically for all pages defined by the Page selector.  In addition, for these  pages the lower left of the MediaBox is set to the origin

{
    "quickfixes": [
        {
            "quickfix": "flip_pages",
            "version": "1.0",
            "instructions": [
                {
                    "page_selector": "even",
                    "flip_direction": "horizontally"
                }
            ]

Insert/duplicate/remove/Invert/Reorder pages

Insert empty page

Works in the same way as the fixup "Insert page":

Inserts an empty page before or after the pages defined by the Page selector. The page geometry boxes will be a copy of the page before or after which the empty page is inserted.

{
    "quickfixes": [
        {
            "quickfix": "insert_empty_page",
            "version": "1.0",
            "instructions": [
                {
                    "page_selector": "all",
                    "where": "before"
                }
            ]

Duplicate pages

Duplicates the page(s) defined by the Page selector.

{
    "quickfixes": [
        {
            "quickfix": "duplicate_page",
            "version": "1.0",
            "instructions": [
                {
                    "page_selector": "1,-1"
                }
            ]

Remove pages

Removes the page(s) defined by the Page selector.

{
    "quickfixes": [
        {
            "quickfix": "remove_page",
            "version": "1.0",
            "instructions": [
                {
                    "page_selector": "2--1"
                }
            ]

Invert pages

This QuickFix inverts the page order in accordance with the defined 'page selector', like all pages or only even pages etc.

Example: A simple 10 page PDF with a page selector “1-5” will thereafter have:5,4,3,2,1,6,7,8,9,10.

{
    "quickfixes": [
        {
            "quickfix": "invert_pages",
            "version": "1.0",
            "instructions": [
                {
                    "page_selector": "all|even|odd|<splitscheme_expression>"
                }
            ]

Reorder pages

This QuickFix lets you reorder pages in a document based on the given attributes:

  • Page selector, which can be a list eg, 1,2,3 or a simple expression  etc
  • Relative to (first/last page in PDF/selection)
  • Page offset, which is the anchor point by which the selected pages are to be reordered
  • Insert (before or after)
  • Non consecutive selections, either 
    • Insert as consecutive pages or
    • Shift page structure

More info here.

{
    "quickfixes": [
        {
            "quickfix": "reorder_pages",
            "version": "1.0",
            "instructions": [
                {
                    "page_selector": "*3(3)",
					"relative_to_page": "first_page",
					"page_offset": -1,
					"insert_pages": "insert_before",
					"insert_mode": "shift_pages"
                }
            ]

Layers (including Processing Steps metadata)

Set layer visibility

This QuickFix is similar to the "Set layer default to ON/OFF" fixup.

It sets the default visibility of a layer of of layers to either visible or not visible.

If "Interpret layer name as Processing Steps name" is checked, the names of layers are ignored, and instead their Processing Steps metadata is used to determine whether to turn their visibility on or off. Processing Steps metadata are to be written by combining group and type:

  • the syntax is for writing the Processing Steps metadata value in the QuickFix step configuration is "<Processing Steps Group>:<Processing Steps Type>"
  • for example: "Structural:Bleed"
{
    "quickfixes": [
        {
            "quickfix": "set_ocg_visibility",
            "version": "1.0",
            "instructions": [
                {
                    "operator": "contains",
                    "ocg_name": "Die",
                    "interpret_ocg_name_as_processsing_steps_name: false,
                    "visibility" : "on"
                },
                {
                    "operator": "contains",
                    "ocg_name": "Cut",
                    "interpret_ocg_name_as_processsing_steps_name: false,
                    "visibility" : "on"
                }
            ]

Set Processing Steps metadata for layer

This QuickFix adds Processing Steps metadata to a layer / to layers. Already existing Processing Steps metadata entries will be overwritten.

{
    "quickfixes": [
        {
            "quickfix": "set_processing_steps_metadata_for_ocg",
            "version": "1.0",
            "instructions": [
                {
                    "operator": "conntains",
                    "ocg_name": "Die",
                    "processing_steps_group" : "Structural",
                    "processing_steps_type" : "Cutting"
                },
                {
                    "operator": "conntains",
                    "ocg_name": "Stanz",
                    "processing_steps_group" : "Structural",
                    "processing_steps_type" : "Cutting"
                },
                {
                    "operator": "conntains",
                    "ocg_name": "Cut",
                    "processing_steps_group" : "Structural",
                    "processing_steps_type" : "Cutting"
                },
                {
                    "operator": "conntains",
                    "ocg_name": "poinç",
                    "processing_steps_group" : "Structural",
                    "processing_steps_type" : "Cutting"
                }
            ]

Output intents

Embed Output Intent

This QuickFix embeds the specified Output Intent. It is possible to choose between different PDF standards – such as PDF/X, PDF/A etc. – for the output intent to be embedded (these standards mandate that the output intent be the same for all such standards to which a PDF claims conformance, so a single embedded output intent can serve more than one PDF standard in the same PDF file).

{
    "quickfixes": [
        {
            "quickfix": "embed_outputintent",
            "version": "1.0",
            "instructions": [
                {
                    "outputintent_name": "PSO Coated v3 (ECI)",
                    "outputintent_type" : "AX",
                    "retain_existing_outputintent" : false
                }
            ]
		 }
}

Embed Output Intent with specified parameters

This QuickFix embeds a PDF/X, PDF/A and/or PDF/E Output Intent with all the parameters like the ICC color Profile (e.g. CoatedFOGRA27.icc) or an output condition identifier, which is simply a text description of the intended print specifications (e.g. FOGRA27).

 {
        "quickfix": "embed_outputintent_with_params",
        "version": "1.0",
        "instructions": 
        [
            {
                "outputintent_name": "",
                "outputintent_filepath_icc": "\ICC profiles\\sRGB IEC61966-2.1.icc",
                "outputintent_type": "A",
                "outputintent_condition_identifier": "sRGB",
                "outputintent_registry": "http://www.color.org",
                "outputintent_condition": "",
                "outputintent_info": "Creator: HP     Manufacturer:IEC    Model:sRGB)",
                "outputintent_url_referenced_icc": "",
                "retain_existing_outputintent": false
            }
        ]
    }

Embed Output Intent on page level

This QuickFix embeds the specified Output Intent on a page level (using page selector). It is possible to choose between different PDF standards – such as PDF/X, PDF/A etc. – for the output intent to be embedded.

{
    "quickfixes": [
        {
            "quickfix": "embed_page_outputintent",
            "version": "1.0",
            "instructions": [
                {
                    "outputintent_name": "PSO Coated v3 (ECI)",
                    "outputintent_type" : "AX",
                    "retain_existing_outputintent" : false,
                    "page_selector": "odd"
                }
            ]
		 }
}

Embed Output Intent with specified parameters on page level

This QuickFix embeds a PDF/X, PDF/A and/or PDF/E Output Intent with all the parameters like the ICC color Profile (e.g. CoatedFOGRA27.icc) and an output condition identifier, which is simply a text description of the intended print specifications (e.g. FOGRA27) on a page level (using page selector).

{
        "quickfix": "embed_page_outputintent_with_params",
        "version": "1.0",
        "instructions": 
        [
            {
                "outputintent_name": "",
                "outputintent_filepath_icc": "\ICC profiles\\sRGB IEC61966-2.1.icc",
                "outputintent_type": "A",
                "outputintent_condition_identifier": "sRGB",
                "outputintent_registry": "http://www.color.org",
                "outputintent_condition": "",
                "outputintent_info": "Creator: HP     Manufacturer:IEC    Model:sRGB)",
                "outputintent_url_referenced_icc": "",
                "retain_existing_outputintent": false,
                "page_selector": "odd"
            }
        ]
    }

Remove all Output Intents

This QuickFix removes all output intents in a PDF file.

{
    "quickfixes": [
        {
            "quickfix": "remove_outputintents",
            "version": "1.0",
            "instructions": [
            ]

Remove page level Output Intents

This QuickFix removes output intents on a page level in a PDF file.

{
        "quickfix": "remove_page_outputintents",
        "version": "1.0",
        "instructions": 
        [
            {
                "page_selector": "odd"
            }
        ]
    }

Resave PDF

{
        "quickfix": "fullsave",
        "version": "1.0",
        "instructions": 
        [
            {
                "pdf_version": "retain|1.4|1.5|1.6|1.7|2.0"
            }
        ]
    }

PDF/VT DPart

Inject DPart

This QuickFix injects very simple DPart data into a PDF file. In essence, it creates logical groups of in the form of page ranges. Using the Page selector syntax, a number of approaches exist to define such page ranges:

  • explicitly, e.g. 1-4, 5-8, 9-12 – creates three ranges accordingly, only works in a predictable fashion for PDFs that contain exactly 12 pages; any exceeding pages will be put into their own page range; for PDFs with less than 12 pages, one or several page ranges will be 'incomplete' or missing altogether.
  • rule based, e.g. 4* – creates a page range for each block of four pages
  • all kinds of more complex expressions...

For details see the article Page selection.

The entry for Node name expressed the meaning of the grouped page ranges. This could be arbitrary parts of a book, account statements for a bank's customers, photo books, ...

Where DPPart injection is to be dynamically based upon a PDF's characteristics or content, execution of a QuickCheck or a regular check , in combination with some JavaScript, inside a Process Plan, and before execution of a QuickFix with DPart injection, makes it possible to address more advanced scenarios in a very powerful manner. An example is provided in the form of the Process Plan "Create DPart record information from headings" which ships with pdfToolbox 12.

JavaScript based configuration

This configuration must return a JavaScript object that has a JSON serialisation according to the specification for the QuickFix features in the form as documented above.

let cfg = 
{
	"quickfixes" : 
	[
		{
			"instructions" : 
			[
				{
					"pages_size" : 10
				}
			],
			"quickfix" : "adjust_pages_tree",
			"version" : "1.0"
		}
	]
};
cfg;