Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I'm looking for the best and most flexible way to generate PDF from a website.
From the website, i want to make it possible to generate a PDF from selections on a webpage and then print/send it to an email recipient.
Are there any recommendations?
Best Regards Marianne
We use wkhtmltopdf its fine for document generator. Code int our PDF template.
@using Umbraco.Web @{ Layout = null; string PDF_CONVERTER = Server.MapPath("/App_data/wkhtmltopdf/wkhtmltopdf.exe"); var filename = Model.Content.UrlName + ".pdf"; var path = Server.MapPath("/App_Data/wkhtmltopdf/pdfs/" + filename); var url = Request.Url.Scheme + "://" + Request.Url.Host + Model.Content.Url; // Create directory if needed var di = new DirectoryInfo(Path.GetDirectoryName(path)); if (!di.Exists){ di.Create(); } // Connect to process var process = new System.Diagnostics.Process(); process.StartInfo.FileName = PDF_CONVERTER; process.StartInfo.Arguments = string.Format("-T 7 -R 0 -B 40 -L 0 --page-width 1024px --dpi 600 --footer-html {2} --header-html {3} --page-width 992 --zoom 0.7 --no-stop-slow-scripts --disable-smart-shrinking cover {4} {0} {1}", url, path, Model.Content.Children.LastOrDefault(c=>c.DocumentTypeAlias == "DocumentHeaderFooter").UrlWithDomain(), Model.Content.Children.FirstOrDefault(c => c.DocumentTypeAlias == "DocumentHeaderFooter").UrlWithDomain(), Model.Content.Children.FirstOrDefault(c => c.DocumentTypeAlias == "DocumentCover").UrlWithDomain()); process.Start(); process.WaitForExit(); Response.Clear(); Response.AddHeader("content-disposition", "attachment; filename=" + filename); Response.ContentType = "application/pdf"; Response.WriteFile(path); Response.Flush(); Response.End(); }
Thanks :)
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Best and most flexible PDF generator?
I'm looking for the best and most flexible way to generate PDF from a website.
From the website, i want to make it possible to generate a PDF from selections on a webpage and then print/send it to an email recipient.
Are there any recommendations?
Best Regards Marianne
We use wkhtmltopdf its fine for document generator. Code int our PDF template.
Thanks :)
is working on a reply...