PDF-ShellTools > General

trim + bleed size

(1/2) > >>

Nick Riviera:
Hi,

I have this script (from RTT) which adds in the file name the  trim box size  ex "test_210x297 mm.pdf"

In this script can be added also the bleed size? ex "test_210x297 mm + 10 mm bleed.pdf".
If there is no bleed in the document then  "test_210x297 mm + 0 mm bleed.pdf"

Thanks a lot


--- Code: ---function TS() {
   var Size = '';
    var Page = BatchFile.Pages(0);
    if (Page) {
        var box = Page.TrimBox ? Page.TrimBox : Page.CropBox ? Page.CropBox : Page.MediaBox;
        if (Page.Rotation == 90 || Page.Rotation == 270) {
            Size = GetDist_mm(box.top, box.bottom).toFixed() + 'x' + GetDist_mm(box.left, box.right).toFixed() + ' mm';
        } else {
            Size = GetDist_mm(box.left, box.right).toFixed() + 'x' + GetDist_mm(box.top, box.bottom).toFixed() + ' mm';
        }
    }
    BatchFile.close();
    return Size;
}

function GetDist_mm(x1, x2) {
    return Math.abs(x1 - x2) * 25.4 / 72
}
--- End code ---

RTT:
The bleed box, as all the other page boundary boxes in PDF (crop, trim, etc) is a rectangle defined by 4 corners coordinates. I suppose the bleed size you want to know is the difference between the trim and bleed boxes? Because these are rectangles, it may result in 4 different values, i.e. left, top, right and bottom bleed sizes. Do you want all the 4, just the maximum, or this is just a scenario not happening with your PDFs?

Nick Riviera:

--- Quote from: RTT on April 30, 2021, 04:22:14 AM --- I suppose the bleed size you want to know is the difference between the trim and bleed boxes?

--- End quote ---

that's exactly  I want
I work only on pdf documents whit bleed equal for all sides,
so I  need the bleed size  for only one side

I think.. something like that (bleedbox - trimbox) / 2"


Thanks for help!

RTT:
From the renamer tool scripts editor, import the attached script or manually create a new script, name it BleedSize and paste the next code into the script content.

--- Code: ---function BleedSize() {
    var Size = '';
    var Page = BatchFile.Pages(0);
    if (Page) {
        var TrimBox = Page.TrimBox ? Page.TrimBox : Page.CropBox ? Page.CropBox : Page.MediaBox;
        var BleedBox = Page.BleedBox ? Page.BleedBox : Page.CropBox ? Page.CropBox : Page.MediaBox;
        Size = GetDist_mm(BleedBox.top, TrimBox.top).toFixed() + ' mm';
    }
    BatchFile.close();
    return Size;
}

function GetDist_mm(x1, x2) {
    return Math.abs(x1 - x2) * 25.4 / 72
}
--- End code ---

Rename expression:
[F]_[TS] + [BleedSize] bleed

 

nightslayer23:
This is a handy Script! Could it be tweaked to instead of adding the bleed or trim box size to the filename, but add it to a custom handle in explorer?

TRIM BOX
BLEED BOX
ART BOX

All go to their own respective Property Handler ? (no filename change)

Navigation

[0] Message Index

[#] Next page

Go to full version