Delphi ve C++Builder uygulamalarına PDFium VCL Component iş akışlarını, Lazarus/FPC projelerine PDFium LCL Component iş akışlarını; görüntüleme, render, formlar, yazdırma, preflight raporları ve standart odaklı doğrulama için kaynak kodlu bileşenlerle ekleyin.
Bu yazı teams sharing PDF viewing code between Delphi, Lazarus, and Free Pascal applications için hazırlanmıştır. Lazarus and Free Pascal viewer integration konusunu tek bir bileşen çağrısı olarak değil, üretim düzeyinde belge mühendisliği olarak ele alır.
Pratik risk şudur: a viewer can compile in multiple IDEs yet fail in deployment because widget-set behavior, binary loading, calling conventions, and resource paths differ. Bu nedenle akışın yazılı sözleşmeye, gözlemlenebilir tanılara ve gerçekçi regresyon dosyalarına ihtiyacı vardır.
Mimari kararlar
Treat the viewer layer as portable infrastructure. supported IDEs, compiler versions, CPU architectures, and widget sets / PDFium binary location, bitness, load failure message, and update policy
- supported IDEs, compiler versions, CPU architectures, and widget sets
- PDFium binary location, bitness, load failure message, and update policy
- high-DPI scaling, mouse wheel, keyboard, and focus behavior across frameworks
- feature parity expectations for thumbnails, search, forms, printing, and annotations
Uygulama akışı
Stabilize runtime loading before adding UI features. Aşağıdaki sıra, iş akışını Delphi ve C++Builder ekipleri için incelenebilir tutar.
- create a small viewer shell that loads the PDFium runtime before opening documents
- normalize paths and binary names for each supported deployment layout
- exercise zoom, scroll, selection, and focus events on every widget set
- separate shared PDF logic from framework-specific panels and dialogs
- package diagnostics that identify missing binaries and architecture mismatches
Doğrulama kanıtı
Deployment evidence for mixed-toolchain support. Bu alanları çıktı veya destek kaydıyla birlikte saklayın.
- compiler, widget set, target architecture, PDFium binary path, and runtime version
- load success or failure reason before the first document is opened
- input-event test results for wheel, drag, keyboard, focus, and high-DPI scaling
- feature matrix showing which viewer actions are supported in each build
Portability is a packaging decision
A Lazarus and FPC integration should define how the PDFium binary is found, which widget sets are supported, how DPI and input events are normalized, and which viewer features are guaranteed across platforms.
Operational metrics to watch
The first release should expose enough metrics to prove the workflow is healthy under real files, not only under curated samples.
- count and rate for compiler, widget set, target architecture, PDFium binary path, and runtime version
- warning trend for a 32-bit application cannot load a 64-bit PDFium binary
- latency of the stage that must create a small viewer shell that loads the PDFium runtime before opening documents
- profile usage for supported IDEs, compiler versions, CPU architectures, and widget sets
Mühendislik inceleme notları: Lazarus and Free Pascal viewer integration
Özelliğin bir demoyu aşıp sürüm, destek ve müşteri eskalasyonu sırasında savunulabilir olduğunu doğrulamak için bu inceleme notlarını kullanın.
- Karar: supported IDEs, compiler versions, CPU architectures, and widget sets. Uygulama baskı noktası: normalize paths and binary names for each supported deployment layout. Kabul kanıtı: input-event test results for wheel, drag, keyboard, focus, and high-DPI scaling. Regresyon tetikleyicisi: printing and file dialogs may need framework-specific wrappers
- Karar: PDFium binary location, bitness, load failure message, and update policy. Uygulama baskı noktası: exercise zoom, scroll, selection, and focus events on every widget set. Kabul kanıtı: feature matrix showing which viewer actions are supported in each build. Regresyon tetikleyicisi: a 32-bit application cannot load a 64-bit PDFium binary
- Karar: high-DPI scaling, mouse wheel, keyboard, and focus behavior across frameworks. Uygulama baskı noktası: separate shared PDF logic from framework-specific panels and dialogs. Kabul kanıtı: compiler, widget set, target architecture, PDFium binary path, and runtime version. Regresyon tetikleyicisi: relative paths often work in the IDE and fail from installed shortcuts
Sınır durumları
- a 32-bit application cannot load a 64-bit PDFium binary
- relative paths often work in the IDE and fail from installed shortcuts
- widget-set differences can alter focus behavior in docked panes
- printing and file dialogs may need framework-specific wrappers
Delphi / C++Builder notes
PDFium 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 Lazarus, Free Pascal, LCL, PDFium, widget set, runtime loading.
Delphi kod örneği
Aşağıdaki Delphi taslağı bu konu için pratik bir servis sınırını gösterir. Politika kontrollerini, günlüklemeyi ve doğrulamayı dar ürün çağrısı bölümünün dışında tutarak akışı test edilebilir bırakın.
procedure TMainForm.OpenDocument(const FileName: string);
begin
PdfView.LoadFromFile(FileName);
TrackDocumentLifetime(FileName, PdfView.PageCount);
PageSpinEdit.MaxValue := PdfView.PageCount;
RenderCurrentPage;
UpdateToolbarState;
end;
Üretim kontrol listesi
- İş akışını boş bir dosyada, normal bir müşteri dosyasında ve en kötü durum dosyasında çalıştırın
- Oluşturulan PDF'yi hedef görüntüleyici, doğrulayıcı, yazıcı veya aşağı akış uygulamasıyla açın
- Ürün sürümünü, profil sürümünü, giriş karmasını, çıktı yolunu, geçen süreyi ve uyarı sayısını kaydedin
- Parolaları, sertifikaları, geçici dosyaları ve müşteri verilerini açık saklama kuralları altında tutun
- Bir müşteri dosyası yeni bir uç durum ortaya çıkardığında regresyon belgeleri ekleyin
Ürün belgeleri
Ek kod örnekleri
procedure TViewerForm.FormCreate(Sender: TObject);
begin
Pdf := TPdf.Create(Self);
PdfView := TPdfView.Create(Self);
PdfView.Parent := Self;
PdfView.Align := alClient;
PdfView.Pdf := Pdf;
PdfView.FitMode := pfmFitWidth;
if ParamCount > 0 then
begin
Pdf.FileName := ParamStr(1);
Pdf.Active := True; // opens the document; PageCount valid after this
end;
end;