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); }
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); }