Take a survey

Developing Applications Using APIs > Assembling PDF Documents > Working with Annotations > Selecting specific comments

Selecting specific comments
A Comments result or filter element can specify a subset of the comments in their children rather than all of them. You can set several attributes specifying criteria by which comments are selected:
filter specifies whether comments should be included or excluded. If omitted, its default value is Include. If you specify a filter attribute with a value of Exclude, the selected comments are excluded from the result and the other comments are included.
beforeDate and afterDate select comments dated before or after a particular date, respectively. The date is specified as an 8-character string of the format YYYYMMDD, where YYYY is the year, MM is the month, and DD is the day.
byAuthor selects comments that match an author’s name.
byType selects comments by the annotation type, for example, Text or Highlight. Annotation types are listed in the PDF Reference.
byCategory selects the comments from a category of annotation types. The categories and the annotation types they include are these:
Notes: Text annotations.
DrawingMarkups: Line, PolyLine, Square, Circle, Polygon, and Ink annotations
TextEditingMarkups: Highlight, Underline, Squiggly, StrikeOut, Caret, and FreeText annotations.
Stamps: Stamp annotations.
Attachments: FileAttachment and Sound annotations.
All: all of the above. If filter is set to Exclude, note that annotations in addition to the types listed here are removed from the result, as if NoComments were specified. The only annotations that are not removed are Link annotations (which can be removed by the NoLinks element) and Widget annotations.
The selection criteria are additive. That is, all comments satisfying any of the specified criteria are included. In the following example, the result includes all comments from doc1_byGeorge.pdf that are dated before July 4, 2005 or are drawing markups.
Example: Including selected comments
<PDF result="doc4.pdf">
	<PDF source="doc1.pdf"/>
	<Comments beforeDate="20050704" 	byCategory="DrawingMarkups" 
		filter="Include"/>
		<PDF source="doc1_byGeorge.pdf"/>
	</Comments>
</PDF>
If the previous example specified filter="Exclude", the result would include all comments except those that are dated before July 4, 2005 or are drawing markups.
This example exports all comments meeting any of these criteria: entered after June 1, 2005, Notes annotations, or authored by Joe User.
Example: Exporting selected comments
<Comments result="doc6.fdf" format="FDF" filter="Include" 
		afterDate="20050601" byCategory="Notes" byAuthor="Joe User">
	<PDF source="doc1.pdf"/>
</Comments>
To restrict the set of comments to those that meet all of a set of criteria (rather than any), you must use nested Comments elements. In the following example, the innermost Comments filter element includes only those from doc1.pdf authored by Joe User. Its parent element uses those comments as a source and then selects those that are Text annotations. Finally, the outermost Comments element narrows down the selection to those created after June 1, 2005, and exports them in FDF format.
Example: Using nested selection criteria
<Comments result="doc6.fdf" format="FDF" filter="Include" 	
	afterDate="20050601">
	<Comments byCategory="Notes" filter="Include">
		<Comments byAuthor="Joe User" filter="Include">
			<PDF source="doc1.pdf"/>
		</Comments>
	</Comments>
</Comments>
In this example, doc1.pdf is a source PDF document containing no comments. The other three documents (doc1_fromTom.pdf, etc.) are the same PDF document but contain comments from reviewers. The Comments element extracts all the comments from these three documents, excluding any that are dated after June 1, 2005, and imports them into the result document.
Example: Excluding specific comments
<PDF result="doc1_comments.pdf">
	<Comments afterDate="20050601" filter="Exclude">
		<PDF source="doc1_fromTom.pdf"/>
		<PDF source="doc1_fromDick.pdf"/>
		<PDF source="doc1_fromHarry.pdf"/>
	</Comments>
	<PDF source="doc1.pdf"/>
</PDF>
When exporting comments, you can also use selection attributes on a Comments result element. For example, you could export the comments in the previous example to XFDF, as in this example.
Example: Exporting selected comments
<Comments result="doc8.xfdf" format="XFDF"
		afterDate="20050601" filter="Exclude">
	<PDF source="doc1_fromTom.pdf"/>
	<PDF source="doc1_fromDick.pdf"/>
	<PDF source="doc1_fromHarry.pdf"/>
</Comments>
Note, however, that if you want to specify different selection attributes for each source document, you must use separate Comments filter elements as children of the Comments result element, as in the following example.
Example: Using several comments filter elements
<Comments result="doc9.xfdf" format="XFDF">
	<PDF source="doc1_nocomment.pdf"/>
	<Comments byCategory="Notes">
		<PDF source="doc1_fromTom.pdf"/>
	</Comments>
	<Comments byCategory="DrawingMarkups">
		<PDF source="doc1_fromDick.pdf"/>
	</Comments>
	<Comments byCategory="TextEditingMarkups">
		<PDF source="doc1_fromHarry.pdf"/>
	</Comments>
</Comments>
There are some important things to note about this example:
The Comments result element must have at least one PDF source as a child element. It cannot have only Comments filter elements as children; otherwise, an error occurs.
The Comments filter elements select different types of comments from their respective source elements. The comments are aggregated and effectively imported into the source document doc1_nocomment.pdf, then exported as XFDF.
The source document doc1_nocomments.pdf is not returned to the user. Therefore, its page contents are ignored, but it must contain enough pages to include all the comments from the original documents, and it should have no comments of its own originally.

 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/livecycle/es/sdkHelp/programmer/sdkHelp/assemblePDFComments.98.4.html