TextParagraphAbsorber

遗产: java.lang.Object, com.aspose.pdf.TextAbsorber

public final class TextParagraphAbsorber extends TextAbsorber

表示文本段落的吸收器对象。执行文本搜索并通过 TextParagraphAbsorber.TextParagraphs 集合提供对搜索结果的访问。

构造函数

构造函数描述
TextParagraphAbsorber(Rectangle[] rectangles)使用矩形集合初始化 TextParagraphAbsorber 的新实例。

方法

方法描述
equals(Object arg0)
getClass()
getErrors()TextExtractionError 对象列表。
getExtractionOptions()获取文本提取选项。
getRectangles()获取 TextParagraphAbsorber 用于在 PDF 文档或页面上搜索文本段落的矩形。
getText()获取 TextAbsorber 在 PDF 文档或页面上提取的提取文本。
getTextParagraphs()获取随 TextParagraph 对象一起出现的搜索事件的集合。
getTextSearchOptions()获取文本搜索选项。
hasErrors()值指示在文本提取期间是否发现错误。
hashCode()
notify()
notifyAll()
setExtractionOptions(TextExtractionOptions value)设置文本提取选项。
setRectangles(Rectangle[] value)设置 TextParagraphAbsorber 用于在 PDF 文档或页面上搜索文本段落的矩形。
setTextParagraphs(TextParagraphCollection value)设置与 TextParagraph 对象一起出现的搜索事件的集合。
setTextSearchOptions(TextSearchOptions value)设置文本搜索选项。
toString()
visit(IDocument pdf)提取指定文档中的文本
visit(Page page)在指定页面上执行搜索。
visit(XForm form)在指定的 XForm 上提取文本。
wait()
wait(long arg0)
wait(long arg0, int arg1)

TextParagraphAbsorber(Rectangle[] rectangles)

public TextParagraphAbsorber(Rectangle[] rectangles)

使用矩形集合初始化 TextParagraphAbsorber 的新实例。

参数:

范围类型描述
rectanglesRectangle[]段落的矩形。

吸收器将搜索文本并返回对应于矩形的段落。|

equals(Object arg0)

public boolean equals(Object arg0)

参数:

范围类型描述
arg0java.lang.Object

退货: 布尔值

getClass()

public final native Class<?> getClass()

退货: java.lang.Class

getErrors()

public List<TextExtractionError> getErrors()

TextExtractionError 对象列表。它包含有关在文本提取期间发现的错误的信息。仅当 TextSearchOptions.LogTextExtractionErrors = true 时才会执行错误搜索;它可能会降低性能。

退货: java.util.List<com.aspose.pdf.TextExtractionError> - TextExtractionError 对象列表

getExtractionOptions()

public TextExtractionOptions getExtractionOptions()

获取文本提取选项。


The example demonstrates how to set Pure text formatting mode and perform text extraction.
 
 //打开文件
 Document doc = new Document(inFile);
 //创建 TextAbsorber 对象以提取带格式的文本
 TextAbsorber absorber = new TextAbsorber();
 //设置纯文本格式化模式
 absorber.setExtractionOptions ( new TextExtractionOptions(TextExtractionOptions.TextFormattingMode.Pure));
 //接受所有文档页面的吸收器
 doc.getPages().accept(absorber);
 //获取提取的文本
 String extractedText = absorber.getText();

允许在提取期间定义文本格式化模式 TextExtractionOptions。默认模式是 TextExtractionOptions.TextFormattingMode.Pure

退货: TextExtractionOptions - TextExtractionOptions 值

getRectangles()

public Rectangle[] getRectangles()

获取 TextParagraphAbsorber 用于在 PDF 文档或页面上搜索文本段落的矩形。

退货: com.aspose.pdf.矩形[- 矩形数组

getText()

public String getText()

获取 TextAbsorber 在 PDF 文档或页面上提取的提取文本。

退货: java.lang.String - 字符串值


The example demonstrates how to extract text from all pages of the PDF document.
 
 //打开文件
 Document doc = new Document(inFile);
 //创建 TextAbsorber 对象以提取文本
 TextAbsorber absorber = new TextAbsorber();
 //接受所有文档页面的吸收器
 doc.getPages().accept(absorber);
 //获取提取的文本
 String extractedText = absorber.getText();

getTextParagraphs()

public TextParagraphCollection getTextParagraphs()

获取随 TextParagraph 对象一起出现的搜索事件的集合。

退货: TextParagraphCollection TextParagraphCollection 值

getTextSearchOptions()

public TextSearchOptions getTextSearchOptions()

获取文本搜索选项。

允许定义分隔提取文本的矩形。默认情况下,矩形是空的。这意味着页面边界仅定义文本提取区域。

退货: TextSearchOptions - TextSearchOptions 值

hasErrors()

public boolean hasErrors()

值指示在文本提取期间是否发现错误。仅当 TextSearchOptions.LogTextExtractionErrors = true 时才会执行错误搜索;它可能会降低性能。

退货: boolean - 布尔值

hashCode()

public native int hashCode()

退货: 整数

notify()

public final native void notify()

notifyAll()

public final native void notifyAll()

setExtractionOptions(TextExtractionOptions value)

public void setExtractionOptions(TextExtractionOptions value)

设置文本提取选项。


The example demonstrates how to set Pure text formatting mode and perform text extraction.
 
 //打开文件
 Document doc = new Document(inFile);
 //创建 TextAbsorber 对象以提取带格式的文本
 TextAbsorber absorber = new TextAbsorber();
 //设置纯文本格式化模式
 absorber.setExtractionOptions ( new TextExtractionOptions(TextExtractionOptions.TextFormattingMode.Pure));
 //接受所有文档页面的吸收器
 doc.getPages().accept(absorber);
 //获取提取的文本
 String extractedText = absorber.getText();

允许在提取期间定义文本格式化模式 TextExtractionOptions。默认模式是 TextExtractionOptions.TextFormattingMode.Pure

参数:

范围类型描述
valueTextExtractionOptionsTextExtractionOptions 值

setRectangles(Rectangle[] value)

public void setRectangles(Rectangle[] value)

设置 TextParagraphAbsorber 用于在 PDF 文档或页面上搜索文本段落的矩形。

参数:

范围类型描述
valueRectangle[]矩形阵列

setTextParagraphs(TextParagraphCollection value)

public void setTextParagraphs(TextParagraphCollection value)

设置与 TextParagraph 对象一起出现的搜索事件的集合。

参数:

范围类型描述
valueTextParagraphCollectionTextParagraphCollection 值

setTextSearchOptions(TextSearchOptions value)

public void setTextSearchOptions(TextSearchOptions value)

设置文本搜索选项。

允许定义分隔提取文本的矩形。默认情况下,矩形是空的。这意味着页面边界仅定义文本提取区域。

参数:

范围类型描述
valueTextSearchOptionsTextSearchOptions 值

toString()

public String toString()

退货: java.lang.字符串

visit(IDocument pdf)

public void visit(IDocument pdf)

提取指定文档中的文本


The example demonstrates how to extract text on PDF document.
 
 //打开文件
 Document doc = new Document(inFile);
 //创建 TextAbsorber 对象以提取文本
 TextAbsorber absorber = new TextAbsorber();
 //接受所有文档页面的吸收器
 absorber.visit(doc);
 //获取提取的文本
 String extractedText = absorber.getText();

参数:

范围类型描述
pdfIDocumentPdf 文档对象。

visit(Page page)

public void visit(Page page)

在指定页面上执行搜索。

参数:

范围类型描述
pagePage页面对象

visit(XForm form)

public void visit(XForm form)

在指定的 XForm 上提取文本。


The example demonstrates how to extract text on the first PDF document page.
 
  //打开文件
  Document doc = new Document(inFile);
  
  //创建 TextAbsorber 对象以提取文本
  TextAbsorber absorber = new TextAbsorber();
   
  //接受所有文档页面的吸收器
  absorber.visit(doc.Pages().get(1).getResources().getForms().get("Xform1"));
     
  //获取提取的文本
  String extractedText = absorber.getText();

参数:

范围类型描述
formXFormPDF 表单对象。

wait()

public final void wait()

wait(long arg0)

public final native void wait(long arg0)

参数:

范围类型描述
arg0long

wait(long arg0, int arg1)

public final void wait(long arg0, int arg1)

参数:

范围类型描述
arg0long
arg1int