Java를 사용하여 주석 가져오기 및 내보내기
Contents
[
Hide
]
한 PDF에서 다른 PDF로 주석 복사
- 소스 PDF를 열고 대상 페이지가 포함된 새 대상 문서를 만드세요.
- 첫 번째 소스 페이지의 주석을 열거하고 각 주석을 대상 페이지에 추가하세요.
- 복사된 주석을 유지하려면 대상 문서를 저장하세요.
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());
}
}