HotPDF to natywna biblioteka PDF VCL dla aplikacji Delphi i C++Builder, które potrzebują bezpośredniego tworzenia i edycji PDF, formularzy, adnotacji, szyfrowania, podpisów cyfrowych, czcionek Unicode, wyjścia zgodnego ze standardami i raportów preflight bez instalowania zewnętrznego runtime PDF.
Ten artykuł jest przeznaczony dla developers generating invoices, statements, labels, and regulatory report packages from Delphi. Traktuje report output with fonts and images jako produkcyjną inżynierię dokumentów, a nie pojedyncze wywołanie komponentu.
Praktyczne ryzyko polega na tym, że reports often fail after deployment because fonts, image compression, DPI, pagination, and locale formatting differ from the developer machine. Dlatego przepływ wymaga spisanego kontraktu, obserwowalnej diagnostyki i realistycznych plików regresyjnych.
Decyzje architektoniczne
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
Przebieg implementacji
Measure text and images with production resources. Poniższa kolejność zachowuje czytelność przepływu pracy dla zespołów Delphi i C++Builder.
- load template assets from a versioned location and validate availability first
- measure text with the same fonts that will be embedded in the final PDF
- normalize images before placing them so compression and DPI are predictable
- paginate with production margins and record overflow decisions
- compare representative output against approved reference PDFs
Dowody walidacji
Report diagnostics that reduce layout disputes. Zachowaj te pola wraz z wynikiem lub rekordem wsparcia.
- 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.
Support package design
Once HotPDF Component is deployed, the most valuable support package is the one that explains the input, profile, output, and exact stage that failed.
- 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
Notatki przeglądu inżynierskiego dla report output with fonts and images
Użyj tych notatek przeglądu, aby upewnić się, że funkcja wyszła poza demonstrację i da się ją obronić podczas wydania, wsparcia i eskalacji klienta.
- Decyzja: approved fonts, embedding mode, fallback policy, and license constraints. Punkt nacisku implementacji: measure text with the same fonts that will be embedded in the final PDF. Dowody akceptacji: locale profile, currency format, and address layout used for the run. Wyzwalacz regresji: printer margins are not a reliable substitute for PDF page-box rules
- Decyzja: image scaling, compression, color profile, transparency, and DPI rules. Punkt nacisku implementacji: normalize images before placing them so compression and DPI are predictable. Dowody akceptacji: visual comparison result for high-value report templates. Wyzwalacz regresji: service accounts may not have the same fonts installed as developer desktops
- Decyzja: page size, margins, headers, footers, widow control, and overflow policy. Punkt nacisku implementacji: paginate with production margins and record overflow decisions. Dowody akceptacji: template version, font list, embedded font status, image count, and compression mode. Wyzwalacz regresji: transparent PNG assets can change file size or rendering across viewers
- Decyzja: locale-sensitive formatting for dates, numbers, currency, and addresses. Punkt nacisku implementacji: compare representative output against approved reference PDFs. Dowody akceptacji: page count, overflow warnings, clipped object warnings, and fallback font usage. Wyzwalacz regresji: long customer names and multilingual addresses expose measurement shortcuts
Przypadki brzegowe
- 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 notes
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. Important terms include font embedding, image compression, DPI, pagination, page box, report template.
Przykład kodu Delphi
Poniższy szkic Delphi pokazuje praktyczną granicę usługi dla tego tematu. Kontrole zasad, logowanie i walidację trzymaj poza wąskim blokiem wywołań produktu, aby przepływ pozostał testowalny.
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;
Lista produkcyjna
- Uruchom przepływ pracy na pustym pliku, zwykłym pliku klienta i pliku z najgorszego scenariusza
- Otwórz wygenerowany plik PDF w docelowej przeglądarce, walidatorze, drukarce lub aplikacji nadrzędnej
- Zaloguj wersję produktu, wersję profilu, hash wejścia, ścieżkę wyjścia, czas wykonania i liczbę ostrzeżeń
- Przechowuj hasła, certyfikaty, pliki tymczasowe i dane klienta zgodnie z jednoznacznymi zasadami retencji
- Dodaj dokument regresyjny, gdy plik klienta ujawni nowy przypadek brzegowy
Dokumentacja produktu
Dodatkowe przykłady kodu
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;