기술 문서

HotPDF Component: Delphi에서 report output with fonts and images

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

이 글은 developers generating invoices, statements, labels, and regulatory report packages from Delphi을 위한 글입니다. report output with fonts and images을 단순한 컴포넌트 호출이 아니라 운영 환경의 문서 엔지니어링으로 다룹니다.

실제 위험은 reports often fail after deployment because fonts, image compression, DPI, pagination, and locale formatting differ from the developer machine입니다. 따라서 명확한 계약, 관찰 가능한 진단, 실제 고객 파일을 반영한 회귀 샘플이 필요합니다.

아키텍처 결정

Make report assets part of the build contract. approved fonts, embedding mode, fallback policy, and license constraints / image scaling, compression, color profile, transparency, and DPI rules

  • approved fonts, embedding mode, fallback policy, and license constraints
  • image scaling, compression, color profile, transparency, and DPI rules
  • page size, margins, headers, footers, widow control, and overflow policy
  • locale-sensitive formatting for dates, numbers, currency, and addresses

구현 흐름

Measure text and images with production resources. The order below keeps the workflow reviewable for Delphi and C++Builder teams.

  1. load template assets from a versioned location and validate availability first
  2. measure text with the same fonts that will be embedded in the final PDF
  3. normalize images before placing them so compression and DPI are predictable
  4. paginate with production margins and record overflow decisions
  5. compare representative output against approved reference PDFs

검증 증거

Report diagnostics that reduce layout disputes. Keep these fields with the output or support record.

  • template version, font list, embedded font status, image count, and compression mode
  • page count, overflow warnings, clipped object warnings, and fallback font usage
  • locale profile, currency format, and address layout used for the run
  • visual comparison result for high-value report templates

Template design and PDF generation must share assumptions

A reliable report pipeline owns its fonts, image processing, page boxes, number formats, and pagination rules. Treating those assets as external decoration makes the output unpredictable in service and customer environments.

지원 패키지 설계

HotPDF Component가 배포된 후 가장 유용한 지원 패키지는 입력, 프로필, 출력, 그리고 실패한 정확한 단계를 설명하는 것입니다

  • template version, font list, embedded font status, image count, and compression mode
  • page count, overflow warnings, clipped object warnings, and fallback font usage
  • locale profile, currency format, and address layout used for the run
  • visual comparison result for high-value report templates
  • terminology snapshot: font embedding, image compression, DPI, pagination

report output with fonts and images에 대한 엔지니어링 검토 노트

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

  • 결정: approved fonts, embedding mode, fallback policy, and license constraints. 구현상 핵심 지점: measure text with the same fonts that will be embedded in the final PDF. 승인 증거: locale profile, currency format, and address layout used for the run. 회귀 트리거: printer margins are not a reliable substitute for PDF page-box rules
  • 결정: image scaling, compression, color profile, transparency, and DPI rules. 구현상 핵심 지점: normalize images before placing them so compression and DPI are predictable. 승인 증거: visual comparison result for high-value report templates. 회귀 트리거: service accounts may not have the same fonts installed as developer desktops
  • 결정: page size, margins, headers, footers, widow control, and overflow policy. 구현상 핵심 지점: paginate with production margins and record overflow decisions. 승인 증거: template version, font list, embedded font status, image count, and compression mode. 회귀 트리거: transparent PNG assets can change file size or rendering across viewers
  • 결정: locale-sensitive formatting for dates, numbers, currency, and addresses. 구현상 핵심 지점: compare representative output against approved reference PDFs. 승인 증거: page count, overflow warnings, clipped object warnings, and fallback font usage. 회귀 트리거: long customer names and multilingual addresses expose measurement shortcuts

경계 사례

  • service accounts may not have the same fonts installed as developer desktops
  • transparent PNG assets can change file size or rendering across viewers
  • long customer names and multilingual addresses expose measurement shortcuts
  • printer margins are not a reliable substitute for PDF page-box rules

Delphi / C++Builder 참고 사항

HotPDF Component should sit behind a small service boundary that receives files, streams, profiles, and credentials, then returns output paths, warnings, metrics, and validation status. 중요한 용어는 font embedding, image compression, DPI, pagination, page box, report template.

Delphi 코드 예제

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

procedure RenderInvoicePdf(const OutputFile: string; const Invoice: TInvoice);
var
  Pdf: THotPDF;
begin
  Pdf := THotPDF.Create(nil);
  try
    Pdf.FileName := OutputFile;
    Pdf.FontEmbedding := True;
    Pdf.BeginDoc;
    DrawInvoiceHeader(Pdf, Invoice);
    DrawLineItems(Pdf, Invoice.Items);
    DrawImageAssets(Pdf, Invoice.BrandAssets);
    Pdf.EndDoc;
  finally
    Pdf.Free;
  end;
end;

운영 체크리스트

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

제품 문서

HotPDF Component

추가 코드 예제

Pdf.RegisterUnicodeTTF('C:\ProgramData\MyApp\Fonts\NotoSans.ttf');
Pdf.CurrentPage.SetFont('NotoSans', [], 12);
Pdf.CurrentPage.TextOut(50, 700, 0, WideString('Łódź — Ünïcode test ✓'));
var
  Png: TPngImage;
  Logo: TBitmap;
  LogoIdx: Integer;
begin
  Png := TPngImage.Create;
  Logo := TBitmap.Create;
  try
    Png.LoadFromFile('brand-logo.png');
    Logo.Assign(Png);                       // decode PNG to a bitmap
    LogoIdx := Pdf.AddImage(Logo, icFlate); // lossless for flat-color art
  finally
    Logo.Free;
    Png.Free;
  end;
  // (Index, X, Y, Width, Height, Angle) — not (X1, Y1, X2, Y2)
  Pdf.CurrentPage.ShowImage(LogoIdx, 50, 700, 120, 40, 0);
end;
// Horizontal rule under the table header
Pdf.CurrentPage.SetLineWidth(0.75);
Pdf.CurrentPage.MoveTo(50, 660);
Pdf.CurrentPage.LineTo(545, 660);
Pdf.CurrentPage.Stroke;

// Shaded totals box: X, Y, width, height
Pdf.CurrentPage.SetRGBFillColor(RGB(235, 235, 235));
Pdf.CurrentPage.Rectangle(395, 120, 150, 40);
Pdf.CurrentPage.Fill;