Ralf7 4 Posted November 22, 2023 Skia4Delphi_VCL.dproj->Documents->CreatePDF produces an exception. Does anyone else have this error? Share this post Link to post
Sherlock 663 Posted November 22, 2023 @Ralf7 I am not sure how to reproduce it. I created a new VCL project in D12. Activated SKIA...and now what? OK, now that I understood what this was about. I deleted the unnecessary code. Share this post Link to post
Ralf7 4 Posted November 22, 2023 https://github.com/Embarcadero/RADStudio12Demos/tree/main/Object Pascal/VCL/Skia4Delphi Share this post Link to post
Sherlock 663 Posted November 22, 2023 Aha, ok. Nope, still no error here. Using the demo sources selected at install time, everything works fine. Have you tried placing a break point in the pnlCreatePDFDrawingSVGClick method, to see when your crash occurs? Perhaps you don't have a PDF reader installed (very wild guess)? Share this post Link to post
Dalija Prasnikar 1396 Posted November 22, 2023 1 hour ago, Ralf7 said: Skia4Delphi_VCL.dproj->Documents->CreatePDF produces an exception. Does anyone else have this error? It would help if you would provide more information about the exception. The demo works fine for me. Share this post Link to post
Ralf7 4 Posted November 22, 2023 (edited) LSVGDOM := TSkSVGDOM.MakeFromFile(AssetsPath + 'knight.svg'); knight.svg was missing. Arrrrg! It would be interesting to create a Canvas -> PDF output under Win32. The question arises as to whether the necessary VCL Canvas APIs are all supported. Edited November 22, 2023 by Ralf7 Share this post Link to post
vfbb 285 Posted November 22, 2023 (edited) 1 hour ago, Ralf7 said: It would be interesting to create a Canvas -> PDF output under Win32. The question arises as to whether the necessary VCL Canvas APIs are all supported. The current design of Vcl's TCanvas makes it unfeasible to create a wrapper that uses different libraries / different outputs. There is already a request to try to improve this and you can vote: [RSP-43149] Remodel TCanvas to allow injection of a different drawing backend - Embarcadero Technologies So currently, what can be done is to draw using the APIs directly from Skia, that is, using the document's SkCanvas, or you can draw in a TBitmap in the conventional Vcl way and in the end use: SkCanvas.DrawImage(Bitmap.ToSkImage, 0, 0); but I don't recommend this because you wouldn't have a vectorized PDF, and the texts couldn't even be selected/copied, as the PDF would be an image in fact. Edited November 22, 2023 by vfbb Share this post Link to post
Ralf7 4 Posted November 22, 2023 You can do that now. You just need to overwrite the base class TCustomCanvas with your own methods. I would like a powerful PDF writer that also supports all Win-GDI writing modes. Share this post Link to post