Download the PHP package arajcany/pre-press-tricks without Composer
On this page you can find all versions of the php package arajcany/pre-press-tricks. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package pre-press-tricks
PrePress Tricks Library
Box of Tricks for common PrePress related tasks.
Table of Contents
- Purpose
- Installation
- Basic Usage
Purpose
If you have ever asked any of the following question, this collection of Classes might be for you.
Pages Class
- I need to scale this picture. At what percent will it fit inside this box?
Boxes Class
- How do clean up a range of pages to something readable e.g. '3,4,6,12,13,10-20,1,2,8' => '1-4,6,8,10-20'?
Ticketing Classes
- How do I generate an XPIF ticket for Xerox Printing Devices?
Installation
The recommended method of installation is via Composer.
Version compatibility
Basic Usage - XPIF Ticket Maker
Example 1 - Base Ticket
$string
contains the following XML
Example 2 - Base Ticket Supported Properties
The XPIF Specification supports almost 650 properties inside the ticket. You can control standard properties such as ' copies' to exotic properties such as 'rgb-monochrome-grayline-mapping'. I have selected a handful of the most commonly used properties and created concrete methods around setting those properties. For settings rarely used properties, see Example 3.
Example 3 - Setting Additional Properties
For setting properties that do not have a concrete methods, you can use the generic set setProperty()
method.
Example 4 - Issues With Setting Additional Properties
The setProperty()
may or may not work for a given property. This is because the code uses some smarts to try and
figure out the attributes of the property in question. This is done via the published xpif.dtd
files (which I auto
convert to JSON format for easy reading).
Consider the following XPIF ticket
Issue 1 - Ambiguous Properties
If you try to set a 'lower-bound' property as follows, $ticket->setProperty('lower-bound', 1)
are you setting it
for:
/xpif/job-template-attributes/finishings-col/finishings-media-sheets-min-max/lower-bound
or
/xpif/job-template-attributes/page-ranges/value/lower-bound
?
Solution
Use dot-notation to explicitly define the path. Notice the dot-notation in the first argument:
$ticket->setProperty('finishings-media-sheets-min-max.lower-bound', 1)
This clearly defines which 'lower-bound' to use in the xpif.dtd
file.
You could go all out and use the full xPath in dot-notation format
$ticket->setProperty('xpif.job-template-attributes.finishings-col.finishings-media-sheets-min-max.lower-bound', 1)
but it is rarely more than necessary to define the parent and grand-parent.
Issue 2 - Undefined Children of 'Value'
For whatever reason, the Xerox xpif.dtd
files do not publish what the valid child nodes of 'value' are. Looking at the
example XPIF above :
/xpif/job-template-attributes/finishings/value
contains text values 28, 93 and 92.
/xpif/job-template-attributes/page-ranges/value
contains child nodes of 'lower-bound' and 'upper-bound'.
This is super confusing as literally 'value' can contain anything, it is not defined in the xpif.dtd.
Solution
Unfortunately, you just have to know the XPIF structure post 'value' of the following properties:
I have coded in some tricks that you can use:
Example 5 - Handling Media and Media Collection
Depending on the RIP you use, you can either use Media or Media Collection:
Media Use this when your RIP has a defined media catalogue and you know the name of that media in the catalogue.
Media Collection Use this when your RIP does not have a defined media catalogue and you need to set the properties of the stock.
Media Collections are awesome because you can clone/modify/reuse them:
To see how to reuse Media Collections refer to Example 6.
Example 6 - Other Collections
In addition to the Media Collection the following collections are also available:
- Front Cover Collection
- Back Cover Collection
- Insert Sheet Collection
- Page Overrides Collection
Example 7 - Using Collections In Your XPIF Tickets (the kitchen sink)
In case you got lost in Example 6 about Media Collections, here is a visual on where Media Collections can sit inside an XPIF Ticket:
From the representation above, you can probably see why I said Collections are awesome:
- They allow you to write less code.
- You don't need to know the full xPath of the property you are trying to set - done automatically by the Collection.
- Create a base Collection then clone/modify/reuse that Collection in different parts of the ticket.
So here is a Collections kitchen sink example, I imagine that this will cover about 90% of what you need to do with xpif ticketing. This kitchen sink example is based on the historical fiction "For The Term of His Natural Life" by Marcus Clarke (public domain). You can download a copy of this classic novel here https://adc.library.usyd.edu.au/data-2/p00023.pdf
The PDF has the following properties:
- The PDF has 433 pages
- The PDF has 8 has parts
- TITLE & IMPRINT
- PREFACE
- PROLOGUE
- BOOK I.—THE SEA. 1827.
- BOOK II.—MACQUARIE HARBOUR. 1833.
- BOOK III. PORT ARTHUR 1838.
- BOOK IV. NORFOLK ISLAND 1846.
- EPILOGUE
- Each of the above BOOKS has several chapters
I want the xpif to print the PDF as follows:
- Printed double-sided on A4 white 80gsm paper
- 4 hole punched as it needs to be inserted into a binder
- FRONT COVER is the first page of the PDF, printed single-sided on A4 blue 200gsm card
- Print the IMPRINT page single-sided on A4 white 80gsm paper
- Print the PREFACE on A4 pink 80gsm paper
- For the PROLOGUE, EPILOGUE and each of 4 BOOKS, insert an A4 yellow 200gsm divider card
- For each of the CHAPTERS, print the first 2 pdf-pages on A4 pink 80gsm paper
- BACK COVER required, use a piece of A4 blue 200gsm card (i.e. no printing)
All versions of pre-press-tricks with dependencies
ext-json Version *
ext-dom Version *
ext-soap Version *
ext-gd Version *
ext-exif Version *
cakephp/core Version >=5.0
cakephp/i18n Version >=5.0
intervention/image Version ^2.7
league/mime-type-detection Version ^1.11
tecnickcom/tc-lib-pdf Version ^8.0
arajcany/tool-box Version ^2.3