I require a php class that parses and returns specific data from a JDF file ( JDF is an XML format that is specialized for print production). Some of the data I need from the JDF file can be easily extracted with common PHP XML functions, but others require iterating and associating complexly nested nodes and attributes, and is a too much for my brain (i am also a fairly experienced php programer, but this one is a bit to much for my brain, and I don't have time) .
The class you supply will be used as a component in a larger project I am working on.
I require a php class that parses and returns specific data from a JDF file ( JDF is an XML format that is specialized for print production).
Some of the data I need from the JDF file can be easily extracted with common PHP XML functions, but others require iterating and associating complexly nested nodes and attributes, and is a too much for my brain (i am also a fairly experienced php programer, but this one is a bit to much for me, and I don't have time)
I am supplying my preliminary attempt to parse the JDF file, to help explain what I require from this php class. My approach to dealing with XML has been convert to an array, and go from there. The coder is under no obligation to follow this course, and it seems to me that other approaches like XPath or DOMXml might be better suited to this project. That's up to you.
The zip contains my attempt at a class ' [url removed, login to view]', [url removed, login to view] is the test file, also a GPL class to convert the XML to array which is required by JDFReader. Example JDF files are also included.
When your run [url removed, login to view], you will see at top that some fields I require are easily accessed: Job Number, Customer Name, Job Name, DateCreated, Description. Following that are raw var_dumps of some of the areas of interest.
The challenging part of this project is getting 'signature' data - some understanding of printing terminology is required:
A 'Signature' is a sheet of paper as it is run through a printing press. A signature has a number of characteristics:
-Size (Width and Height)
-Type (Paper Brand)
-Inking - each side of the signature will receive one or more inks, and each side may have different ink combinations. It is also possible that only one side of the sheet receives ink.
-Work Style - to print both sides of the sheet, there are different ways of turning the paper over for printing the second side (horizontally or vertically), or, we have equipment that can print both sides of the sheet at the same time.
-Press - each signature will be assigned to a specific press
-Pages - each signature will carry one or more 'pages' . I also need to know the number of pages
-Binding Style - the printed sheet may be trimmed and/or folded to it's finished size by a specific bindery process.
-Quantity - This is the sum of 'Net Sheets' and 'Waste' (explanation ? - customer wants 10000, but some sheets are wasted in finishing, so we actually run maybe 11000, 10000 'NetSheets' + 1000 'WasteSheets')?
Additionally, a print project may be made of one or more signatures, and each of these signatures may have different characteristics.
A print project has a total quantity required, but each signature may not be printed in the same quantity, for example:
-Customer orders 10,000 pieces of a finished size 8.5" x 11" printed on both sides
-We print one signature containing 8 copies of the finished piece on a Sheet Size of 24" x 36". We print 1250 sheets (10000 divided by 8). We then trim each piece out to yield 10000 final pieces.
In a JDF file there is no single node that provides all this information. Depending on number of signatures, number of sides printed, this information will be nested to various levels. The class I need has to account for all the possible ? levels.
To get started, some nodes/attributes to examine in the JDF file would include (excerpted from one of the sample JDF's supplied in the zip file) :
The following nodes provides the SignatureName, DescriptiveName is the paper type, Dimension is the Width Height expressed in points (72 points to an inch):
<Media Brand="Customer's 12 PT ? Kallima C1S 28" x 40" FSC" DescriptiveName="Customer's 12 PT ? Kallima C1S 28" x 40" FSC" Dimension="2880 2016" Grade="2" GrainDirection="LongEdge" HDM:RawDimension="2880 2016" ProductID="(1)" SheetName="Cover" Thickness="100" Weight="236"/>
The following nodes provide inking information for the above named Signature:
<Ink Class="Consumable" ID="r100129_054430386_005205" PartIDKeys="SignatureName SheetName Side Separation" PartUsage="Implicit" Status="Available">
The following nodes provide the name of the Press (in the attribute DescriptiveName):
<Device Class="Implementation" DescriptiveName="Speedmaster CD 102-10-P" DeviceType="Speedmaster CD 102-10-P" FriendlyName="CD102-10-P" ID="r100129_054430386_005207" Status="Available">
The following nodes provides the number of pages and the page size (attributes Actual (num pages) , Finished Dimensions ( X Y dimensions expressed in points)
The following provides the BindingStyle for the above named signature (in the Actual Attribute):
<BindingIntent Class="Intent" ID="r100129_054430371_005187" Status="Available">
<BindingType Actual="SaddleStitch" DataType="EnumerationSpan" Preferred="SaddleStitch"/>
The following nodes provide the WorkStyle (in the WorkStyle Attribute):
<ConventionalPrintingParams Class="Parameter" ID="r100129_054430386_005200" PrintingType="SheetFed" Status="Incomplete" WorkStyle="WorkAndBack"/>
The following nodes provide the quantity of sheets to run (the Amount Attributes):
<ComponentLink Usage="Output" rRef="r100129_054430371_005189">
<Part SheetName="Cover" SignatureName="SIG001"/>
<Part Condition="Good" SheetName="Cover" SignatureName="SIG001"/>
<Part Condition="Waste" SheetName="Cover" SignatureName="SIG001"/>
In addition to the fields that I have extracted from the demo JDFReaderClass (which are all one time properties common to an entire project), the signature information should come out as an associative array (or? I'm open to suggestions).
Might look something like :
? ? ? ? ? ? ? ? ? ? ? ? ? $signatures = array('SignatureName' => 'SIG001',
'Width' => 222,?
'Height' => 111,
'Side1Ink' = 'ink1,ink2,ink3,ink4',
'Side2Ink' = 'ink1,...',
'PaperType' = > 'Customer's 70 lb. ROLLAND OPAQUE50 FSC ? 28" x 40',
'Press' => 'Speedmaster CD 102-10-P,
'Pages' => 1,
'PageWidth' => 8.5,
'PageHeight' => 11,
'BindingStyle' => 'WorkAndBack',
'NetSheets' => 2000,
'WasteSheets' => 625
? ? ? ? ? ? ? ? ? array('SignatureName' => 'SIG002' etc, etc
The coder should provide me a web link to a working test class where I might be able to establish the suitability of your efforts (and thereby protecting your coding, if that is a concern)
Thank you for your interest. A text file of this document is included in the zip file.