Hi
I'm using the PDF export of the TTmsFncDataGrid and it works very well!.
I just have one question. I would like the grid to appear smaller in the PDF. I have set the TMSFNCDataGridPDFIO.Options.FitTiPage property to False, however it still comes out too big.
I have also tried with TMSFNCDataGridPDFIO1.Rendered.ApplyExportScale, but it has the drawback that it alters the Grid in the Form. Also, the Grid has Client alignment, so ApplyExportScale shrinks all the cells correctly, but the total width of the grid does not change. And if I change the alignment, I run into the problem that once the PDF is generated, I cannot return the grid to the original display in the form.
Is there any other solution to shrink it to 75%, for example?
the PDFIO component exports with a fixed scale of 1.0 when FitToPage is False. This is currently not customizable, we'll investigate the possibilities. In fact, the PDFIO component is merely a wrapper around PDFLib & Renderer export capabilities, so if you want more control over the rendering, size and more you can use the following workaround:
uses
FMX.TMSFNCGraphicsPDFEngine, FMX.TMSFNCPDFLib;
procedure TForm1.Button1Click(Sender: TObject);
var
en: TTMSFNCGraphicsPDFEngine;
p: TTMSFNCPDFLib;
begin
p := TTMSFNCPDFLib.Create;
en := TTMSFNCGraphicsPDFEngine.Create(p);
try
p.BeginDocument('out.pdf');
TMSFNCDataGrid1.Root.&Export(
en, //graphics engine
RectF(100, 100, 300, 300), //export rectangle
MakeCellRange(0, 0, TMSFNCDataGrid1.ColumnCount - 1, TMSFNCDataGrid1.RowCount - 1), //cell range
False, //repeat fixed columns
False, //repeat fixed rows
True, //fit to page
False, //skip save bounds
procedure
begin
p.NewPage;
end,
function: Integer
begin
Result := p.GetPageIndex;
end
);
p.EndDocument(True);
finally
en.Free;
p.Free;
end;
end;