Skip to main content

TdxComponentPrinter Class

A component printer.

Declaration

TdxComponentPrinter = class(
    TCustomdxComponentPrinter
)

Remarks

A component printer allows you to print content of any control in your application. This component manages a list of report links (TBasedxReportLink class descendant instances) that import information from printed components.

While TdxComponentPrinter is the main component required to print any control or export its content, you need to create report links to associate the component with all controls you need to print.

Design-Time Functionality

Double-click the component to invoke the Report Links editor dialog.

VCL Printing System: An Empty Report Links Editor

This dialog allows you to manage all report links in your application. Click the Add… button to invoke the Add Link dialog.

VCL Printing System: The Add Link Dialog

The Available Source(s) box lists all controls for which you can create a report link. For example, you can select a Chart control and click the OK button to create a report link (a TdxChartControlReportLink class instance) for the control.

VCL Printing System: The Report Links Editor with a Chart Control Report Link

Close the Report Links dialog. You can now use report link and component printer APIs to print Chart control content and invoke the Print Preview dialog for the control.

The following code example creates a report link for an existing Chart control, customizes report link settings, exports control content to a PDF document file, and deletes the created report link:

var
  AReportLink: TBasedxReportLink;
begin
  // Creates a Chart control report link
  AReportLink := dxComponentPrinter1.AddEmptyLinkEx(TdxChartControlReportLink, dxChartControl1);
  try
    AReportLink.PDFExportOptions.JPEGQuality := 80;  // Adjusts the JPEG compression rate for export
    AReportLink.PDFExportOptions.OpenDocumentAfterExport := True; // Opens the resulting document after export
    AReportLink.ExportToPDF;  // Invokes "PDF Export Options" and "Save As" dialogs
  finally
    dxComponentPrinter1.DeleteLink(dxComponentPrinter1.LinkCount - 1); // Deletes the report link after export
  end;
end;

VCL Printing System: A PDF Document with Exported Chart Content

Main API Members

The list below outlines key members of the TdxComponentPrinter class. These members allow you to manage report links and print content of different controls in your application.

Component Settings

DateFormat | TimeFormat
Specify date and time formats.
LoadFromFile | LoadFromStream
Load component printer and report link settings from a file or stream.
LoadFromIniFile | LoadFromRegistry
Load format settings from an INI file or the system registry.
Options
Allows you to disable or enable individual component printer behavior options.
OverwriteExistingFiles
Specifies if the component printer overwrites existing report image files.
SaveToIniFile | SaveToRegistry
Save the current format settings to an INI file or the system registry.
SaveToFile | SaveToStream
Save the current component printer and report link settings to a file or stream.
AddLink | AddLinkEx | AddEmptyLink | AddEmptyLinkEx
Create new report links.
AssignReportLinks
Copies report links between component printers.
CurrentLink | CurrentLinkIndex
Allow you to change the active report link.
DeleteLink | DeleteAllLinks
Delete existing report links.
ReportLink
Provides indexed access to all report links in the component printer.
EnumPagesAsImages | SavePagesAsImagesToDisk
Allow you to export report content in bitmap formats.
ExportToPDF
Exports report content to PDF.
OnExportProgress
Allows you to track export progress.
Print | PrintEx | PrintPages | PrintPagesEx
Allow you to print a report.

End-User Dialog APIs

PageSetup | PageSetupEx
Invoke the Page Setup dialog.
PreviewOptions
Allows you to customize the Print Preview dialog.
ShowCustomizeDlg
Invokes the Edit Reports dialog.
See Also