TppHotPDFDevice

ReportBuilder adapter (Lib\Addons\ReportBuilder\ppHotPDFDevice.pas)

 

FastReport adapter  QuickReport adapter  DevExpress adapter

Device class ReportBuilder, який використовує HotPDF як underlying PDF backend замість власного ppPDFDevice ReportBuilder Призначений для projects, які вже embed HotPDF і хочуть єдиний PDF backend для всього application

 

Delphi declaration:

type

  TppHotPDFDevice = class(TppGraphicsDevice)

  public

    class function DeviceName: String; override;

    procedure StartJob; override;

    procedure EndJob; override;

    procedure CancelJob; override;

    procedure SetOutputStream(AStream: TStream);

    property FileName: string;

    property Title, Author, Subject, Keywords: string;

    property PDFVersion: TPDFVersType;

    property Compressed: Boolean;

    property CompressionLevel: TPDFCompressionLevel;

  end;

 

Опис

TppHotPDFDevice походить від TppGraphicsDevice (на один рівень вище TppCustomScreenDevice / TppImageDevice), тому входить у device chain ReportBuilder, коли призначений TppReport.PrinterDevice або використаний як publisher device на TppPublisher DeviceName повідомляється як 'HotPDF' Оскільки device registration у ReportBuilder виконується через ppRptDeviceMap, а не RegisterComponents, IDE component palette entry немає - callers створюють TppHotPDFDevice напряму

 

Кожна page, що проходить через TppGraphicsDevice.ReceivePage, малюється на transient TMetafileCanvas (створюється в BeforeRenderPage, finalised в AfterRenderPage) Captured TMetafile потім передається importer HotPDF ShowEnhancedMetafile з auto-scaling:

 

1. StartJob creates the THotPDF instance, sets metadata, and calls BeginDoc.

2. BeforeRenderPage creates a TMetafile sized to spWidth x spHeight plus a TMetafileCanvas, and sets it as the inherited Canvas.

3. RenderPage (inherited) проходить DrawCommands і routes їх через GraphicsContext на наш metafile canvas

4. AfterRenderPage finalises metafile (free canvas), додає нову HotPDF page розміром mmWidth x mmHeight (converted to PDF points) і програє metafile через ShowEnhancedMetafile

5. EndJob викликає HotPDF.EndDoc; якщо output є Stream, копіює bytes з temp file, записаного internally

 

Властивості

FileName - target PDF path. Used unless SetOutputStream has installed a stream.

Title / Author / Subject / Keywords - metadata документа Коли Title порожній, device fallback до FileName, щоб PDF завжди мав непорожній title

PDFVersion - рівень PDF specification, на який має орієнтуватися документ За замовчуванням pdf17

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

CompressionLevel - FlateDecode level. Defaults to clDefault.

SetOutputStream(AStream) - направляє PDF bytes у AStream замість запису на disk Викликайте до того, як report запускає StartJob

 

Typical workflow

 

Dev := TppHotPDFDevice.Create(nil);

try

  Dev.FileName := 'Report.pdf';

  Dev.Title := 'Monthly Statement';

  Dev.PDFVersion := pdf17;

  ppReport1.DeviceType := 'HotPDF';

  ppReport1.PrinterDevice := Dev;

  ppReport1.Print;

finally

  Dev.Free;

end;

 

Capabilities preserved

Vector і raster page content, rendered стандартним draw-command pipeline ReportBuilder GDI-resolved text strings Default 200 DPI metafile capture (configurable via inherited PixelsPerInch) дає print-quality output без надмірних файлів

 

Limitations of the metafile bridge

Оскільки pages capture як enhanced metafiles, PDF features, специфічні для ReportBuilder і залежні від structural information (AcroForm fields, named destinations, outlines, PDF/A або PDF/X conformance gates), не переносяться Output є точним visual reproduction того, що renderить ReportBuilder, а не structured PDF

 

Packaging note

Device знаходиться в Lib\Addons\ReportBuilder\ і не входить до основних packages HotPDF*.dpk, тому dependency ReportBuilder підтягується лише projects, які opt in до device Smoke test (smoke_pp_hotpdf.dpr) лежить поруч з unit

 

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