Skip to main content
Known Participant
March 17, 2018
Answered

Redaction using the default values from the properties dialog?

  • March 17, 2018
  • 1 reply
  • 1207 views

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?

This topic has been closed for replies.
Correct answer Thom Parker

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.

1 reply

Thom Parker
Community Expert
Community Expert
March 17, 2018

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 PDFScriptingUse the Acrobat JavaScript Reference early and often
Known Participant
March 17, 2018

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.

Thom Parker
Community Expert
Thom ParkerCommunity ExpertCorrect answer
Community Expert
March 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 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 PDFScriptingUse the Acrobat JavaScript Reference early and often