Page 1 of 1

Redaction - DrawFilledRectangle vs BurnAnnotationsToPage

Posted: Mon Oct 18, 2021 8:22 pm
by random1
I have a .Net windows forms app that needs to redact TIFF images. I noticed the PDF library has specific redaction methods but nothing in the GDViewer/GdPictureImaging stack.

I don't have a need to move/edit redactions and burn them with a separate button like the sample code does. I basically I need to draw a rectangle and have it burn immediately upon completion. The user needs to redact multiple times, so there could be multiple burns. I see two approaches:

1) Put the viewer MouseMode in MouseModeAreaSelection to create the rectangle selection and on the mouse-up event call DrawFilledRectangle to add the block. When this completes, we need to reload the viewer.

2) Put the viewer in redaction mode by calling AddRectangleAnnotInteractiveand on the AnnotationAddedByUser event call the BurnAnnotationsToPage method. Then re-add the redaction by re-calling AddRectangleAnnotInteractiveand. I did notice that if I interact with the GD Viewer (changing pages, etc.) it will turn off the interactive rectangle.

Two questions:
1) Do both offer the same security of redaction ? IE not possible to remove the redacted blocks to view text.
2) Is there any performance advantages of one approach over the other ?

Re: Redaction - DrawFilledRectangle vs BurnAnnotationsToPage

Posted: Wed Oct 20, 2021 3:39 pm
by Fabio
Hello there,

Burning an annotation and redacting a document look the same but are completely different.
A burn, will just "fuse" the annotation to your document. All the layers behind it will still be there even if you do not see them.
The redaction will completely destroy everything behind the redacted mark. (even within the metadata!)

The difference is mainly about the security and confidentiality of the document. They are also managed differently on our SDK since we do not consider the redaction as an annotation.

Now for the second part, I do not think one solution or the other will not be really different in terms of performances (at least some milliseconds). Everything in GdPicture was made to be the fastest possible.

With best,
Fabio

Re: Redaction - DrawFilledRectangle vs BurnAnnotationsToPage

Posted: Thu Oct 21, 2021 4:21 pm
by random1
Thanks Fabio. The drawfilledrectangle seems to be working but I am noticinig something odd. When I add some of the rectangle blocks, the size of the image increases dramatically. For example, if I have a tiff that outputs to a 70k PDF, this increases to 700k when I add the rectangles. Is there a way to add the rectangles without the increase in size ?

Dim drawRecStatus As GdPictureStatus = objImaging.DrawFilledRectangle(redactedDocument, intLeft, intTop, intWidth, intHeight, Color.Black, False)

Re: Redaction - DrawFilledRectangle vs BurnAnnotationsToPage

Posted: Mon Oct 25, 2021 2:40 pm
by Fabio
Hello,

Could you share an input file and a complete code snippet to let me test the issue on my side?

With best,
Fabio

Re: Redaction - DrawFilledRectangle vs BurnAnnotationsToPage

Posted: Fri Oct 29, 2021 1:50 pm
by random1
Thanks Fabio. My old snippet is below:

intLeft = gdViewer.GetRectLeftOnDocument()
intTop = gdViewer.GetRectTopOnDocument()
intWidth = gdViewer.GetRectWidthOnDocument()
intHeight = gdViewer.GetRectHeightOnDocument()

Dim drawRecStatus As GdPictureStatus = objImaging.DrawFilledRectangle(redactedDocument, intLeft, intTop, intWidth, intHeight, Color.Black, False)

gdViewer.ClearRect()
Dim refreshViewerStatus As GdPictureStatus = gdViewer.Redraw()


I did notice the compression changes from TiffCompressionCCITT4 to TiffCompressionLZW after I redraw the viewer. So I've found that this helps:

'the DrawFilledRectangle function automatically converts iamge to TiffCompressionLZW compression
'as it needs color. convert back to 1bpp B&W .
Dim converstatus As GdPictureStatus = objImaging.ConvertTo1BppFast(redactedDocument)

Does that sound correct or is there a more efficient way to do it ?

Re: Redaction - DrawFilledRectangle vs BurnAnnotationsToPage

Posted: Thu Nov 04, 2021 12:53 pm
by Fabio
Hello,

I tried to reproduce the issue but without success, I think I missed a point here.
Could you create a minimalistic sample that reproduces the issue and it to us?

Do not hesitate to delete the DLL and the bin/obj/packages folder to reduce the size of the compressed sample.

With best,
Fabio