Recent Posts

Pages: [1] 2 3 ... 10
1
General / Re: Displaying PDF Page Size in Windows Explorer
« Last post by RTT on June 05, 2019, 01:13:03 AM »
Check if the attached script, a modification of the first script to also fill a PageOrientation named property, does the job.
Don't forget to configure a metadata property named "PageOrientation", before testing.
The script code, for easy reference.
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;
        var Changed = false;
        if (FileMetadata.PageSize !== PSizeStr) {
            FileMetadata.PageSize = PSizeStr;
            Changed = true;
        }
        var PageOrientationStr;
        (Page.Height > Page.Width) ? PageOrientationStr = 'Portrait' : PageOrientationStr = 'Landscape';
        if (FileMetadata.PageOrientation !== PageOrientationStr) {
            FileMetadata.PageOrientation = PageOrientationStr;
            Changed = true;
        }
        if (Changed) {
            if (FileMetadata.CommitChanges()) {
                pdfe.echo(file.Filename + ' : (' + PSizeStr + ' - ' + PageOrientationStr + ') [OK]');

            } else {
                pdfe.echo(file.Filename + ' [commit changes failed]', 0xFF0000);
            }
        } else {
            pdfe.echo(file.Filename + ' : (' + PSizeStr + ' - ' + PageOrientationStr + ') [properties already set]');
        }
    }
}
pdfe.echo("Done");
2
General / Re: Displaying PDF Page Size in Windows Explorer
« Last post by nightslayer23 on June 04, 2019, 05:04:03 AM »
Hi again, could I request an add on to this script? Say keep everything as it is, but make another metadata entry for a Property Handle called "orientation" whereby, if the height > width of PDF size, then add metadata 'orientation' called "Portrait". Likewise, for if width > height then 'orientation' = "Landscape"
3
General / Re: rename page size file
« Last post by Urraco on May 28, 2019, 12:51:51 PM »
I updated the script but still same error." Unable to rename..."
It's working here, with the 3.3 version and Windows 10.
Did you deleted the the old one, from the list of scripts, before importing the updated script? If not, it's still using the old one, and the imported script ended named PageSize1.

Quote
About format if you can, i want to get trimbox size of the pdf document and if does not contain trim size, return cropbox or mediabox size

Check if this one works:
Code: [Select]
function PageTrimSize() {
    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
}

Type [F]_[PageTrimSize] in the tool rename formula field, to use this new script.



It works!
Thank for help, I appreciate it
Great software, I recommend.

4
General / Re: rename page size file
« Last post by RTT on May 25, 2019, 01:21:26 AM »
I updated the script but still same error." Unable to rename..."
It's working here, with the 3.3 version and Windows 10.
Did you deleted the the old one, from the list of scripts, before importing the updated script? If not, it's still using the old one, and the imported script ended named PageSize1.

Quote
About format if you can, i want to get trimbox size of the pdf document and if does not contain trim size, return cropbox or mediabox size

Check if this one works:
Code: [Select]
function PageTrimSize() {
    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
}

Type [F]_[PageTrimSize] in the tool rename formula field, to use this new script.

5
General / Re: rename page size file
« Last post by Urraco on May 24, 2019, 07:38:41 AM »
Apparently it works, but when I try to rename the file, I get this error: Unable to rename file - The process cannot access the file because it is being used by another process.
My bad. I've update the above script to fix the issue.

..and..can i get the "trim" page size format of pdf ?
Do you mean the size of the PDF page trimbox, that reverts to the cropbox, or mediabox, if that box property is not defined?


I updated the script but still same error." Unable to rename..."
About format if you can, i want to get trimbox size of the pdf document and if does not contain trim size, return cropbox or mediabox size

Thanks


6
General / Re: rename page size file
« Last post by RTT on May 23, 2019, 03:14:47 PM »
Apparently it works, but when I try to rename the file, I get this error: Unable to rename file - The process cannot access the file because it is being used by another process.
My bad. I've update the above script to fix the issue.

..and..can i get the "trim" page size format of pdf ?
Do you mean the size of the PDF page trimbox, that reverts to the cropbox, or mediabox, if that box property is not defined?
7
General / Re: rename page size file
« Last post by Urraco on May 23, 2019, 10:32:41 AM »
Thank you for your prompt answer!
Apparently it works, but when I try to rename the file, I get this error: Unable to rename file - The process cannot access the file because it is being used by another process.
..and..can i get the "trim" page size format of pdf ?

Thanks and a good day!
8
General / Re: rename page size file
« Last post by RTT on May 23, 2019, 12:42:32 AM »
A better method would be to show the sizes in a Windows Explorer column, as discussed in this forum thread: Displaying PDF Page Size in Windows Explorer.

But, if you really want to go with the file rename method, you may use the rename tool, with the help of this script (also attached bellow).
Code: [Select]
function PageSize() {
    var Size = '';
    var Page = BatchFile.Pages(0);
    if (Page) Size = Page.Width.toFixed() + 'x' + Page.Height.toFixed() + ' mm';
    BatchFile.close();
    return Size;
}

Select all the files you want to rename and start the rename tool. Click the tool rename formula field right arrow and, from the menu that will show up, open the scripts editor, menu item "Scripts>Manage Scripts...". From this script editor main menu, import the bellow attached script (after unzipped) and close the editor (saving the changes).
You can now type [F]_[PageSize] in the tool rename formula field, to achieve the file name schema you are requesting.
9
General / rename page size file
« Last post by Urraco on May 22, 2019, 02:36:44 PM »
Hi
I have a hundreds of pdf files

I do not want to open every pdf file to see what format is...
It's possible to rename this files whit page size included?

Ex: Test.pdf   =  > Test_210x297 mm.pdf

Many thanks!!!
10
General / Re: PDF Merge - Unknown Error
« Last post by RTT on April 18, 2019, 09:16:02 PM »
Make sure you are using the current 3.3 version.
How many pages has each PDF? Are you merging all the pages, or specifying a range?

if you can, send me these two PDF, attached to an email, so I can try it here.
Pages: [1] 2 3 ... 10