TQRHotPDFExportFilter

QuickReport adapter (Lib\Addons\QuickReport\qrHotPDFExport.pas)

 

FastReport adapter  ReportBuilder device  DevExpress adapter

QuickReport export filter that uses HotPDF as the underlying PDF backend instead of QuickReport's own QRPDFFilter. Intended for projects that already embed HotPDF and want a single PDF backend across the whole application.

 

Delphi declaration:

type

  TQRHotPDFExportFilter = class(TQRExportFilter)

  public

    constructor Create(Filename: string); override;

    procedure SetOutputStream(AStream: TStream);

    property Title, Author, Subject, Keywords: string;

    property PDFVersion: TPDFVersType;

    property Compressed: Boolean;

    property CompressionLevel: TPDFCompressionLevel;

  end;

 

Description

TQRHotPDFExportFilter descends from TQRExportFilter, so it slots into the regular MyReport.ExportToFilter(MyExporterInstance) workflow without any QuickReport core changes. Because TQRExportFilter is not a TComponent descendant (it is a plain class in QuickReport's design), there is no IDE component registration - callers instantiate TQRHotPDFExportFilter directly via Create('out.pdf').

 

QuickReport renders each prepared page into a TMetafile cached in QRPrinter.PageList. Rather than re-implementing the entire per-component TextOut / AcceptGraphic / AcceptBand callback set, the adapter ignores those (no-op overrides) and harvests the per-page metafiles in Finish:

 

1. Start(PaperWidth, PaperHeight, Font) - create the THotPDF instance, set metadata, call BeginDoc, and save (PaperWidth, PaperHeight) so Finish can shape pages correctly.

2. NewPage / EndPage / TextOut / AcceptGraphic - no-op (the metafile already has the rendered content).

3. Finish - for each cached QRPrinter.PageList[i] metafile, add (or reuse) a HotPDF page sized to PaperWidth / PaperHeight in points and call ShowEnhancedMetafile. Then EndDoc and release.

 

Properties

Title / Author / Subject / Keywords - document metadata. When Title is empty the adapter falls back to Filename so the PDF always has a non-empty title. Set before ExportToFilter is called.

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

Compressed - HotPDF stream compression on (default True). Set False for diagnostic PDFs.

CompressionLevel - FlateDecode level. Defaults to clDefault.

SetOutputStream(AStream) - route the PDF bytes into AStream instead of writing to disk. Call before ExportToFilter. Internally a temp file is used because HotPDF saves on EndDoc; the bytes are streamed back in Finish.

 

Typical workflow

 

Filter := TQRHotPDFExportFilter.Create('Report.pdf');

try

  Filter.Title := 'Monthly Statement';

  Filter.PDFVersion := pdf17;

  QuickRep1.ExportToFilter(Filter);

finally

  Filter.Free;

end;

 

Capabilities preserved

Vector and raster page content rendered by QuickReport's standard preview / printer pipeline. GDI-resolved text strings. Page sizing follows the PaperWidth / PaperHeight handed to Start by QuickReport.

 

Limitations of the metafile bridge

Because pages are captured as enhanced metafiles, QuickReport-specific PDF features that require structural information (AcroForm fields, named destinations, outlines, PDF/A or PDF/X conformance gates) are not propagated. The output is a faithful visual reproduction of what QuickReport renders, not a structured PDF.

 

Packaging note

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

 

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