Skip to main content
Participating Frequently
May 18, 2020
Question

[C++ SDK] Change overlay text color of redaction

  • May 18, 2020
  • 2 replies
  • 1090 views

I am writing a plugin that makes uses of the redaction capability in Acrobat.

I am able to create the redaction, and apply the redaction.

Currently, I can change the overlay text, and the color shown once the redaction is applied.

 

Is there a way to change the color of the overlay text in the C++ SDK?

 

Notes:

- I am using the PDRedactParams struct to specify the annotation properties (Acrobat _t_PDRedactParams struct documentation )

This topic has been closed for replies.

2 replies

Adobe Employee
May 19, 2020

Hi,

Can you try to set the value of textColor using setProps, give this a try and see if it works for you.

Thanks,

Charu Karwa

 

rkmtwoAuthor
Participating Frequently
May 19, 2020

The function PDRedactionSetProps() takes an annotation and a PDRedactParams struct as an input. The PDRedactParams struct has no textColor field.

The available fields are

struct _t_PDRedactParams {
 	ASUns32 size;	 
 	ASInt32 pageNum;	 
 	ASFixedQuad redactQuads;	 
 	ASUns32 numQuads;	 
 	PDColorValueRec colorVal;	 
 	ASText overlayText;	 
 	PDHorizAlign horizAlign;	 
}


Given that the SDK's PDRedactParams has no textColor field, how would I used it?

I am not sure how to use PDRedactionSetProps given the input parameters required.

I tried to cast a textColor to a PDRedactParams,

ASBool TextColorSuccess = PDRedactionSetProps(redaction, PDRedactParams(textColor))

but the IDE is flagging is as an error. I'm kinda flying blind on this one

========================================

I also tried to create an augmented version of the PDRedactParams by using a namespace to scope it

namespace AugmentedParam{
	typedef struct _t_PDRedactParams
	{
		ASUns32 size;
		ASInt32 pageNum;
		ASFixedQuad* redactQuads;
		ASUns32 numQuads;
		PDColorValueRec* colorVal;
		ASText overlayText;
		PDHorizAlign horizAlign;
		PDColorValueRec* textColor;

	} PDRedactParamsRec, *PDRedactParams;
}

When creating the new redaction parameters I used the scoped version, not the SDK's

AugmentedParam::PDRedactParams AugmentedRedactParams;

The results:

  • I can't use the Adobe functions calls that use PDRedactParams as an input as they are expecting the Adobe type struct, not the one I created
  • When I apply the redaction using ...
PDAnnot redaction = PDDocCreateRedaction(current_pdDoc, (PDRedactParams)AugmentedRedactParams) 
  • ... the resulting annotation is shifted down by a ~1/10 of an inch

 

Legend
May 20, 2020

This convenience function doesn’t set all possible redaction options. These are described in 32000-1 (PDF reference) or you can examine an existing annot. Since you have a PDAnnot you can set more options as for any annot subclass. I guess. 

Legend
May 18, 2020

I've never used it but it looks as if you just have to set colorval?

rkmtwoAuthor
Participating Frequently
May 18, 2020

I tried changing colorval, and that value sets the color shown once area is redacted. The overlay text stays black by default.