|
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 PDFACompliance: string;
property PDFXCompliance: string;
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.
PDFACompliance and PDFXCompliance - forward HotPDF standards-conformance gates into the generated report PDF. Callers still prepare any required ICC profile, OutputIntent, tagging, or prepress assets through the normal HotPDF workflow before relying on the final conformance claim.
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;
Filter.PDFACompliance := '3B';
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, and outlines) are not propagated. PDF/A and PDF/X gate properties are forwarded to HotPDF, but standard-specific assets such as OutputIntent profiles remain the caller's responsibility. 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
|