Counting Pages That are marked for Redactions

New Here ,
Mar 31, 2017 Mar 31, 2017

Copy link to clipboard

Copied

I have a 610 page document that is marked up for redactions. Is there a way to tell me how many pages have redactions? Or do I have to physically sit and count each page that has a redaction on it?

TOPICS
Edit and convert PDFs

Views

1.6K

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 31, 2017 Mar 31, 2017

Copy link to clipboard

Copied

It can be done with a simple script, which you can execute from the JS Console window. Press Ctrl+J to open that console, then paste the code below into it (overwriting any existing text there), select it ALL with the mouse/keyboard (Ctrl+A will do the trick), and then press Ctrl+Enter to run it.

this.syncAnnotScan();

var counter = 0;

for (var p=0; p<this.numPages; p++) {

    var annots = this.getAnnots({nPage: p});

    if (annots==null || annots.length==0) continue;

    for (var i in annots) {

        if (annots.type=="Redact") {

            counter++;

            break;

        }

    }

}

app.alert(counter + " pages contain Redaction annotations in this file.",3);

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 06, 2017 Apr 06, 2017

Copy link to clipboard

Copied

this didn't work.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 06, 2017 Apr 06, 2017

Copy link to clipboard

Copied

Care to elaborate?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 06, 2017 Apr 06, 2017

Copy link to clipboard

Copied

I was able to open the screens to paste the script code you provided and then I selected all the text by doing the CTRL + A and everything will highlight but nothing is happening when Pressing CTRL + Enter

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 06, 2017 Apr 06, 2017

Copy link to clipboard

Copied

Nothing at all? Are you sure you selected everything? Can you share a screenshot of what you're seeing?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 06, 2017 Apr 06, 2017

Copy link to clipboard

Copied

I cannot screen shot because I'm on a government computer doing Governement work. is it because I'm using Adobe Acrobat 11 ?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 06, 2017 Apr 06, 2017

Copy link to clipboard

Copied

No. I use that version too and it works fine.

On Thu, Apr 6, 2017 at 5:33 PM, kimberlyt8816 <forums_noreply@adobe.com>

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 06, 2017 Apr 06, 2017

Copy link to clipboard

Copied

Let's try to figure out why you cannot execute this script in your console. What operating system are you running on? Can you execute different scripts? This one-liner should display an alert dialog:

app.alert("It worked!");

If this does not work either, there is something wrong either with the way you are trying to execute scripts in the console, or with your JavaScript installation. If Javascript would be disabled on your computer, you should see a dialog after you try to execute the script, asking you if you want to enable JS support.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 06, 2017 Apr 06, 2017

Copy link to clipboard

Copied

Every time I copy and paste the code into the JavaScript Debugger it just comes up and says undefined. I tried the It worked one you provided and it worked just fine

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 06, 2017 Apr 06, 2017

Copy link to clipboard

Copied

"undefined" is not an error. When you ran my example, you may have noticed that the console printed a "1" after you closed the alert dialog. The JavaScript console will always print the return value of whatever you executed. If your code does not return anything, that value will be "undefined". So in general, "undefined" is not an indication for an error. It just tells you that your code did not return any values.

However, in your case, you should not see "undefined" - that is because your last line is actually an app.alert(), which will return the code of the button you pressed to dismiss the dialog. Because there is only an "OK" button, you should see again a "1" printed. Make sure that just the lines of the script are selected when you execute the code.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 06, 2017 Apr 06, 2017

Copy link to clipboard

Copied

To make sure that you're executing the full code I recommend you place it as a MouseUp script of a button field and then press that button. Also make sure to tick the option to show the JS Console on warnings and errors under Edit - Preferences - JavaScript.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 07, 2017 Apr 07, 2017

Copy link to clipboard

Copied

what you just told me to do was a complete foreign language. how do I do that?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 07, 2017 Apr 07, 2017

Copy link to clipboard

Copied

What version of Acrobat do you have?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 07, 2017 Apr 07, 2017

Copy link to clipboard

Copied

I have adobe acrobat XI pro

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 07, 2017 Apr 07, 2017

Copy link to clipboard

Copied

OK, then go to Tools - Forms - Edit. If asked whether you want Acrobat to detect fields for you click No.

Then click the Add New Field button and select Button.

Draw a button somewhere on the page.

Right-click it and select Properties.

Switch to the Actions tab and select "Mouse Up" as the trigger and "Run a JavaScript" as the action.

Click on Add and paste the FULL code I provided into the window that opens, and click OK, and then Close.

Now click the Close Form Editing button.

Click the button field you just added, and let us know what the results are.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 07, 2017 Apr 07, 2017

Copy link to clipboard

Copied

that worked it says 0 pages are marked for redactions.

I tried it again on a new document that has marks for redactions and this message comes up.

ReferenceError: counter is not defined 1:Console:Exec Undefined

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 07, 2017 Apr 07, 2017

Copy link to clipboard

Copied

Did you copy the whole code?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 07, 2017 Apr 07, 2017

Copy link to clipboard

Copied

LATEST

In the first example it worked. Either you're not using the correct tool for the redactions, or you already applied them...

In the second example you didn't copy the whole code, most likely. You really need to be careful about that.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines