|
TfrxHotPDFExport FastReport 4 / FastReport VCL adapter (
|
QuickReport adapter ReportBuilder device DevExpress adapter |
|
FastReport 4 / FastReport VCL PDF export filter,使用 HotPDF 作為底層 PDF backend,而不是 FastReport 自己內建的 PDF writer。適用於已嵌入 HotPDF,並希望整個應用程式共用單一 PDF backend 的專案
Delphi declaration: type TfrxHotPDFExport = class(TfrxCustomExportFilter) published property Compressed: Boolean default True; property Title, Author, Subject, Keywords: string; property PDFVersion: TPDFVersType default pdf17; property CompressionLevel: TPDFCompressionLevel default clDefault; property RenderDPI: Integer default 200; end;
說明 TfrxHotPDFExport 繼承自 TfrxCustomExportFilter,因此不需修改 FastReport core,即可接入一般 MyReport.Export(MyExportInstance) workflow。該 unit 會呼叫 RegisterComponents('FastReport 4.0 Export Filters', [TfrxHotPDFExport]),所以一旦 unit 加入 package,filter 就會出現在 IDE component palette
adapter 不重新實作 FastReport 完整 per-object PDF emitter,而是將每個已準備頁面導入 HotPDF 的 enhanced-metafile importer:
1. property UserPassword, OwnerPassword: string; property CryptKeyLength: THPDFKeyType default k40; property ProtectOptions: THPDFProtectOptions default []; property EncryptMetadata: Boolean default True; property DialogDefaultFileName, DialogFilter, DialogTitle: string; end;
Description TfrxHotPDFExport 繼承自
The adapter can export through one of three modes:
1. 2. 3. 4. 5. 2. 3. 4. FinishPage 透過 Report.PreviewPages.DrawPage 將已準備的 FastReport page render 到 TMetafile,然後透過 HotPDF 的 ShowEnhancedMetafile auto-scaling importer 播放該 metafile 5. Finish 呼叫 EndDoc,並在需要時將暫存 PDF 複製到呼叫端提供的 Stream 屬性
Title / Author / Subject / Keywords - 檔案 metadata。Title 為空時,adapter 會 fallback 到 Report.Name,因此 PDF 一定有非空 title PDFVersion - 檔案應目標的 PDF specification level。預設為 pdf17
RenderDPI - 透過 TMetafileCanvas rasterising FastReport page 時使用的 pixel density。值越高,文字與線條越銳利,但 metafile 與 PDF 越大。96 是 FastReport 的 native screen DPI;200(預設值)可提供列印品質結果,且不會產生過大檔案
Typical workflow
Exp := TfrxHotPDFExport.Create(nil); try Exp.FileName := 'Report.pdf'; Exp.Title := 'Monthly Statement'; Exp.PDFVersion := pdf17; Exp.RenderDPI := 200; frxReport1.Export(Exp); finally Exp.Free; end;
Capabilities preserved 由 FastReport 標準 layout engine render 的 vector 與 raster page content(文字、線條、矩形、填色、bitmaps)。GDI-resolved text strings(HotPDF 透過一般 HotPDF font subset path 嵌入 Windows-resolved fonts)。檔案層級 metadata
Limitations of the metafile bridge 由於頁面會擷取為 enhanced metafiles,需要結構資訊的 FastReport-specific PDF features(AcroForm fields、named destinations、document outlines、PDF/A 或 PDF/X conformance gates)不會傳遞。輸出會忠實重現 FastReport render 到螢幕 / 印表機的視覺結果,但不是 structured PDF。需要 AcroForm 輸出或 PDF/A conformance 的專案,應直接透過 HotPDF native API 驅動
Packaging note adapter 位於 Lib\Addons\FastReport4\,且不屬於主要 HotPDF*.dpk packages,因此 FastReport dependency 只會由選用此 adapter 的專案拉入。smoke test(smoke_frx_hotpdf.dpr)與該 unit 放在同一處
請參閱: TQRHotPDFExportFilter, TppHotPDFDevice, dxHotPDFExportReportLink, THPDFPage.ShowMetafile, Enhanced EMF/WMF Support Capabilities preserved Whole-page and object-canvas modes preserve vector and raster page content rendered by FastReport's standard layout engine. Native-object mode currently preserves supported memo text as PDF text with background, horizontal and vertical alignment, and frame styles; picture views as image XObjects; simple shapes as PDF geometry; line views as strokes; and view URLs as URI link annotations. Document-level metadata is preserved in every mode
Limitations FastReport-specific PDF features that require additional structural mapping (AcroForm fields, named destinations, and document outlines) are not propagated by this adapter. PDF/A and PDF/X gate properties are forwarded to HotPDF, but standard-specific assets such as OutputIntent profiles remain the caller's responsibility
Packaging note The adapter is distributed as an opt-in add-on rather than a dependency of the main
See also: TQRHotPDFExportFilter, TppHotPDFDevice, dxHotPDFExportReportLink, THPDFPage.ShowMetafile, Enhanced EMF/WMF Support |