PeterPanettone 158 Posted November 23, 2023 Does Skia in Delphi 12 have a built-in PrintPreview and Print capability? Share this post Link to post
Lars Fosdal 1793 Posted November 23, 2023 Perusing the source code, it appears that a Print capability is supported. Regular FMX doesn't have print preview, so I doubt there is SKIA support for that. Share this post Link to post
PeterPanettone 158 Posted November 23, 2023 2 minutes ago, Lars Fosdal said: Perusing the source code, it appears that a Print capability is supported. Regular FMX doesn't have print preview, so I doubt there is SKIA support for that. I need it for a VCL project where I use a TSkSVG component, which I need to PrintPreview and Print. Share this post Link to post
Keesver 23 Posted November 23, 2023 You can print to PDF and then show this to the user. I can't tell you how to do this from the top of my head though. Share this post Link to post
PeterPanettone 158 Posted November 23, 2023 (edited) 1 hour ago, Keesver said: You can print to PDF and then show this to the user. I can't tell you how to do this from the top of my head though. Yes, please tell me how to do this. Thank you! Edited November 23, 2023 by PeterPanettone Share this post Link to post
Keesver 23 Posted November 23, 2023 procedure TFMXPrintForm.btnMakePDFClick(Sender: TObject); var r: TRect; LCanvas: ISkCanvas; LDocument: ISkDocument; LDocumentStream: TStream; LSVGDOM: ISkSVGDOM; LSize: TSizeF; begin LSVGDOM := TSkSVGDOM.MakeFromFile('Delphi.svg'); LSize := TSizeF.Create(300, 300); r.Left := 0; r.Top := 0; r.Width := Round(treeControl.Width); r.Height := Round(treeControl.Height); LSVGDOM.SetContainerSize(LSize); LDocumentStream := TFileStream.Create('Delphi.pdf', fmCreate); try LDocument := TSkDocument.MakePDF(LDocumentStream); try LCanvas := LDocument.BeginPage(r.Width, r.Height); try LSVGDOM.Render(LCanvas); finally LDocument.EndPage; end; finally LDocument.Close; end; finally LDocumentStream.Free; end; end; Also see: Using Skia's PDF Backend | Skia Share this post Link to post
PeterPanettone 158 Posted November 24, 2023 @Keesver: Thank you for the code! But what does the treeControl do? Share this post Link to post