Foxit PDF SDK
foxit::addon::accessibility::TaggedPDF Class Reference
Inheritance diagram for foxit::addon::accessibility::TaggedPDF:
foxit::Base

Public Member Functions

 TaggedPDF (const foxit::pdf::PDFDoc &doc, bool is_fix=false)
 Constructor. More...
 
 TaggedPDF (const TaggedPDF &other)
 Constructor, with another tagged PDF object. More...
 
 ~TaggedPDF ()
 Destructor.
 
bool CanTagDocument ()
 Check whether the current PDF document can be tagged. More...
 
bool CanTagFormFields ()
 Check whether the form fields in the current PDF document can be auto tagged. More...
 
int GetCurrentFigureElementIndex ()
 Get current figure element index. More...
 
WString GetFigureAlternateText (int figure_index)
 Get the alternate text of the figure. More...
 
int GetFigureCount ()
 Get the count of figures in tagged document, excluding the decorative figures. More...
 
int GetFigurePageIndex (int figure_index)
 Get the figure page index by the figure index. More...
 
RectF GetFigureRect (int figure_index)
 Get the rectangle of figure. More...
 
AlternateTextFigureData GetNextFigureData ()
 Get next figure data. More...
 
AlternateTextFigureData GetPrevFigureData ()
 Get previous figure data. More...
 
bool HasFigures ()
 Check whether the document has figures. More...
 
bool IsAlreadyTagged ()
 Check whether the current PDF document is already tagged. More...
 
bool IsEmpty () const
 Check whether current object is empty or not. More...
 
bool operator!= (const TaggedPDF &other) const
 Not equal operator. More...
 
TaggedPDF & operator= (const TaggedPDF &other)
 Assign operator. More...
 
bool operator== (const TaggedPDF &other) const
 Equal operator. More...
 
void RemoveTags ()
 Remove the accessibility tag tree tree for the current PDF document. More...
 
bool SaveFigureData ()
 Save figure data. More...
 
bool SetAsDecorativeFigure (int figure_index)
 Decorate the figure.The decorative figure can not set alternate text. More...
 
void SetCallback (TaggedPDFCallback *callback)
 Set a callback object for tagged PDF. More...
 
void SetCurrentFigureDataInfo (bool is_decorative, const wchar_t *alternate_text)
 Set current figure data info. More...
 
void SetFigureAlternateText (int figure_index, const wchar_t *alternate_text)
 Set figure alternate text. More...
 
common::Progressive StartTagDocument (common::PauseCallback *pause, foxit::common::file::StreamCallback *report_callback=0, AutoTagProviderCallback *callback=0)
 Start to auto tag the given PDF document with specified tagged settings. More...
 
bool TagFormFields ()
 Tag form fields in the current PDF document. More...
 
- Public Member Functions inherited from foxit::Base
FS_HANDLE Handle () const
 Get the handle of current object. More...
 

Detailed Description

This class represents settings for a tagged PDF document.The tagged PDF means that only tagging information for PDF structure here. 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
common::Library

Constructor & Destructor Documentation

◆ TaggedPDF() [1/2]

foxit::addon::accessibility::TaggedPDF::TaggedPDF ( const foxit::pdf::PDFDoc &  doc,
bool  is_fix = false 
)

Constructor.

Parameters
[in]docA valid PDF document object to be tagged.
[in]is_fixWhether this tagged PDF is used for fix operation. If true, figure data methods will use fix alternate text; if false, they will use no-fix alternate text. Default value: false.

This constructor is to construct a tagged PDF object with specified settings.

◆ TaggedPDF() [2/2]

foxit::addon::accessibility::TaggedPDF::TaggedPDF ( const TaggedPDF &  other)

Constructor, with another tagged PDF object.

Parameters
[in]otherAnother tagged PDF object.

Member Function Documentation

◆ CanTagDocument()

bool foxit::addon::accessibility::TaggedPDF::CanTagDocument ( )

Check whether the current PDF document can be tagged.

Returns
true means the document can be tagged, while false means not.

◆ CanTagFormFields()

bool foxit::addon::accessibility::TaggedPDF::CanTagFormFields ( )

Check whether the form fields in the current PDF document can be auto tagged.

The function is only used for a tagged PDF document. Please call function pdf::PDFDoc::IsTaggedPDF to check current PDF document whether is a tagged PDF document.

Returns
true means form fields can be auto tagged, while false means not.

◆ GetCurrentFigureElementIndex()

int foxit::addon::accessibility::TaggedPDF::GetCurrentFigureElementIndex ( )

Get current figure element index.

Returns
The current figure element index.

◆ GetFigureAlternateText()

WString foxit::addon::accessibility::TaggedPDF::GetFigureAlternateText ( int  figure_index)

Get the alternate text of the figure.

The alternate text is the human-readable text, the PDF documents can be enhanced by providing alternate text for images, formulas, or other items that do not translate naturally into text. The function is only used for a tagged PDF document. Please call function pdf::PDFDoc::IsTaggedPDF to check current PDF document whether is a tagged PDF document.

Parameters
[in]figure_indexThe index of figure. Valid range: from 0 to (count-1). count is returned by function TaggedPDF::GetFigureCount.
Returns
The alternative descriptions text.

◆ GetFigureCount()

int foxit::addon::accessibility::TaggedPDF::GetFigureCount ( )

Get the count of figures in tagged document, excluding the decorative figures.

The function is only used for a tagged PDF document. Please call function pdf::PDFDoc::IsTaggedPDF to check current PDF document whether is a tagged PDF document.

Returns
The count of figures.

◆ GetFigurePageIndex()

int foxit::addon::accessibility::TaggedPDF::GetFigurePageIndex ( int  figure_index)

Get the figure page index by the figure index.

The function is only used for a tagged PDF document. Please call function pdf::PDFDoc::IsTaggedPDF to check current PDF document whether is a tagged PDF document.

Parameters
[in]figure_indexThe index of figure. Valid range: from 0 to (count-1). count is returned by function TaggedPDF::GetFigureCount.
Returns
The page index. Valid value would starts from 0. If there is any error, this function will return -1.

◆ GetFigureRect()

RectF foxit::addon::accessibility::TaggedPDF::GetFigureRect ( int  figure_index)

Get the rectangle of figure.

The function is only used for a tagged PDF document. Please call function pdf::PDFDoc::IsTaggedPDF to check current PDF document whether is a tagged PDF document.

Parameters
[in]figure_indexThe index of figure. Valid range: from 0 to (count-1). count is returned by function TaggedPDF::GetFigureCount.
Returns
The figure rectangle.If there is any error, this function will return an empty rectangle.

◆ GetNextFigureData()

AlternateTextFigureData foxit::addon::accessibility::TaggedPDF::GetNextFigureData ( )

Get next figure data.

Returns
The next figure data object.

◆ GetPrevFigureData()

AlternateTextFigureData foxit::addon::accessibility::TaggedPDF::GetPrevFigureData ( )

Get previous figure data.

Returns
The previous figure data object.

◆ HasFigures()

bool foxit::addon::accessibility::TaggedPDF::HasFigures ( )

Check whether the document has figures.

Returns
true means the document has figures, while false means not.

◆ IsAlreadyTagged()

bool foxit::addon::accessibility::TaggedPDF::IsAlreadyTagged ( )

Check whether the current PDF document is already tagged.

Returns
true means the document is already tagged, while false means not.

◆ IsEmpty()

bool foxit::addon::accessibility::TaggedPDF::IsEmpty ( ) const

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.

◆ operator!=()

bool foxit::addon::accessibility::TaggedPDF::operator!= ( const TaggedPDF &  other) const

Not equal operator.

Parameters
[in]otherAnother tagged PDF object. This function will check if current object is not equal to this one.
Returns
true means not equal, while false means equal.

◆ operator=()

TaggedPDF& foxit::addon::accessibility::TaggedPDF::operator= ( const TaggedPDF &  other)

Assign operator.

Parameters
[in]otherAnother tagged PDF object, whose value would be assigned to current object.
Returns
Reference to current object itself.

◆ operator==()

bool foxit::addon::accessibility::TaggedPDF::operator== ( const TaggedPDF &  other) const

Equal operator.

Parameters
[in]otherAnother tagged PDF object. This function will check if current object is equal to this one.
Returns
true means equal, while false means not equal.

◆ RemoveTags()

void foxit::addon::accessibility::TaggedPDF::RemoveTags ( )

Remove the accessibility tag tree tree for the current PDF document.

This method releases the accessibility-side tag tree/cache associated with the document.

Returns
None.

◆ SaveFigureData()

bool foxit::addon::accessibility::TaggedPDF::SaveFigureData ( )

Save figure data.

Returns
true means success, while false means not.

◆ SetAsDecorativeFigure()

bool foxit::addon::accessibility::TaggedPDF::SetAsDecorativeFigure ( int  figure_index)

Decorate the figure.The decorative figure can not set alternate text.

The function is only used for a tagged PDF document. Please call function pdf::PDFDoc::IsTaggedPDF to check current PDF document whether is a tagged PDF document.

Parameters
[in]figure_indexThe index of figure. Valid range: from 0 to (count-1). count is returned by function TaggedPDF::GetFigureCount.
Returns
true means decorate figure successed, while false means not.

◆ SetCallback()

void foxit::addon::accessibility::TaggedPDF::SetCallback ( TaggedPDFCallback *  callback)

Set a callback object for tagged PDF.

Deprecated:
This function has been deprecated since Foxit PDF SDK 12.0. Please use function TaggedPDF::StartTagDocument instead, which receives the report callbacks (report stream and localized report text) directly as parameters.

If this function is not called, that means no callback will be used.

Parameters
[in]callbackA TaggedPDFCallback object which is implemented by user. User can change some information/data during tagged PDF document by this callback. Please ensure that the callback object keeps valid until the life-cycle of current tagged PDF object ends.
If this is NULL, that means to use default information/data.
Returns
None.

◆ SetCurrentFigureDataInfo()

void foxit::addon::accessibility::TaggedPDF::SetCurrentFigureDataInfo ( bool  is_decorative,
const wchar_t *  alternate_text 
)

Set current figure data info.

Parameters
[in]is_decorativeWhether the figure is decorative.
[in]alternate_textThe alternate text.
Returns
None.

◆ SetFigureAlternateText()

void foxit::addon::accessibility::TaggedPDF::SetFigureAlternateText ( int  figure_index,
const wchar_t *  alternate_text 
)

Set figure alternate text.

The alternate text is the human-readable text, the PDF documents can be enhanced by providing alternate text for images, formulas, or other items that do not translate naturally into text. The function is only used for a tagged PDF document. Please call function pdf::PDFDoc::IsTaggedPDF to check current PDF document whether is a tagged PDF document.

Parameters
[in]figure_indexThe index of figure. Valid range: from 0 to (count-1). count is returned by function TaggedPDF::GetFigureCount.
[in]alternate_textThe alternative descriptions text.
Returns
None.

◆ StartTagDocument()

common::Progressive foxit::addon::accessibility::TaggedPDF::StartTagDocument ( common::PauseCallback *  pause,
foxit::common::file::StreamCallback *  report_callback = 0,
AutoTagProviderCallback *  callback = 0 
)

Start to auto tag the given PDF document with specified tagged settings.

If user wants to get specific tag results during the tagging document process, please pass a valid report_callback and/or callback parameter to this function.

Parameters
[in]pausePause object which decides if the auto tagging process needs to be paused. This can be NULL which means not to pause during the tagging process. If this is not NULL, it should be a valid pause object implemented by user. Default value: NULL.
[in]report_callbackA common::file::StreamCallback object used to receive the generated auto tag report stream. This can be NULL which means not to output the report. If this is not NULL, it should be a valid stream callback object implemented by user. Default value: NULL.
[in]callbackAn addon::accessibility::AutoTagProviderCallback object which is implemented by user. User can provide the localized report text during tagged PDF document by this callback. Please ensure that the callback object keeps valid until the life-cycle of current tagged PDF object ends.
If this is NULL, that means to use default report text.
Returns
A progressive object. Please check the rate of current progress by function common::Progressive::GetRateOfProgress. If the rate is not 100 yet, call function common::Progressive::Continue to continue the progress until the progress is finished.

◆ TagFormFields()

bool foxit::addon::accessibility::TaggedPDF::TagFormFields ( )

Tag form fields in the current PDF document.

The function is only used for a tagged PDF document. Please call function pdf::PDFDoc::IsTaggedPDF to check current PDF document whether is a tagged PDF document.

Returns
true means form fields tagged successfully, while false means not.