Java에서 PDF에 Bates 번호 매기기 추가

Bates 번호 지정 아티팩트는 각 페이지에 지속적인 페이지 수준 식별자가 필요한 법적, 보관 및 문서 제어 작업 흐름에 유용합니다.

전용 도우미를 사용하여 Bates 번호 매기기 추가

전용 페이지 컬렉션 도우미를 통해 Bates 번호 매기기를 적용하려는 경우 이 예를 사용하세요.

  1. 소스 PDF Document를 열고 샘플에 필요한 추가 페이지를 추가하세요.
  2. BatesNAtifact 구성을 생성하세요.
  3. 페이지 컬렉션에 Bates 번호 매기기를 적용하고 출력 파일을 저장하세요.
public static void addBatesNArtifact(Path inputFile, Path outputFile) {
    try (Document document = new Document(inputFile.toString())) {
        for (int i = 0; i < 2; i++) {
            document.getPages().add();
        }

        BatesNArtifact batesArtifact = createBatesArtifact();
        PageCollectionExtensions.addBatesNumbering(document.getPages(), batesArtifact);
        document.save(outputFile.toString());
    }
}

페이지 매김 아티팩트를 통해 Bates 번호 매기기 추가

이 예에서는 일반 페이지 매김 API를 통해 Bates 아티팩트를 전달하여 Bates 번호 매기기를 적용합니다.

  1. 원본 PDF Document를 열고 필요한 페이지를 추가하세요.
  2. BatesNAtifact를 생성하고 페이지 매김 아티팩트 목록에 추가하세요.
  3. 페이지 컬렉션에 페이지 매김 아티팩트를 적용하고 문서를 저장하세요.
public static void addBatesNArtifactPagination(Path inputFile, Path outputFile) {
    try (Document document = new Document(inputFile.toString())) {
        for (int i = 0; i < 2; i++) {
            document.getPages().add();
        }

        BatesNArtifact batesArtifact = createBatesArtifact();
        List<PaginationArtifact> paginationArtifacts = new ArrayList<>();
        paginationArtifacts.add(batesArtifact);
        PageCollectionExtensions.addPagination(document.getPages(), paginationArtifacts);
        document.save(outputFile.toString());
    }
}

Bates 번호 매기기 삭제

기존 Bates 번호 매기기 가공물을 문서에서 제거해야 하는 경우 이 방법을 사용하세요.

  1. 원본 PDF Document를 여세요.
  2. Bates 번호 매기기를 삭제하는 페이지 컬렉션 도우미를 호출하세요.
  3. 정리된 출력 파일을 저장하세요.
public static void deleteBatesNumbering(Path inputFile, Path outputFile) {
    try (Document document = new Document(inputFile.toString())) {
        PageCollectionExtensions.deleteBatesNumbering(document.getPages());
        document.save(outputFile.toString());
    }
}