• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Redact using quads

New Here ,
Feb 29, 2016 Feb 29, 2016

Copy link to clipboard

Copied

If you have your redactions already marked is there a way to loop through and gather the coordinates while applying another process using Acrobat Pro 9.5?  I was looking at this,  https://acrobatusers.com/tutorials/auto_redaction_with_javascript , and other examples but they all seem to be static numbers for the quads.  I'd just like to apply a strikethrough on the redactions I have marked and if possible place a stamp based of the quads coordinates.

TOPICS
Acrobat SDK and JavaScript , Windows

Views

1.3K

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 ,
Feb 29, 2016 Feb 29, 2016

Copy link to clipboard

Copied

You can simply convert them from Redact annotations to StrikeOut ones by changing their type property. Adding a stamp next to them is also possible, but more complex to implement.

Votes

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 ,
Mar 17, 2016 Mar 17, 2016

Copy link to clipboard

Copied

Am I headed the right direction?

syncAnnotScan();

annots = getAnnots();

if (annots)

for (var i = 0; i < annots.length; i += 1) {

var rec = getAnnots(this.pageNum)[0].rect;

var left = rec[0];

var right = rec[2];

var top = rec[3];

var bot = rec[1];

        qd = [[left, top, right, top, left, bot, right, bot]];

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

  annot = this.addAnnot({

     type: "StrikeOut",

     strokeColor: color.red,

     quads:qd;

     }

   }

break;

}

Votes

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
LEGEND ,
Mar 17, 2016 Mar 17, 2016

Copy link to clipboard

Copied

This should be sufficient:

syncAnnotScan();

annots = getAnnots();

if (annots) {

    for (var i = 0; i < annots.length; i += 1) {

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

            annots.type = "StrikeOut";

        }

    }

}

Votes

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 ,
Mar 18, 2016 Mar 18, 2016

Copy link to clipboard

Copied

So I don't need to gather the quad coordinates to pass along unless I were dealing with a static value or is it not necessary with this method?

This worked well for search and redact annots but not the annots I made manually with mark for redaction.  What might be the difference?

I realized I would like a thicker line but I didn't see a point value for the line created with StrikeOut but I saw one for PolyLine.  I swapped "StrikeOut" for "PolyLine" but I didn't get any results.  Is there more information needed to create a PolyLine switching the property type? 

Votes

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 ,
Mar 21, 2016 Mar 21, 2016

Copy link to clipboard

Copied

I just get "undefined" in the console with the following but no reference to a line. Appreciate any help.

syncAnnotScan();

annots = getAnnots();

if (annots) {

    for (var i = 0; i < annots.length; i += 1) {

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

            var rec = annot.rect;

            var left = rec[0];

            var right = rec[2];

            var top = rec[3];

            var bot = rec[1];

            var annot = this.addAnnot({type: "Line"})

            annot.setProps({

                                       points: [[left,bot],[right,top]]

                                       strokeColor: color.red

                                     });

        }

    }

}

Votes

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 21, 2016 Mar 21, 2016

Copy link to clipboard

Copied

LATEST

"undefined" just means it ended running without errors. Did you make sure to select all of the code before running it (if you're doing it from the console)?

Beside that you're not using the addAnnot method correctly. You have to specify several more parameters than just the annot type...

Votes

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