Foxit PDF SDK
com.foxit.sdk.addon.accessibility.TagTreeEditor Class Reference
Inheritance diagram for com.foxit.sdk.addon.accessibility.TagTreeEditor:
com.foxit.sdk.common.Base

Public Member Functions

 TagTreeEditor (PDFDoc pdf_doc) throws com.foxit.sdk.PDFException
 Constructor.
More...
 
 TagTreeEditor (TagTreeEditor other)
 Constructor, with another tag editor object.
More...
 
TagTreeItemArray addNewTag (String selected_tag_id, String type, String title) throws com.foxit.sdk.PDFException
 Add a new tag to the tag tree.
More...
 
TagTreeItemArray addTagForAnnotation (boolean is_tag_annotations, Annot annot, int page_index, String selected_tag_id) throws com.foxit.sdk.PDFException
 Add tag for annotation.
More...
 
boolean changeTagToArtifact (java.util.ArrayList< java.lang.String > selected_tag_ids, int artifact_type, int artifact_to_side) throws com.foxit.sdk.PDFException
 Change tag to artifact.
More...
 
TagTreeItemArray createTagFromSelectionByContent (java.util.ArrayList< java.lang.String > selected_content_ids, String selected_tag_id) throws com.foxit.sdk.PDFException
 Create tag from selection by content.
More...
 
TagTreeItemArray createTagFromSelectionByElement (int page_index, String selected_tag_id) throws com.foxit.sdk.PDFException
 Create tag from selection by element.
More...
 
TagTreeItemArray createTagFromSelectionByTag (java.util.ArrayList< java.lang.String > selected_tag_ids, String last_selected_tag_id) throws com.foxit.sdk.PDFException
 Create tag from selection by tag.
More...
 
TagTreeItemArray createTagFromSelectionByText (int page_index, RectFArray selected_text_rects, String selected_tag_id) throws com.foxit.sdk.PDFException
 Create tag from selection by text.
More...
 
synchronized void delete ()
 Clean up related C++ resources immediately. More...
 
TagTreeItemArray deleteEmptyTags (java.util.ArrayList< java.lang.String > selected_tag_ids) throws com.foxit.sdk.PDFException
 Delete empty tags from the tag tree.
More...
 
TagTreeItemArray deleteTags (java.util.ArrayList< java.lang.String > selected_tag_ids) throws com.foxit.sdk.PDFException
 Delete specified tags from the tag tree.
More...
 
java.util.ArrayList< java.lang.String > findTagFromSelection (java.util.ArrayList< java.lang.String > selected_tag_ids) throws com.foxit.sdk.PDFException
 Find tag from selection.
More...
 
String getAllContents (String selected_tag_id) throws com.foxit.sdk.PDFException
 Get all contents of a specified tag item.
More...
 
java.util.ArrayList< java.lang.String > getContentTreeItemIDsByTagItemID (String selected_tag_id) throws com.foxit.sdk.PDFException
 Get content tree item IDs by tag item ID.
More...
 
TagProperty getTagPropertyByID (String item_id) throws com.foxit.sdk.PDFException
 Get tag property by tag item ID.
More...
 
TagTreeItemArray getTagTree () throws com.foxit.sdk.PDFException
 Get the tag tree of the current PDF document.
More...
 
TagTreeMenuItemDataArray getTagTreeContextMenuItems (TagTreeMenuInputData input_data) throws com.foxit.sdk.PDFException
 Get context menu items for tag tree.
More...
 
boolean isEmpty ()
 Check whether current object is empty or not.
More...
 
TagTreeItemArray moveTags (java.util.ArrayList< java.lang.String > source_tag_ids, String dest_tag_id, boolean is_moved_as_child) throws com.foxit.sdk.PDFException
 Move tags in the tag tree.
More...
 
boolean setDocAsTaggedPDF () throws com.foxit.sdk.PDFException
 Set the current PDF document as a tagged PDF.
More...
 
boolean setTagPropertyActualText (String item_id, String actual_text) throws com.foxit.sdk.PDFException
 Set tag property actual text for a specified tag item.
More...
 
boolean setTagPropertyAlternateText (String item_id, String alternate_text) throws com.foxit.sdk.PDFException
 Set tag property alternate text for a specified tag item.
More...
 
boolean setTagPropertyID (String item_id, String id) throws com.foxit.sdk.PDFException
 Set tag property ID for a specified tag item.
More...
 
boolean setTagPropertyLanguage (String item_id, String language) throws com.foxit.sdk.PDFException
 Set tag property language for a specified tag item.
More...
 
boolean setTagPropertyTitle (String item_id, String title) throws com.foxit.sdk.PDFException
 Set tag property title for a specified tag item.
More...
 
boolean setTagPropertyType (String item_id, String type) throws com.foxit.sdk.PDFException
 Set tag property type for a specified tag item.
More...
 

Static Public Attributes

static final int e_ArtifactAttachToSideTypeBottom = 4
 Artifact attach side: bottom.

 
static final int e_ArtifactAttachToSideTypeLeft = 1
 Artifact attach side: left.

 
static final int e_ArtifactAttachToSideTypeNone = 0
 Artifact attach side: none.

 
static final int e_ArtifactAttachToSideTypeRight = 3
 Artifact attach side: right.

 
static final int e_ArtifactAttachToSideTypeTop = 2
 Artifact attach side: top.

 
static final int e_ArtifactTypeLayout = 2
 Artifact type: layout artifact (visual layout elements).

 
static final int e_ArtifactTypePage = 0
 Artifact type: page-level artifact.

 
static final int e_ArtifactTypePagination = 1
 Artifact type: pagination-related artifact (e.g., headers/footers).

 

Detailed Description

This class lets user edit the tag tree (structure tree) of a PDF document: query and modify tag properties, add / delete / move tags, create tags from selection, change tags to artifacts and mark the document as a tagged PDF. Before using any class or methods in this module, please ensure Foxit PDF SDK has been initialized successfully by function common.Library.initialize with a key including "Accessibility" module.

See also
com.foxit.sdk.common.Library

Constructor & Destructor Documentation

◆ TagTreeEditor() [1/2]

com.foxit.sdk.addon.accessibility.TagTreeEditor.TagTreeEditor ( PDFDoc  pdf_doc) throws com.foxit.sdk.PDFException

Constructor.

Parameters
[in]pdf_docA valid PDF document object.

◆ TagTreeEditor() [2/2]

com.foxit.sdk.addon.accessibility.TagTreeEditor.TagTreeEditor ( TagTreeEditor  other)

Constructor, with another tag editor object.

Parameters
[in]otherAnother tag editor object.

Member Function Documentation

◆ addNewTag()

TagTreeItemArray com.foxit.sdk.addon.accessibility.TagTreeEditor.addNewTag ( String  selected_tag_id,
String  type,
String  title 
) throws com.foxit.sdk.PDFException

Add a new tag to the tag tree.

Parameters
[in]selected_tag_idThe selected tag ID as parent.
[in]typeThe tag type.
[in]titleThe tag title.
Returns
The updated tag tree item array.

◆ addTagForAnnotation()

TagTreeItemArray com.foxit.sdk.addon.accessibility.TagTreeEditor.addTagForAnnotation ( boolean  is_tag_annotations,
Annot  annot,
int  page_index,
String  selected_tag_id 
) throws com.foxit.sdk.PDFException

Add tag for annotation.

Parameters
[in]is_tag_annotationsWhether to tag annotations.
[in]annotThe annotation object.
[in]page_indexThe page index. Valid range: from 0 to (count-1), where count is returned by function pdf.PDFDoc.getPageCount .
[in]selected_tag_idThe selected tag ID.
Returns
The updated tag tree item array.

◆ changeTagToArtifact()

boolean com.foxit.sdk.addon.accessibility.TagTreeEditor.changeTagToArtifact ( java.util.ArrayList< java.lang.String >  selected_tag_ids,
int  artifact_type,
int  artifact_to_side 
) throws com.foxit.sdk.PDFException

Change tag to artifact.

Parameters
[in]selected_tag_idsThe selected tag IDs.
[in]artifact_typeThe artifact type. Please refer to .
[in]artifact_to_sideThe artifact attach to side type. Please refer to .
Returns
true means success, while false means not.

◆ createTagFromSelectionByContent()

TagTreeItemArray com.foxit.sdk.addon.accessibility.TagTreeEditor.createTagFromSelectionByContent ( java.util.ArrayList< java.lang.String >  selected_content_ids,
String  selected_tag_id 
) throws com.foxit.sdk.PDFException

Create tag from selection by content.

Parameters
[in]selected_content_idsThe selected content IDs.
[in]selected_tag_idThe selected tag ID.
Returns
The updated tag tree item array.

◆ createTagFromSelectionByElement()

TagTreeItemArray com.foxit.sdk.addon.accessibility.TagTreeEditor.createTagFromSelectionByElement ( int  page_index,
String  selected_tag_id 
) throws com.foxit.sdk.PDFException

Create tag from selection by element.

Parameters
[in]page_indexThe page index. Valid range: from 0 to (count-1), where count is returned by function pdf.PDFDoc.getPageCount .
[in]selected_tag_idThe selected tag ID.
Returns
The updated tag tree item array.

◆ createTagFromSelectionByTag()

TagTreeItemArray com.foxit.sdk.addon.accessibility.TagTreeEditor.createTagFromSelectionByTag ( java.util.ArrayList< java.lang.String >  selected_tag_ids,
String  last_selected_tag_id 
) throws com.foxit.sdk.PDFException

Create tag from selection by tag.

Parameters
[in]selected_tag_idsThe selected tag IDs.
[in]last_selected_tag_idThe last selected tag ID.
Returns
The updated tag tree item array.

◆ createTagFromSelectionByText()

TagTreeItemArray com.foxit.sdk.addon.accessibility.TagTreeEditor.createTagFromSelectionByText ( int  page_index,
RectFArray  selected_text_rects,
String  selected_tag_id 
) throws com.foxit.sdk.PDFException

Create tag from selection by text.

Parameters
[in]page_indexThe page index. Valid range: from 0 to (count-1), where count is returned by function pdf.PDFDoc.getPageCount .
[in]selected_text_rectsThe selected text rectangles.
[in]selected_tag_idThe selected tag ID.
Returns
The updated tag tree item array.

◆ delete()

synchronized void com.foxit.sdk.addon.accessibility.TagTreeEditor.delete ( )

Clean up related C++ resources immediately.

Returns
None.
Note
Once this function is called, current object cannot be used anymore.

Reimplemented from com.foxit.sdk.common.Base.

◆ deleteEmptyTags()

TagTreeItemArray com.foxit.sdk.addon.accessibility.TagTreeEditor.deleteEmptyTags ( java.util.ArrayList< java.lang.String >  selected_tag_ids) throws com.foxit.sdk.PDFException

Delete empty tags from the tag tree.

Parameters
[in]selected_tag_idsThe array of tag IDs to check for empty tags.
Returns
The updated tag tree item array.

◆ deleteTags()

TagTreeItemArray com.foxit.sdk.addon.accessibility.TagTreeEditor.deleteTags ( java.util.ArrayList< java.lang.String >  selected_tag_ids) throws com.foxit.sdk.PDFException

Delete specified tags from the tag tree.

Parameters
[in]selected_tag_idsThe array of tag IDs to delete.
Returns
The updated tag tree item array.

◆ findTagFromSelection()

java.util.ArrayList< java.lang.String > com.foxit.sdk.addon.accessibility.TagTreeEditor.findTagFromSelection ( java.util.ArrayList< java.lang.String >  selected_tag_ids) throws com.foxit.sdk.PDFException

Find tag from selection.

Parameters
[in]selected_tag_idsThe selected tag IDs.
Returns
The array of found tag IDs.

◆ getAllContents()

String com.foxit.sdk.addon.accessibility.TagTreeEditor.getAllContents ( String  selected_tag_id) throws com.foxit.sdk.PDFException

Get all contents of a specified tag item.

Parameters
[in]selected_tag_idThe selected tag ID.
Returns
The content text.

◆ getContentTreeItemIDsByTagItemID()

java.util.ArrayList< java.lang.String > com.foxit.sdk.addon.accessibility.TagTreeEditor.getContentTreeItemIDsByTagItemID ( String  selected_tag_id) throws com.foxit.sdk.PDFException

Get content tree item IDs by tag item ID.

Parameters
[in]selected_tag_idThe selected tag ID.
Returns
The array of content tree item IDs.

◆ getTagPropertyByID()

TagProperty com.foxit.sdk.addon.accessibility.TagTreeEditor.getTagPropertyByID ( String  item_id) throws com.foxit.sdk.PDFException

Get tag property by tag item ID.

Parameters
[in]item_idThe tag item ID, obtained from TagTreeItemData.getItem_id of items returned by TagTreeEditor.getTagTree .
Returns
The tag property object.
Note
The tag item referenced by item_id must be a structure element (com.foxit.sdk.addon.accessibility.TagTreeItemData.e_TagNodeTypeElement ) node. Reference-type nodes such as marked content (com.foxit.sdk.addon.accessibility.TagTreeItemData.e_TagNodeTypeMarkedContentSeq ) or object reference (com.foxit.sdk.addon.accessibility.TagTreeItemData.e_TagNodeTypeObject ) do not carry this property and will cause the call to fail.

◆ getTagTree()

TagTreeItemArray com.foxit.sdk.addon.accessibility.TagTreeEditor.getTagTree ( ) throws com.foxit.sdk.PDFException

Get the tag tree of the current PDF document.

Returns
The tag tree item array.

◆ getTagTreeContextMenuItems()

TagTreeMenuItemDataArray com.foxit.sdk.addon.accessibility.TagTreeEditor.getTagTreeContextMenuItems ( TagTreeMenuInputData  input_data) throws com.foxit.sdk.PDFException

Get context menu items for tag tree.

Parameters
[in]input_dataThe input data for context menu.
Returns
The array of menu item data.

◆ isEmpty()

boolean com.foxit.sdk.addon.accessibility.TagTreeEditor.isEmpty ( )

Check whether current object is empty or not.

When the current object is empty, that means current object is useless.

Returns
true means current object is empty, while false means not.

◆ moveTags()

TagTreeItemArray com.foxit.sdk.addon.accessibility.TagTreeEditor.moveTags ( java.util.ArrayList< java.lang.String >  source_tag_ids,
String  dest_tag_id,
boolean  is_moved_as_child 
) throws com.foxit.sdk.PDFException

Move tags in the tag tree.

Parameters
[in]source_tag_idsThe source tag IDs to move.
[in]dest_tag_idThe destination tag ID.
[in]is_moved_as_childWhether to move as child of destination.
Returns
The updated tag tree item array.

◆ setDocAsTaggedPDF()

boolean com.foxit.sdk.addon.accessibility.TagTreeEditor.setDocAsTaggedPDF ( ) throws com.foxit.sdk.PDFException

Set the current PDF document as a tagged PDF.

Returns
true means success, while false means not.

◆ setTagPropertyActualText()

boolean com.foxit.sdk.addon.accessibility.TagTreeEditor.setTagPropertyActualText ( String  item_id,
String  actual_text 
) throws com.foxit.sdk.PDFException

Set tag property actual text for a specified tag item.

Parameters
[in]item_idThe tag item ID, obtained from TagTreeItemData.getItem_id of items returned by TagTreeEditor.getTagTree .
[in]actual_textThe actual text to set.
Returns
true means success, while false means not.
Note
The tag item referenced by item_id must be a structure element (com.foxit.sdk.addon.accessibility.TagTreeItemData.e_TagNodeTypeElement ) node. Reference-type nodes such as marked content (com.foxit.sdk.addon.accessibility.TagTreeItemData.e_TagNodeTypeMarkedContentSeq ) or object reference (com.foxit.sdk.addon.accessibility.TagTreeItemData.e_TagNodeTypeObject ) do not carry this property and will cause the call to fail.

◆ setTagPropertyAlternateText()

boolean com.foxit.sdk.addon.accessibility.TagTreeEditor.setTagPropertyAlternateText ( String  item_id,
String  alternate_text 
) throws com.foxit.sdk.PDFException

Set tag property alternate text for a specified tag item.

Parameters
[in]item_idThe tag item ID, obtained from TagTreeItemData.getItem_id of items returned by TagTreeEditor.getTagTree .
[in]alternate_textThe alternate text to set.
Returns
true means success, while false means not.
Note
The tag item referenced by item_id must be a structure element (com.foxit.sdk.addon.accessibility.TagTreeItemData.e_TagNodeTypeElement ) node. Reference-type nodes such as marked content (com.foxit.sdk.addon.accessibility.TagTreeItemData.e_TagNodeTypeMarkedContentSeq ) or object reference (com.foxit.sdk.addon.accessibility.TagTreeItemData.e_TagNodeTypeObject ) do not carry this property and will cause the call to fail.

◆ setTagPropertyID()

boolean com.foxit.sdk.addon.accessibility.TagTreeEditor.setTagPropertyID ( String  item_id,
String  id 
) throws com.foxit.sdk.PDFException

Set tag property ID for a specified tag item.

Parameters
[in]item_idThe tag item ID, obtained from TagTreeItemData.getItem_id of items returned by TagTreeEditor.getTagTree .
[in]idThe ID to set.
Returns
true means success, while false means not.
Note
The tag item referenced by item_id must be a structure element (com.foxit.sdk.addon.accessibility.TagTreeItemData.e_TagNodeTypeElement ) node. Reference-type nodes such as marked content (com.foxit.sdk.addon.accessibility.TagTreeItemData.e_TagNodeTypeMarkedContentSeq ) or object reference (com.foxit.sdk.addon.accessibility.TagTreeItemData.e_TagNodeTypeObject ) do not carry this property and will cause the call to fail.

◆ setTagPropertyLanguage()

boolean com.foxit.sdk.addon.accessibility.TagTreeEditor.setTagPropertyLanguage ( String  item_id,
String  language 
) throws com.foxit.sdk.PDFException

Set tag property language for a specified tag item.

Parameters
[in]item_idThe tag item ID, obtained from TagTreeItemData.getItem_id of items returned by TagTreeEditor.getTagTree .
[in]languageThe language to set.
Returns
true means success, while false means not.
Note
The tag item referenced by item_id must be a structure element (com.foxit.sdk.addon.accessibility.TagTreeItemData.e_TagNodeTypeElement ) node. Reference-type nodes such as marked content (com.foxit.sdk.addon.accessibility.TagTreeItemData.e_TagNodeTypeMarkedContentSeq ) or object reference (com.foxit.sdk.addon.accessibility.TagTreeItemData.e_TagNodeTypeObject ) do not carry this property and will cause the call to fail.

◆ setTagPropertyTitle()

boolean com.foxit.sdk.addon.accessibility.TagTreeEditor.setTagPropertyTitle ( String  item_id,
String  title 
) throws com.foxit.sdk.PDFException

Set tag property title for a specified tag item.

Parameters
[in]item_idThe tag item ID, obtained from TagTreeItemData.getItem_id of items returned by TagTreeEditor.getTagTree .
[in]titleThe tag title to set.
Returns
true means success, while false means not.
Note
The tag item referenced by item_id must be a structure element (com.foxit.sdk.addon.accessibility.TagTreeItemData.e_TagNodeTypeElement ) node. Reference-type nodes such as marked content (com.foxit.sdk.addon.accessibility.TagTreeItemData.e_TagNodeTypeMarkedContentSeq ) or object reference (com.foxit.sdk.addon.accessibility.TagTreeItemData.e_TagNodeTypeObject ) do not carry this property and will cause the call to fail.

◆ setTagPropertyType()

boolean com.foxit.sdk.addon.accessibility.TagTreeEditor.setTagPropertyType ( String  item_id,
String  type 
) throws com.foxit.sdk.PDFException

Set tag property type for a specified tag item.

Parameters
[in]item_idThe tag item ID, obtained from TagTreeItemData.getItem_id of items returned by TagTreeEditor.getTagTree .
[in]typeThe tag type to set.
Returns
true means success, while false means not.
Note
The tag item referenced by item_id must be a structure element (com.foxit.sdk.addon.accessibility.TagTreeItemData.e_TagNodeTypeElement ) node. Reference-type nodes such as marked content (com.foxit.sdk.addon.accessibility.TagTreeItemData.e_TagNodeTypeMarkedContentSeq ) or object reference (com.foxit.sdk.addon.accessibility.TagTreeItemData.e_TagNodeTypeObject ) do not carry this property and will cause the call to fail.