Exemplo n.º 1
0
        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"));
        }
Exemplo n.º 2
0
        public void Path_IsCorrect()
        {
            var urlToPdf = new UrlToPdf();

            Assert.AreEqual("url/pdf", urlToPdf.Path);
        }
Exemplo n.º 3
0
 /// <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));
 }