Unplanned
Last Updated: 21 Sep 2017 11:16 by ADMIN
Swetha
Created on: 10 May 2017 15:30
Category: PDFViewer
Type: Feature Request
2
PdfViewer: Support for annotations of type Redact
The redaction annotation is described in the following PDF reference document:
http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/pdf_reference_addendum_redaction.pdf

You may also see sample document with this annotation type attached.

Since LIB Version 2017.3.925 annotations of type Redact can be visualized.
5 comments
ADMIN
Deyan
Posted on: 18 May 2017 11:14
Hello Scott,

Unfortunatelly, the unsupported annotations are skipped during the import, so you cannot access their rectangles with Telerik's API. 

As for the units conversion calculations - I may give some hint that may help you achieve accurate calculations. RadPdfProcessing uses Device Independent Pixels (DIP) for its units and it positions the coordinate system by centering it at top left corner of the page with Y axis pointing down. Originally the PDF format uses Points for its units and it positions the coordinate system by centering it at bottom left corner of the page with Y axis pointing up. I am not sure about the library you have mentioned but most PDF libraries stick to the original PDF coordinate system and units. If this is the case, you should be able to convert the rectangles to RadPdfProcessing coordinate system by using code similar to the one below:

public static Rect ConvertRectToTopLeftDipCoordinateSystem(Rect rect, double radFixedPageHeight)
{
	double x = Unit.PointToDip(rect.X);
	// The rect.Height may not be necessary in these calculation in case when rect.Y is defining the top left corner point coordinate and not the bottom left corner point.
	double y = radFixedPageHeight -  Unit.PointToDip(rect.Y + rect.Height);
	double width = Unit.PointToDip(rect.Width);
	double height = Unit.PointToDip(rect.Height);
	
	return new Rect(x, y, width, height);
}

You may notice the comment in the method which states that the rect.Height may or may not be needed for Y calculations depending on rect.Y coordinate meaning.

I hope this is helpful. If you have other questions please open a support ticket as it is preferable for such discussions.

Regards,
Deyan
Scott
Posted on: 17 May 2017 17:37
Hello Deyan,

Thank you for the quick response. We are just looking for a read-only visualization, so I've voted for the feedback item that you linked to.

Also, thank you for linking to the highlight sample. I was very nearly able to make it work exactly as needed:

- I was able to modify it to show a red box instead of yellow background,
- I was able to use PDFSharp to get a list of redact annotations
- I was able to add a red box for each redact annotation

The issue that I came across is that PDFSharp and RadFixedDocument have different methods/units for measuring and arranging pages. I was able to adjust it a little by detecting the relative page sizes and scaling proportionally, but there are just too many variables between the two libraries. No matter how much I tweak to make it approximately right, I can't trust it to be accurate for all documents.

Is there a way to access a collection of all annotations (other than just links) from Telerik libraries? If I could, I could access the type and rect entries to get the annotation coordinates directly from Telerik.

Thank you for all of your help with this. I hope that you have a good day,

Scott
ADMIN
Deyan
Posted on: 17 May 2017 11:41
Hello Scott,

Thank you for the clarifications. We have now approved the feedback item. As you are following it, you will be notified when its status is changed from "Approved" to "In Development".

If you are interested only in visualizing the Redact annotation appearance (normal, mouse down and mouse over state), then you may also vote for and follow for this feedback item:
https://feedback.telerik.com/Project/143/Feedback/Details/210601-pdfviewer-implement-read-only-rendering-for-all-annotation-types

Meanwhile, you may take a look at the following forum post demo showing how to implement custom highlighting of some text in a PDF file and then save the higlights in a modified PDF using geometries. Although, this approach for marking some text is not using Redact annotations, there is some chance that it suits your needs in the concrete scenario. Here is the link to the forum post describing this demo in more details:
http://www.telerik.com/support/code-library/select-text-and-annotate-pdf#YJXa2UbmYEi6UOBR8vfOOA

If you have other questions or concerns you may open a new support ticket.

Regards,
Deyan
Scott
Posted on: 16 May 2017 15:52
Good morning Deyan,

I'm Scott, and I'm working with Swetha on the project that generated this request. Thank you for taking the time to get back to us. Redaction annotations (of type 'Redact') are described in an addendum to the reference document that you mention:

http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/pdf_reference_addendum_redaction.pdf

When adding a redact annotation through Acrobat Pro, Acrobat will also create a Popup annotation, in addition to the Redact annotation. I've attached a PDF that shows an example of this.

In the software that we are working on, we would like our users to be able to review their marked redactions directly. Right now, we allow then to open the file in Acrobat, but this is less convenient to the users than if the Pdf Viewer control could render them.

Is this something that we might be able to do ourselves by using a custom document presenter? I found an article, but I haven't spent any time looking into it just yet.

http://docs.telerik.com/devtools/wpf/controls/radpdfviewer/customization-and-extensibility/custom-document-presenter

Again, thank you for your assistance. Have a good day,

Scott
Attached Files:
ADMIN
Deyan
Posted on: 16 May 2017 11:05
Hello Swetha,

Thank you for contributing to our feedback portal. We have just one clarifying question regarding the concrete annotation type. According to PDF format specification there is no annotation type called "Redaction". You may take a look at the available annotation types on page 615 in PdfReference 1.7:
http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/pdf_reference_1-7.pdf

We have already logged some items in the feedback portal that may be related to your request. You may see the list of them as follows:
  - Form fields and form fillings, which are visualized by Widget annotations (checkbox, combobox, listbox, texbox and others). We have already implemented these annotations partially (read-only visualization) and it is likely that we implement full editing support for the next official release. You may follow the implementation progress by following this feedback item: 
https://feedback.telerik.com/Project/143/Feedback/Details/197877-pdfviewer-form-fields-and-forms-filling
  
  - FreeText annotation type implementation may be followed in this feedback item:  
https://feedback.telerik.com/Project/143/Feedback/Details/199351-pdfviewer-support-for-freetext-annotation-type
  
  - Popup annotation type implementation may be followed in this feedback item: 
https://feedback.telerik.com/Project/143/Feedback/Details/203379-pdfviewer-support-for-annotations-of-type-popup
  
  - If read-only support for all annotation types suits you needs you may also follow this feedback item: 
https://feedback.telerik.com/Project/143/Feedback/Details/210601-pdfviewer-implement-read-only-rendering-for-all-annotation-types
  
We are looking forward to contacting you in order to clarify whether the above-mentioned feedback items are related to your requirement or you need different annotation type.

Regards,
Deyan