Compare file sizes

Post Reply
boxclever
Newbie
Posts: 13
Joined: Thu Aug 11, 2016 11:03 am
Location: France

Compare file sizes

Post by boxclever »

Hi to all.
I'm looking for an easier way to compare the trim size in an XML file to its PDF counterpart. I have something that works but it is so convoluted there must be a better/simpler way. Since we often get PDF files that come in at a different page size that what was quoted - 55*85 instead of 85*55 or 210x287 instead of 210x297 as examples - I'm looking to compare one against the other before actually going any further in our system (Prinergy from Kodak).

This starts with a submit point. A received PDF file will be added and a metadata field will ask for the quotation number. Once in the flux at an "execute command" element, we will look back at the data in the MIS software for that quote number and create an XML file with all important details such as the anticipated trim size.

Our quote, in XML format, will say that we're expecting a file size as :
<FF_Largeur>20</FF_Largeur>
<FF_Hauteur>26</FF_Hauteur>


The PDF that comes in for that quote I can pick up the real size like this and convert to mm :
[Switch.Calculation:Expression="round([Switch.Calculation:Expression="[Stats.TrimBoxWidth:Type="Defined"]/2.83465"])"]x[Switch.Calculation:Expression="round([Switch.Calculation:Expression="[Stats.TrimBoxHeight:Type="Defined"]/2.83465"])"]
so in this example we'll say it's 210x297

Once at this stage I just want to compare one size against the other but can't see through the trees...

What I've managed to get to work is renaming the XML file and adding as a suffix the path: (_[Switch.Calculation:Expression="[Metadata.Text:Dataset="Xml",Model="XML",Path="/InfoDevisMasterPrint/Composants/Item/FF_Largeur"]*10"]x[Switch.Calculation:Expression="[Metadata.Text:Dataset="Xml",Model="XML",Path="/InfoDevisMasterPrint/Composants/Item/FF_Hauteur"]*10"]) to give me filename_200x260.xml.

I rename the PDF file in the same way using the above path to give me filename_210x297.pdf

The xml and PDF were then added to a fixed folder path.

I then needed to add another "execute command" element with a vbs that will compare the baseNames of the xml and the PDF to see if they are the same or if there are different.

There must be a simpler/better way than this, though, and I would be very grateful for any pointers in the right direction.
Best
Sean
freddyp
Advanced member
Posts: 1023
Joined: Thu Feb 09, 2012 3:53 pm

Re: Compare file sizes

Post by freddyp »

You can create a Condition with variables on a connection in which you use [Stats.TrimBoxWidth] as the left-hand part of the condition and [Metadata.Rational:etc.] as the right-hand part of the condition. And there is of course another connection "All other jobs". Note the use of Rational and not Text!

The above assumes that the XML is a dataset of the PDF file. If both have the same name you achieve that with the "XML pickup" element with the option "Metadata alongside asset".

That is a lot easier than what you are describing, but it still requires lots of conditions. You want to compare both the width and the height, and you also want to allow for a certain margin of error (a 210mmx297mm PDF is a rare thing). So you will want to check for greater than 209.9 and smaller than 210.1, etc.

If you have PitStop Server it is easier to use a preflight profile with variables. The check for page sizes allows a margin and an option to ignore the rotation of the page.
boxclever
Newbie
Posts: 13
Joined: Thu Aug 11, 2016 11:03 am
Location: France

Re: Compare file sizes

Post by boxclever »

Hi Freddy
What I'm trying to get Switch to do is currently done by an RBA in Prinergy using variables. My objective is to check that the trim size received matches what we think we're going to get earlier than is currently being done and when a job is already inside the system. You're quite right too insomuch that the RBA has a 1mm tolerance to allow very slightly "off" pages.
I simply didn't think about using "include these jobs - define condition with variables" with one size on the left ant the other size on the right even though I have a few Switch flows that use this. You certainly pushed me in the right direction and it is way easier that the direction I took: I have the PDF trim box on the left and the metadata (rational) on the right. I now need to work towards not only allowing for a small tolerance but also for the times when I have multiple components with varying page sizes (half-width outer cover, full width cover, centre poster etc).
If you have PitStop Server it is easier to use a preflight profile with variables
I caught up with Loic's video, albeit one month late, explaining the preflight profile with variables as you suggested: a great video and a great idea that will most certainly be used.
Thanks again.
Sean
Post Reply