استيراد وتصدير التعليقات التوضيحية باستخدام Java
Contents
[
Hide
]
نسخ التعليقات التوضيحية من PDF إلى آخر
- افتح ملف PDF المصدر Document.
- أضف Page إلى الوجهة Document.
- أضف كل Annotation إلى الهدف Page.
- اقرأ أو التكرار عبر Annotation العناصر على الصفحة المستهدفة.
- احفظ ملف PDF المحدّث Document.
- عدّ Annotation العناصر في صفحة المصدر الأولى وأضف كل واحدة إلى صفحة الوجهة.
public static void importExport(Path inputFile, Path outputFile) {
try (Document sourceDocument = new Document(inputFile.toString());
Document destinationDocument = new Document()) {
Page page = destinationDocument.getPages().add();
for (Annotation annotation : sourceDocument.getPages().get_Item(1).getAnnotations()) {
page.getAnnotations().add(annotation, true);
}
destinationDocument.save(outputFile.toString());
}
}