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 showing sensitive PDFs inside line-of-business applications without granting full document-control features için hazırlanmıştır. secure PDF preview surfaces 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 preview window can accidentally become a data-exfiltration surface if printing, saving, clipboard, links, attachments, and temporary files are not governed. 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 preview as a permissioned operation. which roles can open, print, save, copy, search, annotate, or follow links / temporary file location, lifetime, naming, encryption, and cleanup policy
- which roles can open, print, save, copy, search, annotate, or follow links
- temporary file location, lifetime, naming, encryption, and cleanup policy
- external link, embedded file, JavaScript, and attachment handling
- audit events required for open, close, denied action, print, and export attempts
Uygulama akışı
Disable features by policy rather than hiding buttons. Aşağıdaki sıra, iş akışını Delphi ve C++Builder ekipleri için incelenebilir tutar.
- resolve the user's preview policy before the PDF is loaded
- open the document through a controlled stream or temporary file boundary
- disable and audit denied actions at the command layer, not only in visible buttons
- handle links, attachments, and scripts according to the preview profile
- clean temporary resources and write a session summary when the viewer closes
Doğrulama kanıtı
Security evidence for preview sessions. Bu alanları çıktı veya destek kaydıyla birlikte saklayın.
- user role, document classification, preview profile, and allowed action list
- denied commands, external target attempts, attachment attempts, and print requests
- temporary file path or stream mode plus cleanup result
- session duration, pages viewed when policy requires it, and close reason
Read-only UI is not the same as secure preview
Secure preview combines viewer permissions, application roles, document policy, link handling, attachment policy, temp-file control, and audit logging. The PDF renderer is only one layer of that surface.
Müşteri tarafından görülen davranış
Kullanıcılar dahili çağrı sırasını görmez. Dosyanın açılıp açılmadığını, doğrulanıp doğrulanmadığını, yazdırılıp yazdırılmadığını, düzenlenip düzenlenmediğini, içe aktarılıp aktarılmadığını veya reddedilip reddedilmediğini görürler. The workflow should translate secure PDF preview surfaces results into states users can act on.
- resolve the user's preview policy before the PDF is loaded
- open the document through a controlled stream or temporary file boundary
- disable and audit denied actions at the command layer, not only in visible buttons
- keyboard shortcuts and context menus can bypass toolbar-only restrictions
- attachments and links may leak data even when save is disabled
Mühendislik inceleme notları: secure PDF preview surfaces
Ö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: which roles can open, print, save, copy, search, annotate, or follow links. Uygulama baskı noktası: open the document through a controlled stream or temporary file boundary. Kabul kanıtı: temporary file path or stream mode plus cleanup result. Regresyon tetikleyicisi: watermarks should supplement policy but should not be the only protection
- Karar: temporary file location, lifetime, naming, encryption, and cleanup policy. Uygulama baskı noktası: disable and audit denied actions at the command layer, not only in visible buttons. Kabul kanıtı: session duration, pages viewed when policy requires it, and close reason. Regresyon tetikleyicisi: keyboard shortcuts and context menus can bypass toolbar-only restrictions
Sınır durumları
- keyboard shortcuts and context menus can bypass toolbar-only restrictions
- attachments and links may leak data even when save is disabled
- temporary preview files can remain recoverable if cleanup is not verified
- watermarks should supplement policy but should not be the only protection
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 secure preview, read-only viewer, audit log, temporary file, attachments, policy.
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 TSecurePreview.OpenReadOnly(const FileName: string);
begin
RequireAllowedLocation(FileName);
PdfView.LoadFromFile(FileName);
DisableSaveAndClipboardCommands;
RenderWatermarkedPage(1, CurrentUserName);
LogPreviewSession(FileName, PdfView.PageCount);
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 TPreviewPane.PdfViewWebLinkClick(Sender: TObject;
const Url: WString; var Handled: Boolean);
begin
Handled := True; // never fall through to the default shell behavior
if (AnsiStartsText('https://', Url) or AnsiStartsText('http://', Url))
and HostIsAllowed(Url) then
OpenInBrowser(Url)
else
FAudit.LogBlockedLink(FDocumentId, Url);
end;procedure TPreviewPane.ExportAttachment(Index: Integer; const TargetDir: string);
var
RawName, SafeName, Ext: string;
Data: TBytes;
begin
RawName := string(Pdf.AttachmentName[Index]);
SafeName := ExtractFileName(RawName); // strips any path components
Ext := LowerCase(ExtractFileExt(SafeName));
if not FAllowedExt.Contains(Ext) then // allowlist, not blocklist
raise EPreviewPolicy.CreateFmt('Attachment type %s blocked by policy', [Ext]);
Data := Pdf.Attachment[Index]; // embedded payload as raw bytes
TFile.WriteAllBytes(
IncludeTrailingPathDelimiter(TargetDir) + SafeName, Data);
end;