TQRHotPDFExportFilter

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

 

FastReport adapter  ReportBuilder device  DevExpress adapter

מסנן ייצוא QuickReport שמשתמש ב-HotPDF כ-backend ה-PDF הבסיסי במקום QRPDFFilter של QuickReport. מיועד לפרויקטים שכבר מטמיעים HotPDF ורוצים backend PDF יחיד בכל היישום

 

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;

 

תיאור

TQRHotPDFExportFilter יורד מ-TQRExportFilter, ולכן משתלב בתהליך הרגיל MyReport.ExportToFilter(MyExporterInstance) ללא שינויי core ב-QuickReport. מכיוון ש-TQRExportFilter אינו צאצא של TComponent, אלא מחלקה רגילה בעיצוב של QuickReport, אין רישום IDE component; הקוראים יוצרים TQRHotPDFExportFilter ישירות דרך Create('out.pdf')

 

QuickReport מרנדר כל עמוד מוכן אל TMetafile שנשמר ב-QRPrinter.PageList. במקום לממש מחדש את כל מערך callbacks של TextOut / AcceptGraphic / AcceptBand לכל רכיב, המתאם מתעלם מהם, כ-overrides ללא פעולה, ואוסף את metafiles של כל עמוד ב-Finish:

 

1. Start(PaperWidth, PaperHeight, Font) - יוצר את מופע THotPDF, מגדיר metadata, קורא BeginDoc ושומר את (PaperWidth, PaperHeight) כדי ש-Finish יוכל לעצב את העמודים נכון

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

3. Finish - עבור כל metafile שמור ב-QRPrinter.PageList[i], מוסיף או מנצל מחדש עמוד HotPDF בגודל PaperWidth / PaperHeight בנקודות וקורא ShowEnhancedMetafile. לאחר מכן EndDoc ושחרור

 

מאפיינים

Title / Author / Subject / Keywords - metadata של המסמך. כאשר Title ריק, המתאם נופל חזרה אל Filename, כך של-PDF תמיד יש כותרת לא ריקה. יש להגדיר לפני קריאה ל-ExportToFilter

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) - מנתב את bytes של ה-PDF אל AStream במקום לכתוב לדיסק. יש לקרוא לפני ExportToFilter. פנימית נעשה שימוש בקובץ זמני כי HotPDF שומרת ב-EndDoc; ה-bytes מוזרמים חזרה ב-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

מפני שהעמודים נלכדים כ-enhanced metafiles, תכונות PDF ייחודיות ל-QuickReport שדורשות מידע מבני, כמו שדות AcroForm, named destinations, outlines ושערי תאימות PDF/A או PDF/X, אינן מועברות. הפלט הוא שחזור חזותי נאמן של מה ש-QuickReport מרנדר, לא PDF מובנה

 

Packaging note

המתאם נמצא ב-Lib\Addons\QuickReport\ ואינו חלק מחבילות HotPDF*.dpk הראשיות, לכן תלות QuickReport נמשכת רק על ידי פרויקטים שבוחרים להשתמש במתאם. בדיקת smoke ‏(smoke_qr_hotpdf.dpr) נמצאת לצד היחידה

 

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