HomeiOS Developmentc# - How can I deal with Doc.BeginPage() Error in SkiaSharp.SKDocument,.Internet maui

c# – How can I deal with Doc.BeginPage() Error in SkiaSharp.SKDocument,.Internet maui


The code complies after which on debugging, on the road of

doc.BeginPage() 

Debugging stops with no error proven.

Constructing cellular app, Am attempting to create a pdf with a desk of stock rely for explicit date then share the pdf ,utilizing skiasharp in .internet maui.
Right here is the code;

        public async Job<SKDocument> GenerateInventoryItemCountPdfAsync(DateTime date, Checklist<Merchandise> gadgets, string pdfLogoPath, string pdfTitle) 
         { 
             var stream = new MemoryStream(); 
             utilizing var doc = SKDocument.CreatePdf(stream); 
  
             var pageSize = new SKSize(595, 842); 
             utilizing var canvas = doc.BeginPage((int)pageSize.Width, (int)pageSize.Peak); 
  
             utilizing (var logoBitmap = SKBitmap.Decode(pdfLogoPath)) 
             { 
  
                 var logoRect = SKRect.Create(pageSize.Width / 2 - logoBitmap.Width / 2, 50, logoBitmap.Width, logoBitmap.Peak); 
                 canvas.DrawBitmap(logoBitmap, logoRect); 
  
                 var titlePaint = new SKPaint 
                 { 
                     Typeface = SKTypeface.FromFamilyName("Arial", SKFontStyleWeight.Daring, SKFontStyleWidth.Regular, SKFontStyleSlant.Upright), 
                     TextSize = 24, 
                     IsAntialias = true, 
                     Shade = SKColors.Black

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments