Beispiel #1
0
        public async Task <ToFileResult> ToPdfAsync(Xamarin.Forms.WebView webView, string fileName, PageSize pageSize, PageMargin margin)
        {
            if (!await XamarinEssentialsExtensions.ConfirmOrRequest <Xamarin.Essentials.Permissions.StorageWrite>())
            {
                return(new ToFileResult(true, "Write External Stoarge permission must be granted for PNG images to be available."));
            }
            var taskCompletionSource = new TaskCompletionSource <ToFileResult>();

            ToPdf(taskCompletionSource, webView, fileName, pageSize, margin);
            return(await taskCompletionSource.Task);
        }
Beispiel #2
0
        public async Task <ToFileResult> ToPngAsync(string html, string fileName, int width)
        {
            if (!await XamarinEssentialsExtensions.ConfirmOrRequest <Xamarin.Essentials.Permissions.StorageWrite>())
            {
                return(new ToFileResult(true, "Write External Stoarge permission must be granted for PNG images to be available."));
            }
            var taskCompletionSource = new TaskCompletionSource <ToFileResult>();

            ToPng(taskCompletionSource, html, fileName, width);
            return(await taskCompletionSource.Task);
        }