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

Redaction using the default values from the properties dialog?

Explorer ,
Mar 17, 2018 Mar 17, 2018

Copy link to clipboard

Copied

I am trying to create a plugin that redacts words in the same fashion as the ones you are creating manually. But I am having a hard time figuring out how this can be done. I have played around with PDRedactParams and PDApplyRedactionParams but with no luck. It always create the redaction with my "custom" values for color etc.

So what I am basically asking is how to programatically create redaction annotations with the same parameters as used in "Properties" for redaction annotations  in Acrobat DC?

TOPICS
Acrobat SDK and JavaScript

Views

702

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

correct answers 1 Correct answer

Community Expert , Mar 17, 2018 Mar 17, 2018

In order for the Redact Annotation to display something it must have an appearance. The appearance is a stream object containing a set of drawing operators. Its a standard PDF content/xobject stream. In fact, the redact AP dict has 3 appearance entries,  Normal (what you see on the page), Rollover, and Mouse Down. I don't believe that these are setup right away by the creation of the annot from the SDK. You have to force Acrobat to make them. I seem to remember there was a flag, or Annot dict en

...

Votes

Translate

Translate
Community Expert ,
Mar 17, 2018 Mar 17, 2018

Copy link to clipboard

Copied

I'm not completely solid on this point, but I believe that all the Redact Annot Properties in the Properties dialog are also entries in the Cos Dict for the Annot, so you can set them to whatever you want at the Cos level. You can test this by making changes to the redact properties and then examining the cos structure. You can also make changes to the Cos structure and then see what the properties dialog shows (if you have PDF CanOpener this is an easy task) You should also read the Redact annot section of the PDF spec.

I also believe, but haven't tested, that you can make the final redact appearance match whatever you want by creating your own RO stream.

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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
Explorer ,
Mar 17, 2018 Mar 17, 2018

Copy link to clipboard

Copied

Thanks!

But uhh..it sounds complicated. I have just started out with the SDK, so I am unfortunately not familiar with everything yet. Looks like I have some homework to do regarding the Cos Layer

My initial problem was that when I added the redact annotation (before applying it with PDDocApplyRedactions), it would not show anything unless I hovered the mouse over it. I thought I should have the same box and rectangle like you get when applying it manually. Thats why I thought I did something wrong and I should have gotten the same with my code.

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

Copy link to clipboard

Copied

In order for the Redact Annotation to display something it must have an appearance. The appearance is a stream object containing a set of drawing operators. Its a standard PDF content/xobject stream. In fact, the redact AP dict has 3 appearance entries,  Normal (what you see on the page), Rollover, and Mouse Down. I don't believe that these are setup right away by the creation of the annot from the SDK. You have to force Acrobat to make them. I seem to remember there was a flag, or Annot dict entry that tells Acrobat an annot appeance needs to be created, but I don't remember exactly what is.  You'll have to read the spec on Annotations.

Learning the SDK is a big hill to climb because to understand it, you also need to understand the PDF spec. But when you start understanding how a PDF is put together, the SDK will become easy.

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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
Explorer ,
Mar 18, 2018 Mar 18, 2018

Copy link to clipboard

Copied

Than you very much Thom. This has been very helpful. If someone has a book or web site to recommend to speed up the learning process it would be appreciated.

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
Explorer ,
Mar 18, 2018 Mar 18, 2018

Copy link to clipboard

Copied

LATEST

Thom, after a lot of hairs pulled out I finally figured it out. You pointed me to the right direction with the Cos objects. To show the redact annotations I had to create a Cos array (color) for the object of "OC" and apply it to the annotation. Now I have a rectangle around it. Next step would be to figure out the properties dialog. Looks like your PDF CanOpener are the right tool for this

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