问题
I have referred official document of skia: https://docs.microsoft.com/en-us/dotnet/api/skiasharp.skcanvas?view=skiasharp-1.68.1#constructing-a-pdf-document
// create the document
var stream = SKFileWStream.OpenStream("document.pdf");
var document = SKDocument.CreatePdf(stream);
// get the canvas from the page
var canvas = document.BeginPage(256, 256);
// draw on the canvas ...
// end the page and document
document.EndPage();
document.Close();
As per the above code I'm getting canvas, but how can I draw that on my canvas view?
<skia:SKCanvasView x:Name="canvasViews"/>
Also do I need to use scroll view to display those multiple pages on canvas?
Any help on this appreciated. Thanks.
回答1:
I think you got the reverse issue as to what SkiaSharp supports. SkiaSharp CREATES PDF files, not renders them.
I do not know of any PDF renderers offhand that I can recommend, but I would start by searching SO or doing a bit of Googling. I see this post: How to render pdfs using C#
来源:https://stackoverflow.com/questions/59171851/how-to-draw-pdf-on-canvas-using-skia-sharp