public async Task <IActionResult> ToPdf(string url = "/Home/Index") { url = string.Format("{0}://{1}{2}", HttpContext.Request.Scheme, HttpContext.Request.Host, url); var pdf = new UrlToPdf(url); await pdf.SaveFileAsync(Path.Combine("wwwroot/files/pdf", DateTime.Now.ToString("yyyyMMddhhmmss") + ".pdf")); return(Content("ok")); }
public void Path_IsCorrect() { var urlToPdf = new UrlToPdf(); Assert.AreEqual("url/pdf", urlToPdf.Path); }
/// <summary> /// This endpoint lets you to convert any publicly accessible URL into a PDF. /// </summary> /// <param name="urlToPdfParams">Url to PDF parameters.</param> /// <returns>Returns a ReturnResponse type</returns> public Task <ReturnResponse> UrlToPdf(UrlToPdf urlToPdfParams) { return(SendRequest(urlToPdfParams)); }