6 Replies Latest reply on Mar 21, 2016 12:34 PM by try67

    Redact using quads

    christopher.l.evans

      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.

        • 1. Re: Redact using quads
          try67 MVP & Adobe Community Professional

          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.

          • 2. Re: Redact using quads
            christopher.l.evans Level 1

            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[i].type === "Redact") {

              annot = this.addAnnot({

                 type: "StrikeOut",

                 strokeColor: color.red,

                 quads:qd;

                 }

               }

            break;

            }

            • 3. Re: Redact using quads
              George_Johnson MVP & Adobe Community Professional

              This should be sufficient:

               

              syncAnnotScan();

              annots = getAnnots();

               

              if (annots) {

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

                      if (annots[i].type === "Redact") {

                          annots[i].type = "StrikeOut";

                      }

                  }

              }

              • 4. Re: Redact using quads
                christopher.l.evans Level 1

                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? 

                • 5. Re: Redact using quads
                  christopher.l.evans Level 1

                  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[i].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

                                                       });

                          }

                      }

                  }

                  • 6. Re: Redact using quads
                    try67 MVP & Adobe Community Professional

                    "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...