Foxit PDF SDK
FSTagTreeEditor Class Reference
Inheritance diagram for FSTagTreeEditor:
FSBase

Instance Methods

(FSTagTreeItemArray *) - addNewTag:type:title:
 Add a new tag to the tag tree.
More...
 
(FSTagTreeItemArray *) - addTagForAnnotation:annot:page_index:selected_tag_id:
 Add tag for annotation.
More...
 
(BOOL) - changeTagToArtifact:artifact_type:artifact_to_side:
 Change tag to artifact.
More...
 
(FSTagTreeItemArray *) - createTagFromSelectionByContent:selected_tag_id:
 Create tag from selection by content.
More...
 
(FSTagTreeItemArray *) - createTagFromSelectionByElement:selected_tag_id:
 Create tag from selection by element.
More...
 
(FSTagTreeItemArray *) - createTagFromSelectionByTag:last_selected_tag_id:
 Create tag from selection by tag.
More...
 
(FSTagTreeItemArray *) - createTagFromSelectionByText:selected_text_rects:selected_tag_id:
 Create tag from selection by text.
More...
 
(FSTagTreeItemArray *) - deleteEmptyTags:
 Delete empty tags from the tag tree.
More...
 
(FSTagTreeItemArray *) - deleteTags:
 Delete specified tags from the tag tree.
More...
 
(NSArray< NSData * > *) - findTagFromSelection:
 Find tag from selection.
More...
 
(NSString *) - getAllContents:
 Get all contents of a specified tag item.
More...
 
(NSArray< NSData * > *) - getContentTreeItemIDsByTagItemID:
 Get content tree item IDs by tag item ID.
More...
 
(FSTagProperty *) - getTagPropertyByID:
 Get tag property by tag item ID.
More...
 
(FSTagTreeItemArray *) - getTagTree
 Get the tag tree of the current PDF document.
More...
 
(FSTagTreeMenuItemDataArray *) - getTagTreeContextMenuItems:
 Get context menu items for tag tree.
More...
 
(id) - initWithOther:
 Constructor, with another tag editor object.
More...
 
(id) - initWithPdf_doc:
 Constructor.
More...
 
(BOOL) - isEmpty
 Check whether current object is empty or not.
More...
 
(FSTagTreeItemArray *) - moveTags:dest_tag_id:is_moved_as_child:
 Move tags in the tag tree.
More...
 
(BOOL) - setDocAsTaggedPDF
 Set the current PDF document as a tagged PDF.
More...
 
(BOOL) - setTagPropertyActualText:actual_text:
 Set tag property actual text for a specified tag item.
More...
 
(BOOL) - setTagPropertyAlternateText:alternate_text:
 Set tag property alternate text for a specified tag item.
More...
 
(BOOL) - setTagPropertyLanguage:language:
 Set tag property language for a specified tag item.
More...
 
(BOOL) - setTagPropertyTitle:title:
 Set tag property title for a specified tag item.
More...
 
(BOOL) - setTagPropertyType:type:
 Set tag property type for a specified tag item.
More...
 

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 FSLibrary::initialize:key: with a key including "Accessibility" module.

See also
FSLibrary

Method Documentation

◆ addNewTag:type:title:()

- (FSTagTreeItemArray *) addNewTag: (NSString *)  selected_tag_id
type: (NSString *)  type
title: (NSString *)  title 

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:annot:page_index:selected_tag_id:()

- (FSTagTreeItemArray *) addTagForAnnotation: (BOOL)  is_tag_annotations
annot: (FSAnnot*)  annot
page_index: (int)  page_index
selected_tag_id: (NSString *)  selected_tag_id 

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 FSPDFDoc::getPageCount.
[in]selected_tag_idThe selected tag ID.
Returns
The updated tag tree item array.

◆ changeTagToArtifact:artifact_type:artifact_to_side:()

- (BOOL) changeTagToArtifact: (NSArray<NSData *> *)  selected_tag_ids
artifact_type: (FSTagTreeEditorArtifactType)  artifact_type
artifact_to_side: (FSTagTreeEditorArtifactAttachToSideType)  artifact_to_side 

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
YES means success, while NO means not.

◆ createTagFromSelectionByContent:selected_tag_id:()

- (FSTagTreeItemArray *) createTagFromSelectionByContent: (NSArray<NSData *> *)  selected_content_ids
selected_tag_id: (NSString *)  selected_tag_id 

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:selected_tag_id:()

- (FSTagTreeItemArray *) createTagFromSelectionByElement: (int)  page_index
selected_tag_id: (NSString *)  selected_tag_id 

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 FSPDFDoc::getPageCount.
[in]selected_tag_idThe selected tag ID.
Returns
The updated tag tree item array.

◆ createTagFromSelectionByTag:last_selected_tag_id:()

- (FSTagTreeItemArray *) createTagFromSelectionByTag: (NSArray<NSData *> *)  selected_tag_ids
last_selected_tag_id: (NSString *)  last_selected_tag_id 

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:selected_text_rects:selected_tag_id:()

- (FSTagTreeItemArray *) createTagFromSelectionByText: (int)  page_index
selected_text_rects: (FSRectFArray*)  selected_text_rects
selected_tag_id: (NSString *)  selected_tag_id 

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 FSPDFDoc::getPageCount.
[in]selected_text_rectsThe selected text rectangles.
[in]selected_tag_idThe selected tag ID.
Returns
The updated tag tree item array.

◆ deleteEmptyTags:()

- (FSTagTreeItemArray *) deleteEmptyTags: (NSArray<NSData *> *)  selected_tag_ids

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:()

- (FSTagTreeItemArray *) deleteTags: (NSArray<NSData *> *)  selected_tag_ids

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:()

- (NSArray< NSData * > *) findTagFromSelection: (NSArray<NSData *> *)  selected_tag_ids

Find tag from selection.

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

◆ getAllContents:()

- (NSString *) getAllContents: (NSString *)  selected_tag_id

Get all contents of a specified tag item.

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

◆ getContentTreeItemIDsByTagItemID:()

- (NSArray< NSData * > *) getContentTreeItemIDsByTagItemID: (NSString *)  selected_tag_id

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:()

- (FSTagProperty *) getTagPropertyByID: (NSString *)  item_id

Get tag property by tag item ID.

Parameters
[in]item_idThe tag item ID, obtained from FSTagTreeItemData::item_id of items returned by FSTagTreeEditor::getTagTree.
Returns
The tag property object.
Note
The tag item referenced by item_id must be a structure element (FSTagTreeItemDataTagNodeTypeElement) node. Reference-type nodes such as marked content (FSTagTreeItemDataTagNodeTypeMarkedContentSeq) or object reference (FSTagTreeItemDataTagNodeTypeObject) do not carry this property and will cause the call to fail.

◆ getTagTree()

- (FSTagTreeItemArray *) getTagTree

Get the tag tree of the current PDF document.

Returns
The tag tree item array.

◆ getTagTreeContextMenuItems:()

- (FSTagTreeMenuItemDataArray *) getTagTreeContextMenuItems: (FSTagTreeMenuInputData*)  input_data

Get context menu items for tag tree.

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

◆ initWithOther:()

- (id) initWithOther: (FSTagTreeEditor*)  other

Constructor, with another tag editor object.

Parameters
[in]otherAnother tag editor object.

◆ initWithPdf_doc:()

- (id) initWithPdf_doc: (FSPDFDoc*)  pdf_doc

Constructor.

Parameters
[in]pdf_docA valid PDF document object.

◆ isEmpty()

- (BOOL) isEmpty

Check whether current object is empty or not.

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

Returns
YES means current object is empty, while NO means not.

◆ moveTags:dest_tag_id:is_moved_as_child:()

- (FSTagTreeItemArray *) moveTags: (NSArray<NSData *> *)  source_tag_ids
dest_tag_id: (NSString *)  dest_tag_id
is_moved_as_child: (BOOL)  is_moved_as_child 

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()

- (BOOL) setDocAsTaggedPDF

Set the current PDF document as a tagged PDF.

Returns
YES means success, while NO means not.

◆ setTagPropertyActualText:actual_text:()

- (BOOL) setTagPropertyActualText: (NSString *)  item_id
actual_text: (NSString *)  actual_text 

Set tag property actual text for a specified tag item.

Parameters
[in]item_idThe tag item ID, obtained from FSTagTreeItemData::item_id of items returned by FSTagTreeEditor::getTagTree.
[in]actual_textThe actual text to set.
Returns
YES means success, while NO means not.
Note
The tag item referenced by item_id must be a structure element (FSTagTreeItemDataTagNodeTypeElement) node. Reference-type nodes such as marked content (FSTagTreeItemDataTagNodeTypeMarkedContentSeq) or object reference (FSTagTreeItemDataTagNodeTypeObject) do not carry this property and will cause the call to fail.

◆ setTagPropertyAlternateText:alternate_text:()

- (BOOL) setTagPropertyAlternateText: (NSString *)  item_id
alternate_text: (NSString *)  alternate_text 

Set tag property alternate text for a specified tag item.

Parameters
[in]item_idThe tag item ID, obtained from FSTagTreeItemData::item_id of items returned by FSTagTreeEditor::getTagTree.
[in]alternate_textThe alternate text to set.
Returns
YES means success, while NO means not.
Note
The tag item referenced by item_id must be a structure element (FSTagTreeItemDataTagNodeTypeElement) node. Reference-type nodes such as marked content (FSTagTreeItemDataTagNodeTypeMarkedContentSeq) or object reference (FSTagTreeItemDataTagNodeTypeObject) do not carry this property and will cause the call to fail.

◆ setTagPropertyLanguage:language:()

- (BOOL) setTagPropertyLanguage: (NSString *)  item_id
language: (NSString *)  language 

Set tag property language for a specified tag item.

Parameters
[in]item_idThe tag item ID, obtained from FSTagTreeItemData::item_id of items returned by FSTagTreeEditor::getTagTree.
[in]languageThe language to set.
Returns
YES means success, while NO means not.
Note
The tag item referenced by item_id must be a structure element (FSTagTreeItemDataTagNodeTypeElement) node. Reference-type nodes such as marked content (FSTagTreeItemDataTagNodeTypeMarkedContentSeq) or object reference (FSTagTreeItemDataTagNodeTypeObject) do not carry this property and will cause the call to fail.

◆ setTagPropertyTitle:title:()

- (BOOL) setTagPropertyTitle: (NSString *)  item_id
title: (NSString *)  title 

Set tag property title for a specified tag item.

Parameters
[in]item_idThe tag item ID, obtained from FSTagTreeItemData::item_id of items returned by FSTagTreeEditor::getTagTree.
[in]titleThe tag title to set.
Returns
YES means success, while NO means not.
Note
The tag item referenced by item_id must be a structure element (FSTagTreeItemDataTagNodeTypeElement) node. Reference-type nodes such as marked content (FSTagTreeItemDataTagNodeTypeMarkedContentSeq) or object reference (FSTagTreeItemDataTagNodeTypeObject) do not carry this property and will cause the call to fail.

◆ setTagPropertyType:type:()

- (BOOL) setTagPropertyType: (NSString *)  item_id
type: (NSString *)  type 

Set tag property type for a specified tag item.

Parameters
[in]item_idThe tag item ID, obtained from FSTagTreeItemData::item_id of items returned by FSTagTreeEditor::getTagTree.
[in]typeThe tag type to set.
Returns
YES means success, while NO means not.
Note
The tag item referenced by item_id must be a structure element (FSTagTreeItemDataTagNodeTypeElement) node. Reference-type nodes such as marked content (FSTagTreeItemDataTagNodeTypeMarkedContentSeq) or object reference (FSTagTreeItemDataTagNodeTypeObject) do not carry this property and will cause the call to fail.