TfrxHotPDFExport

FastReport 4 / FastReport VCL adapter (Lib\Addons\FastReport4\frxHotPDFExport.pas)

 

QuickReport adapter  ReportBuilder device  DevExpress adapter

FastReport 4 / FastReport VCL PDF export filter that uses HotPDF as the underlying PDF backend instead of FastReport's own built-in PDF writer. Intended for projects that already embed HotPDF and want a single PDF backend across the whole application.

 

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;

 

Description

TfrxHotPDFExport descends from TfrxCustomExportFilter, so it slots into the regular MyReport.Export(MyExportInstance) workflow without any FastReport core changes. The unit calls RegisterComponents('FastReport 4.0 Export Filters', [TfrxHotPDFExport]), so the filter shows up in the IDE component palette once the unit is added to a package.

 

Rather than re-implementing FastReport's full per-object PDF emitter, the adapter routes each prepared page through HotPDF's enhanced-metafile importer:

 

1. Start creates a fresh THotPDF instance and sets the document metadata (Title / Author / Subject / Keywords / PDFVersion / Compression).

2. StartPage sizes the new HotPDF page in points to match the FastReport report page's millimeter dimensions.

3. ExportObject is a no-op (the whole page is captured at FinishPage time, not per-object).

4. FinishPage renders the prepared FastReport page into a TMetafile via Report.PreviewPages.DrawPage, then plays the metafile through HotPDF's ShowEnhancedMetafile auto-scaling importer.

5. Finish calls EndDoc and copies the temp PDF to the caller-supplied Stream if needed.

 

Properties

Compressed - HotPDF stream compression on (default True). Set False for diagnostic PDFs (~5x larger files).

Title / Author / Subject / Keywords - document metadata. When Title is empty the adapter falls back to Report.Name so the PDF always has a non-empty title.

PDFVersion - the PDF specification level the document should target. Defaults to pdf17.

CompressionLevel - FlateDecode level. Defaults to clDefault.

RenderDPI - pixel density used when rasterising the FastReport page through TMetafileCanvas. Higher = crisper text and lines but larger metafile and PDF. 96 is FastReport's native screen DPI; 200 (default) gives print-quality results without enormous files.

 

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

Vector and raster page content (text, lines, rectangles, fills, bitmaps) rendered by FastReport's standard layout engine. GDI-resolved text strings (HotPDF embeds the Windows-resolved fonts via the regular HotPDF font subset path). Document-level metadata.

 

Limitations of the metafile bridge

Because pages are captured as enhanced metafiles, FastReport-specific PDF features that require structural information (AcroForm fields, named destinations, document outlines, PDF/A or PDF/X conformance gates) are not propagated. The output is a faithful visual reproduction of what FastReport renders to screen / printer, not a structured PDF. Projects that need AcroForm output or PDF/A conformance should drive HotPDF directly through its native API.

 

Packaging note

The adapter lives in Lib\Addons\FastReport4\ and is not part of the main HotPDF*.dpk packages, so the FastReport dependency is only pulled in by projects that opt in to the adapter. A smoke test (smoke_frx_hotpdf.dpr) lives alongside the unit.

 

See also: TQRHotPDFExportFilter, TppHotPDFDevice, dxHotPDFExportReportLink, THPDFPage.ShowMetafile, Enhanced EMF/WMF Support