기술 문서

HotPDF Component: Delphi에서 object streams 및 incremental updates

HotPDF는 Delphi 및 C++Builder 애플리케이션을 위한 네이티브 VCL PDF 라이브러리입니다. 외부 PDF 런타임 배포 없이 PDF 생성, 편집, 양식, 주석, 암호화, 디지털 서명, Unicode 글꼴 처리, 표준 지향 출력, 프리플라이트 보고를 지원합니다.

이 글은 이미 서명, 개정, 압축 오브젝트 또는 복구 이력을 포함할 수 있는 PDF를 유지보수하는 엔지니어를 위한 글입니다을 위한 글입니다. object streams 및 incremental updates을 단순한 컴포넌트 호출이 아니라 운영 환경의 문서 엔지니어링으로 다룹니다.

실제 위험은 파일을 새로 생성한 것처럼 다시 쓰면 개정 이력이 사라지거나, 서명이 깨지거나, 손상된 교차 참조 데이터가 숨겨질 수 있습니다입니다. 따라서 명확한 계약, 관찰 가능한 진단, 실제 고객 파일을 반영한 회귀 샘플이 필요합니다.

아키텍처 결정

기존 개정 체인을 이해합니다. 기존 서명이나 감사 추적을 유효한 상태로 유지해야 하는지 / object stream 보존, 압축 해제 또는 재압축 정책

  • 기존 서명이나 감사 추적을 유효한 상태로 유지해야 하는지
  • object stream 보존, 압축 해제 또는 재압축 정책
  • repair handling when cross-reference data is inconsistent
  • metadata and catalog updates that should be appended instead of rewritten

구현 흐름

전체 다시 쓰기와 증분 저장은 의도적으로 선택합니다. 아래 순서는 Delphi 및 C++Builder 팀이 검토하기 쉽게 만듭니다.

  1. inspect the source for signatures, xref streams, object streams, and prior revisions
  2. select incremental update only when the business goal requires preservation
  3. write changed objects to a new revision and leave untouched objects stable
  4. verify signatures, object counts, and cross-reference consistency after saving
  5. record the reason if a full rewrite was required for repair or normalization

검증 증거

개정 증거를 기록합니다. 이 필드들은 출력 또는 지원 기록과 함께 보관합니다.

  • source revision count, signature presence, xref style, and object stream count
  • save mode, changed object identifiers, and whether object streams were preserved
  • validator output before and after the update
  • signature status for every signed revision after the final file is written

압축 오브젝트는 지원 진단 방식을 바꿉니다

Object streams, hybrid cross-reference tables, and incremental saves는 현대 PDF에서 일반적입니다. 워크플로는 개정을 보존하는지, 새 개정을 덧붙이는지, 아니면 깨끗한 출력 파일을 만드는지를 알아야 합니다.

출시 전 확인 사항

이 항목이 프로덕션에 도달하기 전에 팀은 소스 코드를 읽지 않고도 이 질문들에 답할 수 있어야 합니다

  • 기존 서명이나 감사 추적을 유효한 상태로 유지해야 하는 책임은 누구에게 있나요?
  • 원본 개정 수, 서명 존재 여부, xref 스타일, object stream 수를 증명하는 증거는 무엇인가요?
  • 보이는 내용이 변하지 않아도 전체 다시 쓰기가 서명을 무효화할 수 있을 때는 어떻게 되나요?
  • 복구 또는 정규화를 위해 전체 다시 쓰기가 필요했던 이유를 기록하는 회귀 파일은 무엇인가요?

object streams 및 incremental updates에 대한 엔지니어링 검토 노트

이 검토 노트를 사용해 기능이 데모 단계를 넘어섰고 출시, 지원, 고객 에스컬레이션 상황에서 설명할 수 있는지 확인합니다

  • 결정: 기존 서명이나 감사 추적을 유효한 상태로 유지해야 하는지. 구현상 핵심 지점: select incremental update only when the business goal requires preservation. 승인 증거: validator output before and after the update. 회귀 트리거: object-stream compression can make diff-based support investigations misleading
  • 결정: object stream 보존, 압축 해제 또는 재압축 정책. 구현상 핵심 지점: write changed objects to a new revision and leave untouched objects stable. 승인 증거: signature status for every signed revision after the final file is written. 회귀 트리거: a full rewrite can invalidate signatures even when visible content is unchanged
  • 결정: repair handling when cross-reference data is inconsistent. 구현상 핵심 지점: verify signatures, object counts, and cross-reference consistency after saving. 승인 증거: source revision count, signature presence, xref style, and object stream count. 회귀 트리거: repairing a damaged file may require a support note explaining lost revisions
  • 결정: metadata and catalog updates that should be appended instead of rewritten. 구현상 핵심 지점: record the reason if a full rewrite was required for repair or normalization. 승인 증거: save mode, changed object identifiers, and whether object streams were preserved. 회귀 트리거: linearization can be lost after incremental updates unless the workflow rebuilds it
  • 결정: 기존 서명이나 감사 추적을 유효한 상태로 유지해야 하는지. 구현상 핵심 지점: inspect the source for signatures, xref streams, object streams, and prior revisions. 승인 증거: validator output before and after the update. 회귀 트리거: object-stream compression can make diff-based support investigations misleading
  • 결정: object stream 보존, 압축 해제 또는 재압축 정책. 구현상 핵심 지점: select incremental update only when the business goal requires preservation. 승인 증거: signature status for every signed revision after the final file is written. 회귀 트리거: a full rewrite can invalidate signatures even when visible content is unchanged
  • 결정: repair handling when cross-reference data is inconsistent. 구현상 핵심 지점: write changed objects to a new revision and leave untouched objects stable. 승인 증거: source revision count, signature presence, xref style, and object stream count. 회귀 트리거: repairing a damaged file may require a support note explaining lost revisions

경계 사례

  • a full rewrite can invalidate signatures even when visible content is unchanged
  • repairing a damaged file may require a support note explaining lost revisions
  • linearization can be lost after incremental updates unless the workflow rebuilds it
  • object-stream compression can make diff-based support investigations misleading

Delphi / C++Builder 참고 사항

HotPDF Component는 파일, 스트림, 프로필, 자격 증명을 받아 출력 경로, 경고, 메트릭, 검증 상태를 반환하는 작은 서비스 경계 뒤에 두어야 합니다. 중요한 용어는 object stream, incremental update, xref stream, revision, signature preservation, repair.

Delphi 코드 예제

다음 Delphi 스케치는 이 주제에 맞는 실무형 서비스 경계를 보여 줍니다. 정책 검사, 로깅, 검증을 좁은 제품 호출 구간 밖에 두면 워크플로를 테스트하기 쉽습니다.

procedure SaveCompactIncrementalPdf(const OutputFile: string);
var
  Pdf: THotPDF;
begin
  Pdf := THotPDF.Create(nil);
  try
    Pdf.FileName := OutputFile;
    Pdf.UseXRefStream := True;
    Pdf.UseObjectStreams := True;
    Pdf.BeginDoc;
    AddRevisionContent(Pdf);
    Pdf.EndDoc;
    CompareObjectStreamProfile(OutputFile);
  finally
    Pdf.Free;
  end;
end;

운영 체크리스트

  • 워크플로는 빈 파일, 일반 고객 파일, 최악의 파일에서 실행합니다
  • 생성된 PDF는 대상 뷰어, 검증기, 프린터 또는 downstream 애플리케이션에서 엽니다
  • 제품 버전, 프로필 버전, 입력 해시, 출력 경로, 경과 시간, 경고 수를 기록합니다
  • 암호, 인증서, 임시 파일, 고객 데이터는 명확한 보존 규칙에 따라 관리합니다
  • 고객 파일이 새로운 경계 사례를 드러내면 회귀 문서를 추가합니다

제품 문서

HotPDF Component

추가 코드 예제

Pdf.BeginIncrementalUpdate('contract-signed.pdf');
Pdf.AddPage;
Pdf.CurrentPage.SetFont('Arial', [], 10);
Pdf.CurrentPage.TextOut(50, 760, 0, 'Addendum recorded 2026-06-11');
Pdf.SaveIncrementalUpdate('contract-updated.pdf');  // appends the delta only
PageCount := Pdf.LoadFromFile('base.pdf');
Pdf.InsertPagesFromDocument(OtherDoc, '1-3', 5);  // pages 1-3 after page 5
Pdf.MovePage(2, 5);
Pdf.SaveLoadedDocument('modified.pdf');
Pdf.LoadFromFile('stamped.pdf');
Pdf.SaveLoadedDocument('compacted.pdf');