Author Topic: Displaying PDF Page Size in Windows Explorer  (Read 42855 times)

0 Members and 1 Guest are viewing this topic.

Nick Riviera

  • Newbie
  • *
  • Posts: 22
Re: Displaying PDF Page Size in Windows Explorer
« Reply #30 on: April 29, 2022, 07:15:40 AM »
Hello,
I work with pdfs that contains internal measurements (cropbox, trimbox..)
Can you make a script that show the  trim  and bleed box size in Windows Explorer ?
eg. 215.9 x 279.4mm+5mm
Thank you very much.

Code: [Select]
var ProgressBar = pdfe.ProgressBar;
ProgressBar.max = pdfe.SelectedFiles.Count;

for (var i = 0; i < pdfe.SelectedFiles.Count; i++) {
    ProgressBar.position = i + 1;
    var file = pdfe.SelectedFiles(i);
    var Page = file.Pages(0);
    if (Page) {
        var w = Math.min(Page.Width, Page.Height);
        var h = Math.max(Page.Width, Page.Height);
        var PSizeStr = w.toFixed() + 'x' + h.toFixed();
        var FileMetadata = file.Metadata;
        if (FileMetadata.PageSize !== PSizeStr) {
            FileMetadata.PageSize = PSizeStr;
            if (FileMetadata.CommitChanges()) {
                pdfe.echo(file.Filename + ' : (' + PSizeStr + ') [OK]');

            } else {
                pdfe.echo(file.Filename + ' [commit changes failed]', 0xFF0000);
            }
        } else {
            pdfe.echo(file.Filename + ' : (' + PSizeStr + ') [already set]');
        }
    }
}
pdfe.echo("Done");

RTT

  • Administrator
  • *****
  • Posts: 918
Re: Displaying PDF Page Size in Windows Explorer
« Reply #31 on: April 29, 2022, 03:38:22 PM »
Check reply 5, at this trim + bleed size topic started by you.

chrisrace

  • Newbie
  • *
  • Posts: 2
Re: Displaying PDF Page Size in Windows Explorer
« Reply #32 on: March 16, 2023, 09:51:10 AM »
Hi - great scripts! We use a lot of PDF's (we're architects) would it be possible for this script to run automatically or create a ribbon button to run this automatically? Just wanting to make the process as simple as possible for the guys. Thanks Chris

RTT

  • Administrator
  • *****
  • Posts: 918
Re: Displaying PDF Page Size in Windows Explorer
« Reply #33 on: March 17, 2023, 03:19:08 AM »
You may use the RunScript command line function to run the script from a shortcut, batch file, PowerShell script, etc.
But it's easy for the user to manually select the PDF files that have the specific column empty (sorting by that column), invoke the right click menu and call the script from the PDF-ShellTools sub-menu.