TTMSFNCGraphicsPrintIo
A second level on top of the TMSFNCPrinter can be used to create a document with some more configurable layout as header, footer and pagenumber.
It also allows to export certain TMS FNC components as well.
Methods
| Method name |
Description |
| Print |
Starts a new document to print. |
| Print(AExportObject: TTMSFNCPrintIOExportObject;AExportRect: TRectF); |
Starts a new document with a TMS FNC component and the rectangle to where it should be placed. |
| procedure Print(AExportObjects: TTMSFNCPrintIOExportObjectArray); |
Starts a new document with an array of multiple TMS FNC components. |
| Print(AExportObjects: TTMSFNCPrintIOExportObjectArray; AExportRects: TTMSFNCPrintIOExportRectArray); |
Starts a new document with an array of multiple TMS FNC components and places them in their respective rectangles. |
Events
| Event name |
Description |
| OnAfterDraw |
Is triggered when all the drawing is done. It has the TTMSFNCGraphics property as a parameter. |
| OnAfterDrawContent |
Is triggered when one of the export objects has been drawn or before adding a new page. It has the TTMSFNCGraphics property as a parameter and the export object TTMSFNCPrintIOExportObject. |
| OnAfterDrawFooter |
Is triggered when the footer text has been drawn. It has the following parameters: the export object TTMSFNCPrintIOExportObject, the page index, the drawing rectangle, the TTMSFNCGraphics property and the footer text. |
| OnAfterDrawHeader |
Is triggered when the header text has been drawn. It has the following parameters: the export object TTMSFNCPrintIOExportObject, the page index, the drawing rectangle, the TTMSFNCGraphics property and the header text. |
| OnAfterDrawPageNumber |
Is triggered when the page number has been drawn. It has the following parameters: the page index, the drawing rectangle, the TTMSFNCGraphics property and the page number formatted text. |
| OnBeforeDrawContent |
Is triggered before drawing one of the export objects has been drawn or when a new page is added. It has the following parameters: TTMSFNCGraphics property, the export object TTMSFNCPrintIOExportObject and a DefaultDraw Boolean to enable the drawing or not. |
| OnBeforeDrawFooter |
Is triggered before drawing the footer text. It has the following parameters: the export object TTMSFNCPrintIOExportObject, the page index, the drawing rectangle, the TTMSFNCGraphics property, the footer text and the DefaultDraw Boolean. |
| OnBeforeDrawHeader |
Is triggered before drawing the header text. It has the following parameters: the export object TTMSFNCPrintIOExportObject, the page index, the drawing rectangle, the TTMSFNCGraphics property, the header text and the DefaultDraw Boolean. |
| OnBeforeDrawPageNumber |
Is triggered before drawing the page number. It has the following parameters: the page index, the drawing rectangle, the TTMSFNCGraphics property, the page number formatted text, and the DefaultDraw Boolean. |
| OnCanCreateNewPage |
Is triggered before drawing a new export object, to check if a newpage should be created. It has the following parameters: the TTMSFNCGraphics property, the export object TTMSFNCPrintIOExportObject and a Boolean to allow the new page or not. |
| OnGetExportRect |
Is triggered before exporting the TMS FNC component to the rectangle. It has the following parameters: the TTMSFNCGraphics property, the export object TTMSFNCPrintIOExportObject and the rectangle used for the export. |
Properties
| Property name |
Description |
| BitmapContainer |
The TTMSFNCBitmapContainer will be attached to the used TTMSFNCGraphics when exporting the TMS FNC component. |
| ExportObject |
The TTMSFNCPrintIOExportObject property is another way to set the object that you want to export. |
| Options |
The TTMSFNCPrintIOOptions property is used to further customize the document settings and the layout of the footer, header, and page number. |
TTMSFNCPrintIOOptions Properties
| Property name |
Description |
| DefaultFont |
TTMSFNCGraphicsFont used for the text drawing if not customized by the user. |
| Device |
The device name as a String retrieved from the TTMSFNCPrinters class. |
| Footer |
The footer text as a String. |
| FooterFont |
TTMSFNCGraphicsFont used for the footer drawing. |
| FooterHorizontalAlignment |
TTMSFNCGraphicsTextAlign for horizontal position in the drawing rectangle for the footer. |
| FooterMargins |
TTMSFNCMargins to set the space between the page borders for the footer. |
| FooterSize |
The height of the footer as a Single. |
| FooterVerticalAlignment |
TTMSFNCGraphicsTextAlign for vertical position in the drawing rectangle for the footer. |
| Header |
The header text as a String. |
| HeaderFont |
TTMSFNCGraphicsFont used for the header drawing. |
| HeaderHorizontalAlignment |
TTMSFNCGraphicsTextAlign for horizontal position in the drawing rectangle for the header. |
| HeaderMargins |
TTMSFNCMargins to set the space between the page borders for the header. |
| HeaderSize |
The height of the header as a Single. |
| HeaderVerticalAlignment |
TTMSFNCGraphicsTextAlign for vertical position in the drawing rectangle for the header. |
| Margins |
TTMSFNCMargins to set the space between the page borders. |
| PageNumber |
TTMSFNCPrintPageNumber for the position of the page number: pnHeader, pnFooter or pnNone. |
| PageNumberFont |
TTMSFNCGraphicsFont used for the page number drawing. |
| PageNumberFormat |
UnicodeString how the page number is shown as text. |
| PageNumberHorizontalAlignment |
TTMSFNCGraphicsTextAlign for horizontal position in the drawing rectangle for the page number. |
| PageNumberMargins |
TTMSFNCMargins to set the space between the page borders for the page number. |
| PageNumberSize |
The height for the page number as a Single. |
| PageNumberVerticalAlignment |
TTMSFNCGraphicsTextAlign for vertical position in the drawing rectangle for the page number. |
| PageOrientation |
TPrinterOrientation retrieved from the TTMSFNCPrinters class. |
| PageSize |
For Android, the TPrintSize retrieved from the TTMSFNCPrinters class. |
Example
uses
…, FMX.TMSFNCPrintIO;
procedure Click(Sender: TObject);
var
r: TRectF;
begin
TMSFNCGraphicsPrintIO1.Options.Footer := 'My Footer Text';
TMSFNCGraphicsPrintIO1.Options.PageNumber := pnHeader;
TMSFNCGraphicsPrintIO1.Options.PageNumberFormat := 'Page %d';
r := RectF(TMSFNCGraphicsPrintIO1.Options.Margins.Left,
TMSFNCGraphicsPrintIO1.Options.Margins.Top,
TMSFNCGraphicsPrintIO1.Options.Margins.Left + TMSFNCGrid1.Width,
TMSFNCGraphicsPrintIO1.Options.Margins.Top + TMSFNCGrid1.Height);
TMSFNCGraphicsPrintIO1.Print(TMSFNCGrid1, r);
end;
