Set private data based on Pitstop Server log
Posted: Mon Jan 27, 2025 10:40 am
In a flow I need to change the color of a mark on the pdf based on which colors are used.
So if the job contains Cyan the mark needs to be Cyan.
If it does not contain Cyan but contains Magenta the mark needs to Magenta.
Otherwise it needs to be Black.
My thought was to have Pitstop Server report the ink usage to me.
Then use a script expression to analyse the XML-log.
But I am a bit unsure how to read the XML dataset in a script expression.
I hope someone can point me in the right direction.
The logic for choosing the color seems pretty straight forward.
This is the XML I get returned from Pitstop Server.
So if the job contains Cyan the mark needs to be Cyan.
If it does not contain Cyan but contains Magenta the mark needs to Magenta.
Otherwise it needs to be Black.
My thought was to have Pitstop Server report the ink usage to me.
Then use a script expression to analyse the XML-log.
But I am a bit unsure how to read the XML dataset in a script expression.
I hope someone can point me in the right direction.

The logic for choosing the color seems pretty straight forward.
Code: Select all
if (inkNames.includes("Cyan")) {
return "Cyan";
} else if (inkNames.includes("Magenta")) {
return "Magenta";
} else {
return "Black";
}
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<EnfocusReport version="3.0" unit="mm" xml:lang="en-US">
<PreflightReport errors="0" criticalfailures="0" noncriticalfailures="0" signoffs="0" fixes="0" warnings="0" informations="1">
<Informations>
<PreflightReportItem ActionID="3159">
<Message>Document uses 4 separations, should be equal to 0. Those 4 separations are: Black, Cyan, Magenta, Yellow</Message>
<StringContext>
<BaseString>Document uses %NumberOfSeparations% separations, should be %Comparator% %ReferenceNumberOfSpotColors%. Those %NumberOfSeparations% separations are: %SeparationNames%</BaseString>
<Var name="ReferenceNumberOfSpotColors">0</Var>
<Var name="Comparator">equal to</Var>
<Var name="NumberOfSeparations">4</Var>
<Var name="SeparationNames">Black</Var>
<Var name="SeparationNames">Cyan</Var>
<Var name="SeparationNames">Magenta</Var>
<Var name="SeparationNames">Yellow</Var>
</StringContext>
</PreflightReportItem>
</Informations>
</PreflightReport>
<ProcessInfo>
<PageRange>1</PageRange>
<HostAppName>Enfocus PitStop Server 24.11</HostAppName>
<EngineFlavor>Enfocus PitStop Library 24.11</EngineFlavor>
<PreflightDateTime>2025-01-24T14:29:54+01:00</PreflightDateTime>
</ProcessInfo>
<GeneralDocInfo>
<DocumentProperties>
<DocumentName>_0P4LA_89215590.pdf</DocumentName>
<NumPages>1</NumPages>
<PDFVersion major="1" minor="6">1.6</PDFVersion>
<CreationDate>2024-10-10T05:44:03+02:00</CreationDate>
<ModificationDate>2024-10-10T05:44:03+02:00</ModificationDate>
<Producer>Adobe PDF Library 17.0</Producer>
<Creator>Adobe InDesign 19.5 (Macintosh)</Creator>
<Author></Author>
<Title></Title>
<Subject></Subject>
<Keywords></Keywords>
<Trapped>false</Trapped>
<PrinergyTraps>false</PrinergyTraps>
<WasRepairedOnOpen>false</WasRepairedOnOpen>
<IsLinearized>true</IsLinearized>
<ContainsThumbnails>false</ContainsThumbnails>
<LeftToRightReading>left</LeftToRightReading>
<ContainsJobTicket>false</ContainsJobTicket>
</DocumentProperties>
<DocumentSecurity>
<EncryptionType>none</EncryptionType>
<Permissions>
<ExtractAccessibility>true</ExtractAccessibility>
<ExtractNonAccessibility>true</ExtractNonAccessibility>
<ModifyNotes>true</ModifyNotes>
<ModifyFillAndSign>true</ModifyFillAndSign>
<ModifyAssembleDoc>true</ModifyAssembleDoc>
<ModifyOther>true</ModifyOther>
<ModifySecurity>true</ModifySecurity>
<PrintLowQuality>true</PrintLowQuality>
<PrintHighQuality>true</PrintHighQuality>
</Permissions>
</DocumentSecurity>
<DocumentCompression>
<DataFormat>binary</DataFormat>
<IsCompressed>true</IsCompressed>
<FilterType>ZIP</FilterType>
</DocumentCompression>
</GeneralDocInfo>
<ColorInfo>
<ColorSpace type="ICCBased" id="CS1" isValid="true">
<ICCName>sRGB IEC61966-2.1</ICCName>
<ICCSpace>DeviceRGB</ICCSpace>
<ICCProfileID>1d3fda2edb4a89ab60a23c5f7c7d81dd</ICCProfileID>
<Ranges>
<Range name="R" min="0" max="1"/>
<Range name="G" min="0" max="1"/>
<Range name="B" min="0" max="1"/>
</Ranges>
<Location page="1" minX="0" minY="6.125" maxX="4.985" maxY="15.655"/>
</ColorSpace>
</ColorInfo>
<PageColorTypeInfo emptyPages="0" blackAndWhitePages="0" colorPages="1">
<Page index="1" colorType="color"/>
</PageColorTypeInfo>
<InkInfo>
<DocumentInkInfo>
<PaperArea>1100.16</PaperArea>
<InkArea>147.58</InkArea>
<InkPercentage>13.41</InkPercentage>
<Ink name="Cyan">
<Area>24.32</Area>
<Percentage>2.21</Percentage>
</Ink>
<Ink name="Yellow">
<Area>1.57</Area>
<Percentage>0.14</Percentage>
</Ink>
<Ink name="Black">
<Area>121.68</Area>
<Percentage>11.06</Percentage>
</Ink>
</DocumentInkInfo>
<PageInkInfo page="1">
<PaperArea>1100.16</PaperArea>
<InkArea>147.58</InkArea>
<InkPercentage>13.41</InkPercentage>
<Ink name="Cyan">
<Area>24.32</Area>
<Percentage>2.21</Percentage>
</Ink>
<Ink name="Yellow">
<Area>1.57</Area>
<Percentage>0.14</Percentage>
</Ink>
<Ink name="Black">
<Area>121.68</Area>
<Percentage>11.06</Percentage>
</Ink>
</PageInkInfo>
</InkInfo>
</EnfocusReport>