Jump to content
Ralf7

Skia4Delphi_VCL sample project raises an exception

Recommended Posts

Skia4Delphi_VCL.dproj->Documents->CreatePDF produces an exception. Does anyone else have this error?

Share this post


Link to post

@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

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
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

 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 by Ralf7

Share this post


Link to post
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 by vfbb

Share this post


Link to post

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×