PdfAnnotationEditor

遗产: java.lang.Object, com.aspose.pdf.facades.IVentureLicenseTarget, com.aspose.pdf.facades.Facade, com.aspose.pdf.facades.SaveableFacade

public final class PdfAnnotationEditor extends SaveableFacade

表示用于处理 PDF 文档注释(注释)的类。

构造函数

构造函数描述
PdfAnnotationEditor()初始化新的 PdfAnnotationEditor 对象。
PdfAnnotationEditor(IDocument document)在文档的基础上初始化新的 PdfAnnotationEditor 对象。

方法

方法描述
bindPdf(IDocument srcDoc)初始化门面。
bindPdf(InputStream srcStream)初始化门面。
bindPdf(InputStream srcStream, String password)初始化门面。
bindPdf(String srcFile)初始化门面。
bindPdf(String srcFile, String password)初始化门面。
close()处理与外观绑定的文档。
deleteAnnotation(String annotName)删除具有指定注释名称的注释。
deleteAnnotations()删除文档中的所有注释。
deleteAnnotations(String annotType)删除文档中指定类型的所有注释。
dispose()处理门面。
equals(Object arg0)
exportAnnotationsToXfdf(OutputStream xmlOutputStream)将注释导出到流。
exportAnnotationsXfdf(OutputStream xmlOutputStream, int start, int end, int[] annotTypes)将指定注释类型的内容导出到 XFDF
exportAnnotationsXfdf(OutputStream xmlOutputStream, int start, int end, String[] annotTypes)将指定注释类型的内容导出到 XFDF
extractAnnotations(int start, int end, int[] annotTypes)获取指定类型的注解列表。
extractAnnotations(int start, int end, String[] annotTypes)获取指定类型的注解列表。
flatteningAnnotations()展平文档中的所有注释。
flatteningAnnotations(Form.FlattenSettings flattenSettings)展平文档中的所有注释。
flatteningAnnotations(int start, int end, int[] annotType)展平指定类型的注解。
getClass()
getDocument()获取正在处理的文档外观。
hashCode()
importAnnotationFromXfdf(InputStream xfdfStream)从 XFDF 数据流导入所有注释。
importAnnotationFromXfdf(String xfdfFile)从 XFDF 文件导入所有注释。
importAnnotations(InputStream[] annotFileInputStream)从另一个 PDF 文档流的数组中将注释导入文档。
importAnnotations(InputStream[] annotFileInputStream, int[] annotType)从另一个 PDF 文档流的数组中将指定的注释导入到文档中。
importAnnotations(String[] annotFile)从另一个 PDF 文档的数组中将注释导入文档。
importAnnotations(String[] annotFile, int[] annotType)从另一个 PDF 文档的数组中将指定的注释导入到文档中。
importAnnotationsFromXfdf(InputStream xfdfSteam)从 XFDF 数据流导入所有注释。
importAnnotationsFromXfdf(InputStream xfdfStream, int[] annotType)从 XFDF 数据流中导入指定的注释。
importAnnotationsFromXfdf(String xfdfFile)从 XFDF 文件导入所有注释。
importAnnotationsFromXfdf(String xfdfFile, int[] annotType)从 XFDF 文件导入指定的注释。
modifyAnnotations(int start, int end, Annotation annotation)修改指定页面范围内指定类型的注释。
modifyAnnotations(int start, int end, int annotType, Annotation annotation)“改用 modifyAnnotations(int start, int end, Annotation annotation)。”
modifyAnnotationsAuthor(int start, int end, String srcAuthor, String desAuthor)修改指定页面范围内注释的作者。
notify()
notifyAll()
redactArea(int pageIndex, Rectangle rect, Color color)编辑指定页面上的区域。
redactExactArea(int pageIndex, Rectangle rect, Color color)编辑指定页面上的区域。
save(OutputStream outputStream)将结果 PDF 保存到流中。
save(String outputFile)将结果 PDF 保存到文件。
toString()
wait()
wait(long arg0)
wait(long arg0, int arg1)

PdfAnnotationEditor()

public PdfAnnotationEditor()

初始化新的 PdfAnnotationEditor 对象。

PdfAnnotationEditor(IDocument document)

public PdfAnnotationEditor(IDocument document)

在文档的基础上初始化新的 PdfAnnotationEditor 对象。

参数:

范围类型描述
documentIDocumentpdf文档。

bindPdf(IDocument srcDoc)

public void bindPdf(IDocument srcDoc)

初始化门面。

参数:

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

bindPdf(InputStream srcStream)

public void bindPdf(InputStream srcStream)

初始化门面。

参数:

范围类型描述
srcStreamjava.io.InputStreamPDF文件流。

bindPdf(InputStream srcStream, String password)

public void bindPdf(InputStream srcStream, String password)

初始化门面。

参数:

范围类型描述
srcStreamjava.io.InputStreamPDF文件流。
passwordjava.lang.StringPDF文档的密码。

bindPdf(String srcFile)

public void bindPdf(String srcFile)

初始化门面。

参数:

范围类型描述
srcFilejava.lang.StringPDF文件。

bindPdf(String srcFile, String password)

public void bindPdf(String srcFile, String password)

初始化门面。

参数:

范围类型描述
srcFilejava.lang.StringPDF文件
passwordjava.lang.StringPDF文档的密码。

close()

public void close()

处理与外观绑定的文档。

deleteAnnotation(String annotName)

public void deleteAnnotation(String annotName)

删除具有指定注释名称的注释。


PdfAnnotationEditor editor = new PdfAnnotationEditor();
 editor.bindPdf("example.pdf");
 editor.deleteAnnotation("4cfa69cd-9bff-49e0-9005-e22a77cebf38");
 editor.save("example_out.pdf");

参数:

范围类型描述
annotNamejava.lang.String注释名称

deleteAnnotations()

public void deleteAnnotations()

删除文档中的所有注释。


PdfAnnotationEditor editor = new PdfAnnotationEditor();
 editor.bindPdf("example.pdf");
 editor.deleteAnnotations();
 editor.save("example_out.pdf");

deleteAnnotations(String annotType)

public void deleteAnnotations(String annotType)

删除文档中指定类型的所有注释。


PdfAnnotationEditor editor = new PdfAnnotationEditor();
 editor.bindPdf("example.pdf");
 editor.deleteAnnotations("Text");
 editor.save("example_out.pdf");

参数:

范围类型描述
annotTypejava.lang.String注释类型将被删除。

dispose()

public void dispose()

处理门面。

此方法已过时,请改用 close() 。

equals(Object arg0)

public boolean equals(Object arg0)

参数:

范围类型描述
arg0java.lang.Object

退货: 布尔值

exportAnnotationsToXfdf(OutputStream xmlOutputStream)

public final void exportAnnotationsToXfdf(OutputStream xmlOutputStream)

将注释导出到流。

参数:

范围类型描述
xmlOutputStreamjava.io.OutputStreamOutputStream 实例(输出流)

exportAnnotationsXfdf(OutputStream xmlOutputStream, int start, int end, int[] annotTypes)

public void exportAnnotationsXfdf(OutputStream xmlOutputStream, int start, int end, int[] annotTypes)

将指定注释类型的内容导出到 XFDF


PdfAnnotationEditor editor = new PdfAnnotationEditor();
 editor.bindPdf("example.pdf");
 int[] annotTypes = new int[] {AnnotationType.Text, AnnotationType.Highlight};
 OutputStream stream = new FileOutputStream("example.xfdf");
     editor.exportAnnotationsXfdf(stream, 1, 2, annotTypes);
 stream.close();

参数:

范围类型描述
xmlOutputStreamjava.io.OutputStream输出 XFDF 流。
startint将从中导出文档注释的起始页。
endint文档注释将导出到的结束页面。
annotTypesint[]需要导出注释类型数组。

exportAnnotationsXfdf(OutputStream xmlOutputStream, int start, int end, String[] annotTypes)

public void exportAnnotationsXfdf(OutputStream xmlOutputStream, int start, int end, String[] annotTypes)

将指定注释类型的内容导出到 XFDF


PdfAnnotationEditor editor = new PdfAnnotationEditor();
 editor.bindPdf("example.pdf");
 String[] annotTypes = new String[] {"Text", "Highlight"};
 OutputStream stream = new FileOutputStream("example.xfdf");
 editor.exportAnnotationsXfdf(stream, 1, 2, annotTypes);
 stream.close();

参数:

范围类型描述
xmlOutputStreamjava.io.OutputStream输出 XFDF 流。
startint将从中导出文档注释的起始页。
endint文档注释将导出到的结束页面。
annotTypesjava.lang.String[]需要导出注释类型数组。

extractAnnotations(int start, int end, int[] annotTypes)

public List<Annotation> extractAnnotations(int start, int end, int[] annotTypes)

获取指定类型的注解列表。


PdfAnnotationEditor editor = new PdfAnnotationEditor();
 editor.bindPdf("example.pdf");
 int[] annotTypes = new int[] {AnnotationType.Text, AnnotationType.Highlight};
 List annotList = (List)editor.extractAnnotations(1, 2 , annotTypes);

参数:

范围类型描述
startint从中选择注释的起始页。
endint将选择注释的结束页面。
annotTypesint[]所需注释类型的数组。

退货: java.util.List<com.aspose.pdf.Annotation> - 注释列表。

extractAnnotations(int start, int end, String[] annotTypes)

public List<Annotation> extractAnnotations(int start, int end, String[] annotTypes)

获取指定类型的注解列表。


PdfAnnotationEditor editor = new PdfAnnotationEditor();
 editor.bindPdf("example.pdf");
 String[] annotTypes = new String[] {"Text", "Highlight"};
 List annotList = (List)editor.extractAnnotations(1, 2 , annotTypes);

参数:

范围类型描述
startint从中选择注释的起始页。
endint将选择注释的结束页面。
annotTypesjava.lang.String[]所需注释类型的数组。

退货: java.util.List<com.aspose.pdf.Annotation> - 注释列表。

flatteningAnnotations()

public void flatteningAnnotations()

展平文档中的所有注释。


PdfAnnotationEditor editor = new PdfAnnotationEditor();
 editor.bindPdf("example.pdf");
 editor.flatteningAnnotations();
 editor.save(example_out.pdf");

flatteningAnnotations(Form.FlattenSettings flattenSettings)

public final void flatteningAnnotations(Form.FlattenSettings flattenSettings)

展平文档中的所有注释。

参数:

范围类型描述
flattenSettingsFlattenSettings指定展平模式。

flatteningAnnotations(int start, int end, int[] annotType)

public void flatteningAnnotations(int start, int end, int[] annotType)

展平指定类型的注解。


PdfAnnotationEditor editor = new PdfAnnotationEditor();
 editor.bindPdf("example.pdf");
 int[] annotTypes ={AnnotationType.Line, AnnotationType.FreeText};
 editor.flatteningAnnotations(1, 2, annotTypes);
 editor.save("example_out.pdf");

参数:

范围类型描述
startint起始页。
endint然后结束页。
annotTypeint[]注释类型应该被展平。

getClass()

public final native Class<?> getClass()

退货: java.lang.Class

getDocument()

public IDocument getDocument()

获取正在处理的文档外观。

退货: IDocument IDocument 元素

hashCode()

public native int hashCode()

退货: 整数

importAnnotationFromXfdf(InputStream xfdfStream)

public final void importAnnotationFromXfdf(InputStream xfdfStream)

从 XFDF 数据流导入所有注释。


PdfAnnotationEditor editor = new PdfAnnotationEditor();
 editor.bindPdf("example.pdf");
 editor.importAnnotationFromXfdf(new FileInputStream("annots.xfdf"));
 editor.save("example_out.pdf");

参数:

范围类型描述
xfdfStreamjava.io.InputStream输入 XFDF 数据流。

importAnnotationFromXfdf(String xfdfFile)

public final void importAnnotationFromXfdf(String xfdfFile)

从 XFDF 文件导入所有注释。


PdfAnnotationEditor editor = new PdfAnnotationEditor();
 editor.bindPdf("example.pdf");
 editor.importAnnotationFromXfdf("annots.xfdf");
 editor.save("example_out.pdf");

参数:

范围类型描述
xfdfFilejava.lang.String输入 XFDF 文件。

importAnnotations(InputStream[] annotFileInputStream)

public void importAnnotations(InputStream[] annotFileInputStream)

从另一个 PDF 文档流的数组中将注释导入文档。


PdfAnnotationEditor editor = new PdfAnnotationEditor();
 editor.bindPdf("example.pdf");
 InputStream[] streams = new FileInputStream[2];
 streams[0]= new FileInputStream("with_annots1.pdf");
 streams[1]= new FileInputStream("with_annots2.pdf");
 editor.importAnnotations(streams);
 editor.save("example_out.pdf");
 streams[0].Close();
 streams[1].Close();

参数:

范围类型描述
annotFileInputStreamjava.io.InputStream[]包含源注释的 PDF 文档流数组。

importAnnotations(InputStream[] annotFileInputStream, int[] annotType)

public void importAnnotations(InputStream[] annotFileInputStream, int[] annotType)

从另一个 PDF 文档流的数组中将指定的注释导入到文档中。


PdfAnnotationEditor editor = new PdfAnnotationEditor();
 editor.bindPdf("example.pdf");
 InputStream[] streams = new FileInputStream[2];
 streams[0]= new FileInputStream("with_annots1.pdf");
 streams[1]= new FileInputStream("with_annots2.pdf");
 int[] annotTypes = {AnnotationType.Highlight, AnnotationType.Text};
 editor.importAnnotations(streams, annotTypes);
 editor.save("example_out.pdf");
 streams[0].close();
 streams[1].close();

参数:

范围类型描述
annotFileInputStreamjava.io.InputStream[]包含源注释的 PDF 文档流数组。
annotTypeint[]要导入的注释类型。

importAnnotations(String[] annotFile)

public void importAnnotations(String[] annotFile)

从另一个 PDF 文档的数组中将注释导入文档。


PdfAnnotationEditor editor = new PdfAnnotationEditor();
 editor.bindPdf("example.pdf");
 string[] paths = new string[2] {"with_annots1.pdf", "with_annots2.pdf"};
 editor.importAnnotations(paths);
 editor.save("example_out.pdf");

参数:

范围类型描述
annotFilejava.lang.String[]包含源注释的 PDF 文档路径数组。

importAnnotations(String[] annotFile, int[] annotType)

public void importAnnotations(String[] annotFile, int[] annotType)

从另一个 PDF 文档的数组中将指定的注释导入到文档中。


PdfAnnotationEditor editor = new PdfAnnotationEditor();
 editor.bindPdf("example.pdf");
 string[] paths = new string[2] {"with_annots1.pdf", "with_annots2.pdf"};
 int[] annotTypes = {AnnotationType.Highlight, AnnotationType.Text};
 editor.importAnnotations(paths, annotTypes);
 editor.save("example_out.pdf");

参数:

范围类型描述
annotFilejava.lang.String[]包含源注释的 PDF 文档路径数组。
annotTypeint[]要导入的注释类型数组。

importAnnotationsFromXfdf(InputStream xfdfSteam)

public void importAnnotationsFromXfdf(InputStream xfdfSteam)

从 XFDF 数据流导入所有注释。


PdfAnnotationEditor editor = new PdfAnnotationEditor();
 editor.bindPdf("example.pdf");
 editor.importAnnotationsFromXfdf(new FileInputStream("annots.xfdf"));
 editor.save("example_out.pdf");

参数:

范围类型描述
xfdfSteamjava.io.InputStream输入 XFDF 数据流。

importAnnotationsFromXfdf(InputStream xfdfStream, int[] annotType)

public void importAnnotationsFromXfdf(InputStream xfdfStream, int[] annotType)

从 XFDF 数据流中导入指定的注释。


PdfAnnotationEditor editor = new PdfAnnotationEditor();
 editor.bindPdf("example.pdf");
 int[] annotTypes ={ AnnotationType.Highlight, AnnotationType.Line };
 editor.importAnnotationFromXfdf(new FileInputStream("annots.xfdf"), annotTypes);
 editor.save("example_out.pdf");

参数:

范围类型描述
xfdfStreamjava.io.InputStream输入 XFDF 数据流。
annotTypeint[]要导入的注释类型数组。

importAnnotationsFromXfdf(String xfdfFile)

public void importAnnotationsFromXfdf(String xfdfFile)

从 XFDF 文件导入所有注释。


PdfAnnotationEditor editor = new PdfAnnotationEditor();
 editor.bindPdf("example.pdf");
 editor.importAnnotationsFromXfdf("annots.xfdf");
 editor.save("example_out.pdf");

参数:

范围类型描述
xfdfFilejava.lang.String输入 XFDF 文件。

importAnnotationsFromXfdf(String xfdfFile, int[] annotType)

public void importAnnotationsFromXfdf(String xfdfFile, int[] annotType)

从 XFDF 文件导入指定的注释。


PdfAnnotationEditor editor = new PdfAnnotationEditor();
 editor.bindPdf("example.pdf");
 int[] annotTypes = {AnnotationType.Highlight, AnnotationType.Text};
 editor.importAnnotationFromXfdf("annots.xfdf", annotTypes);
 editor.save("example_out.pdf");

参数:

范围类型描述
xfdfFilejava.lang.String输入 XFDF 文件。
annotTypeint[]要导入的注释数组。

modifyAnnotations(int start, int end, Annotation annotation)

public void modifyAnnotations(int start, int end, Annotation annotation)

修改指定页面范围内指定类型的注释。它支持修改下一个注释属性:Modified、Title、Contents、Color、Subject 和Open。


PdfAnnotationEditor editor = new PdfAnnotationEditor();
 editor.bindPdf("example.pdf");
 TextAnnotation annot = new TextAnnotation();
 annot.setModified ( new Date());
 annot.setTitle ( "NEW AUTHOR");
 annot.setContents ( "NEW CONTENTS");
 annot.setColor ( Color.RED);
 annot.setSubject ( "NEW SUBJECT");
 annot.setOpen ( true);
 editor.modifyAnnotations(1, 2, annot);
 editor.save("example_out.pdf");

参数:

范围类型描述
startint起始页码。
endint结束页码。
annotationAnnotation注释对象包含新属性。

modifyAnnotations(int start, int end, int annotType, Annotation annotation)

public void modifyAnnotations(int start, int end, int annotType, Annotation annotation)

“改用 modifyAnnotations(int start, int end, Annotation annotation)。”

修改指定页面范围内指定类型的注释。它支持修改下一个注释属性:Modified、Title、Contents、Color、Subject 和Open。


PdfAnnotationEditor editor = new PdfAnnotationEditor();
 editor.bindPdf("example.pdf");
 com.aspose.pdf.TextAnnotation annot = new com.aspose.pdf.TextAnnotation();
 annot.setModified ( new java.util.Date());
 annot.setTitle ( "NEW AUTHOR");
 annot.setContents ( "NEW CONTENTS");
 annot.setColor (com.aspose.pdf.Color.getRed());
 annot.setSubject ( "NEW SUBJECT");
 annot.setOpen ( true);
 editor.modifyAnnotations(1, 2, com.aspose.pdf.AnnotationType.Text, annot);
 editor.save("example_out.pdf");

参数:

范围类型描述
startint起始页码。
endint结束页码。
annotTypeint注释类型。
annotationAnnotation注释对象包含新属性。

modifyAnnotationsAuthor(int start, int end, String srcAuthor, String desAuthor)

public void modifyAnnotationsAuthor(int start, int end, String srcAuthor, String desAuthor)

修改指定页面范围内注释的作者。


PdfAnnotationEditor editor = new PdfAnnotationEditor();
 editor.bindPdf("example.pdf");
 editor.modifyAnnotationsAuthor(1, 2, "PREV AUTHOR", "NEW AUTHOR");
 editor.save("example_out.pdf");

参数:

范围类型描述
startint起始页码。
endint结束页码。
srcAuthorjava.lang.String必须修改的作者。
desAuthorjava.lang.String新作者。

notify()

public final native void notify()

notifyAll()

public final native void notifyAll()

redactArea(int pageIndex, Rectangle rect, Color color)

public void redactArea(int pageIndex, Rectangle rect, Color color)

编辑指定页面上的区域。所有内容都被删除。

参数:

范围类型描述
pageIndexint页面索引。
rectRectangle区域长方形。
colorjava.awt.Color填充颜色。

redactExactArea(int pageIndex, Rectangle rect, Color color)

public void redactExactArea(int pageIndex, Rectangle rect, Color color)

编辑指定页面上的区域。所有内容都被删除。

参数:

范围类型描述
pageIndexint页面索引。
rectRectangle区域长方形。
colorjava.awt.Color填充颜色。

save(OutputStream outputStream)

public void save(OutputStream outputStream)

将结果 PDF 保存到流中。

参数:

范围类型描述
outputStreamjava.io.OutputStream输出 PDF 流

save(String outputFile)

public void save(String outputFile)

将结果 PDF 保存到文件。

参数:

范围类型描述
outputFilejava.lang.String输出PDF文件

toString()

public String toString()

退货: java.lang.字符串

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