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 на основе документа. |
Методы
PdfAnnotationEditor()
public PdfAnnotationEditor()
Инициализирует новый объект PdfAnnotationEditor.
PdfAnnotationEditor(IDocument document)
public PdfAnnotationEditor(IDocument document)
Инициализирует новый объект PdfAnnotationEditor на основе документа.
Параметры:
Параметр | Тип | Описание |
---|---|---|
document | IDocument | Документ пдф. |
bindPdf(IDocument srcDoc)
public void bindPdf(IDocument srcDoc)
Инициализирует фасад.
Параметры:
Параметр | Тип | Описание |
---|---|---|
srcDoc | IDocument | Объект Документ. |
bindPdf(InputStream srcStream)
public void bindPdf(InputStream srcStream)
Инициализирует фасад.
Параметры:
Параметр | Тип | Описание |
---|---|---|
srcStream | java.io.InputStream | Поток файла PDF. |
bindPdf(InputStream srcStream, String password)
public void bindPdf(InputStream srcStream, String password)
Инициализирует фасад.
Параметры:
Параметр | Тип | Описание |
---|---|---|
srcStream | java.io.InputStream | Поток файла PDF. |
password | java.lang.String | Пароль документа PDF. |
bindPdf(String srcFile)
public void bindPdf(String srcFile)
Инициализирует фасад.
Параметры:
Параметр | Тип | Описание |
---|---|---|
srcFile | java.lang.String | PDF-файл. |
bindPdf(String srcFile, String password)
public void bindPdf(String srcFile, String password)
Инициализирует фасад.
Параметры:
Параметр | Тип | Описание |
---|---|---|
srcFile | java.lang.String | PDF-файл |
password | java.lang.String | Пароль документа PDF. |
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");
Параметры:
Параметр | Тип | Описание |
---|---|---|
annotName | java.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");
Параметры:
Параметр | Тип | Описание |
---|---|---|
annotType | java.lang.String | Тип аннотации будет удален. |
dispose()
public void dispose()
Располагает фасад.
Этот метод устарел, вместо него используйте close().
equals(Object arg0)
public boolean equals(Object arg0)
Параметры:
Параметр | Тип | Описание |
---|---|---|
arg0 | java.lang.Object |
Возвращает: логический
exportAnnotationsToXfdf(OutputStream xmlOutputStream)
public final void exportAnnotationsToXfdf(OutputStream xmlOutputStream)
Экспорт аннотаций в поток.
Параметры:
Параметр | Тип | Описание |
---|---|---|
xmlOutputStream | java.io.OutputStream | Экземпляр OutputStream (выходной поток) |
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();
Параметры:
Параметр | Тип | Описание |
---|---|---|
xmlOutputStream | java.io.OutputStream | Выходной поток XFDF. |
start | int | Стартовая страница, с которой будут экспортироваться аннотации документа. |
end | int | Конечная страница, на которую будут экспортированы аннотации документа. |
annotTypes | int[] | Массив типов аннотаций необходимо экспортировать. |
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();
Параметры:
Параметр | Тип | Описание |
---|---|---|
xmlOutputStream | java.io.OutputStream | Выходной поток XFDF. |
start | int | Стартовая страница, с которой будут экспортироваться аннотации документа. |
end | int | Конечная страница, на которую будут экспортированы аннотации документа. |
annotTypes | java.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);
Параметры:
Параметр | Тип | Описание |
---|---|---|
start | int | Стартовая страница, с которой будут выбираться аннотации. |
end | int | Конечная страница, к которой будут выбраны аннотации. |
annotTypes | int[] | Массив необходимых типов аннотаций. |
Возвращает: 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);
Параметры:
Параметр | Тип | Описание |
---|---|---|
start | int | Стартовая страница, с которой будут выбираться аннотации. |
end | int | Конечная страница, к которой будут выбраны аннотации. |
annotTypes | java.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)
Сглаживает все аннотации в документе.
Параметры:
Параметр | Тип | Описание |
---|---|---|
flattenSettings | FlattenSettings | Определяет режимы выравнивания. |
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");
Параметры:
Параметр | Тип | Описание |
---|---|---|
start | int | Стартовая страница. |
end | int | Затем конечная страница. |
annotType | int[] | Типы аннотаций должны быть сглажены. |
getClass()
public final native Class<?> getClass()
Возвращает: java.lang.Класс
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");
Параметры:
Параметр | Тип | Описание |
---|---|---|
xfdfStream | java.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");
Параметры:
Параметр | Тип | Описание |
---|---|---|
xfdfFile | java.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();
Параметры:
Параметр | Тип | Описание |
---|---|---|
annotFileInputStream | java.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();
Параметры:
Параметр | Тип | Описание |
---|---|---|
annotFileInputStream | java.io.InputStream[] | Массив потоков PDF-документов, содержащих исходные аннотации. |
annotType | int[] | Типы аннотаций для импорта. |
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");
Параметры:
Параметр | Тип | Описание |
---|---|---|
annotFile | java.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");
Параметры:
Параметр | Тип | Описание |
---|---|---|
annotFile | java.lang.String[] | Массив путей к документам PDF, содержащим исходные аннотации. |
annotType | int[] | Массив типов аннотаций для импорта. |
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");
Параметры:
Параметр | Тип | Описание |
---|---|---|
xfdfSteam | java.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");
Параметры:
Параметр | Тип | Описание |
---|---|---|
xfdfStream | java.io.InputStream | Входной поток данных XFDF. |
annotType | int[] | Массив типов аннотаций для импорта. |
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");
Параметры:
Параметр | Тип | Описание |
---|---|---|
xfdfFile | java.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");
Параметры:
Параметр | Тип | Описание |
---|---|---|
xfdfFile | java.lang.String | Входной файл XFDF. |
annotType | int[] | Импортируемый массив аннотаций. |
modifyAnnotations(int start, int end, Annotation annotation)
public void modifyAnnotations(int start, int end, Annotation annotation)
Изменяет аннотации указанного типа в указанном диапазоне страниц. Он поддерживает изменение следующих свойств аннотации: «Изменено», «Заголовок», «Содержание», «Цвет», «Тема» и «Открыть».
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");
Параметры:
Параметр | Тип | Описание |
---|---|---|
start | int | Номер начальной страницы. |
end | int | Конечный номер страницы. |
annotation | Annotation | Объект аннотации содержит новые свойства. |
modifyAnnotations(int start, int end, int annotType, Annotation annotation)
public void modifyAnnotations(int start, int end, int annotType, Annotation annotation)
«Вместо этого используйте модификацию аннотаций (int start, int end, Annotation annotation)».
Изменяет аннотации указанного типа в указанном диапазоне страниц. Он поддерживает изменение следующих свойств аннотации: «Изменено», «Заголовок», «Содержание», «Цвет», «Тема» и «Открыть».
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");
Параметры:
Параметр | Тип | Описание |
---|---|---|
start | int | Номер начальной страницы. |
end | int | Конечный номер страницы. |
annotType | int | Тип аннотации. |
annotation | Annotation | Объект аннотации содержит новые свойства. |
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");
Параметры:
Параметр | Тип | Описание |
---|---|---|
start | int | Номер начальной страницы. |
end | int | Конечный номер страницы. |
srcAuthor | java.lang.String | Автор, который должен быть изменен. |
desAuthor | java.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)
Редактирует область на указанной странице. Все содержимое удаляется.
Параметры:
Параметр | Тип | Описание |
---|---|---|
pageIndex | int | Индекс страницы. |
rect | Rectangle | Площадь прямоугольника. |
color | java.awt.Color | Цвет заливки. |
redactExactArea(int pageIndex, Rectangle rect, Color color)
public void redactExactArea(int pageIndex, Rectangle rect, Color color)
Редактирует область на указанной странице. Все содержимое удаляется.
Параметры:
Параметр | Тип | Описание |
---|---|---|
pageIndex | int | Индекс страницы. |
rect | Rectangle | Площадь прямоугольника. |
color | java.awt.Color | Цвет заливки. |
save(OutputStream outputStream)
public void save(OutputStream outputStream)
Сохраняет полученный PDF-файл в потоковом режиме.
Параметры:
Параметр | Тип | Описание |
---|---|---|
outputStream | java.io.OutputStream | Выходной PDF-поток |
save(String outputFile)
public void save(String outputFile)
Сохраняет результат PDF в файл.
Параметры:
Параметр | Тип | Описание |
---|---|---|
outputFile | java.lang.String | Выходной PDF-файл |
toString()
public String toString()
Возвращает: java.lang.String
wait()
public final void wait()
wait(long arg0)
public final native void wait(long arg0)
Параметры:
Параметр | Тип | Описание |
---|---|---|
arg0 | long |
wait(long arg0, int arg1)
public final void wait(long arg0, int arg1)
Параметры:
Параметр | Тип | Описание |
---|---|---|
arg0 | long | |
arg1 | int |