Hi, I need to round incoming PDF trimbox to whole millimetres without decimals.
If the trimbox of the incoming PDF is 50,4x50,5 mm I need the result in my PrivateData to be 50x51. I'm guessing that I need to use Stats.TrimBoxWidth and Stats.TrimBoxHeight and Switch Calculation some how?
Rounded trimbox values as PrivateData
- magnussandstrom
- Advanced member
- Posts: 365
- Joined: Thu Jul 30, 2020 6:34 pm
- Location: Sweden
- Contact:
Re: Rounded trimbox values as PrivateData
You can use the round-function with the calculations. So your variable construction could look something like this:
Depending on your settings I think you might need to calculate the width and height from points to mm within the other calculation.
Code: Select all
[Switch.Calculation:Expression="round([Stats.TrimBoxWidth:Type="Defined"])"]x[Switch.Calculation:Expression="round([Stats.TrimBoxHeight:Type="Defined"])"]
- magnussandstrom
- Advanced member
- Posts: 365
- Joined: Thu Jul 30, 2020 6:34 pm
- Location: Sweden
- Contact:
Re: Rounded trimbox values as PrivateData
Thanks! I did it in two steps, it seems to be working.
In the first folder (PrivateData) convert to mm:
The second folder (PrivateData) round mm:
Please enlighten me if there is a better way!
In the first folder (PrivateData) convert to mm:
Code: Select all
width_mm=[Switch.Calculation:Expression="[Stats.TrimBoxWidth:Type="Defined"]/2.83465"]
height_mm=[Switch.Calculation:Expression="[Stats.TrimBoxHeight:Type="Defined"]/2.83465"]
Code: Select all
new_size=[Switch.Calculation:Expression="round([Job.PrivateData:Key="width_mm"])"]x[Switch.Calculation:Expression="round([Job.PrivateData:Key="height_mm"])"]
Re: Rounded trimbox values as PrivateData
You could combine both steps into one:
Code: Select all
new_size=[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"])"]
- magnussandstrom
- Advanced member
- Posts: 365
- Joined: Thu Jul 30, 2020 6:34 pm
- Location: Sweden
- Contact: