Compare file sizes
Posted: Tue Nov 07, 2023 4:23 pm
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
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