Jolubaro 0 Posted July 17, 2022 Hi!! I'm trying to print an image from my cell with this code, but it is imposible. 'Access Violation'. procedure TFPrincipal.BImprimirClick(Sender: TObject); var SrcRect, DestRect: TRectF; begin with Printer do begin ActivePrinter.SelectDPI(1200,1200); Canvas.Fill.Color:= TAlphaColorRec.Black; Canvas.Fill.Kind := TBrushKind.Solid; BeginDoc; SrcRect := Image.LocalRect; DestRect := TRectF.Create(0, 0, PageWidth, PageHeight); Canvas.DrawBitmap(Image.Bitmap, SrcRect, DestRect, 1); EndDoc end end; Share this post Link to post
Dave Nottage 557 Posted July 17, 2022 In FMX, Printer is available on Windows and macOS only, as per the documentation: https://docwiki.embarcadero.com/RADStudio/Alexandria/en/Printing_from_a_FireMonkey_Application Share this post Link to post
Jolubaro 0 Posted July 17, 2022 Thank you. So, with FMX there is not solution for my problem. What about other platforms of programming Share this post Link to post
Dave Nottage 557 Posted July 17, 2022 1 hour ago, Jolubaro said: So, with FMX there is not solution for my problem There can be solutions; just that there isn't any included with Delphi. This is a potential starting point: https://developer.android.com/training/printing, though you will need knowledge of Java, and how to convert the code to Delphi. 1 hour ago, Jolubaro said: What about other platforms of programming If you mean development tools other than Delphi, there could be solutions using those, however it may still require writing the same code as per the link mentioned above, i.e. it would be unlikely to be included with the development tool itself. Share this post Link to post
vfbb 285 Posted July 18, 2022 I've never tried to print anything on Android, but on iOS, when sharing a PDF, the "Print" option appears in the system menu. If this happens on Android, it would be a very simple solution to implement. To make the PDF just use Skia4delphi, and to share the PDF, it's very simple, I even have a code ready (if you confirm that this solution works, I'll send it to you). 1 Share this post Link to post
Jolubaro 0 Posted July 18, 2022 Thanks to both of you. I will take your suggestions into account. I have to think about what I'm going to do finally. Share this post Link to post