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 am migrating from v7 to v8 and had used Moriyama PDF Creator to generate PDF documents from CMS data. Unfortunately this package is no longer available and does not work on Umbraco v8. What are other people using on Umbraco v8 to generate PDF documents from CMS data? (PS: I am deployed on Microsoft ISS for my web server.)
I built a site a few years back (V7) and used iTextSharp for generating PDF's.
Admittedly all the generation code had to be written from scratch to suit the requirements, but in essence, the same code would quite easily port over to V8 as it used IPublishedContent objects.
To download the file I used a file handler that took a couple of query string parameters.
Not sure it would be of any use, but more than happy to share the code I have if you need something to kick start the coding (assuming you are a coder).
if you are on your own webserver you can just use chrome.exe to gen a pdf of the html page... using the print css...
public class ChromeController : ApiController
public HttpResponseMessage Get(string url)
var outputDirectory = WebConfigurationManager.AppSettings["PdfTempStorage"];
bool chromeLogging = Convert.ToBoolean(WebConfigurationManager.AppSettings["EnableChromeLogging"]);
var pdfResult = ChromePdfRenderer.RenderPdf(url, outputDirectory, enableLogging: chromeLogging);
HttpResponseMessage result = new HttpResponseMessage();
if (pdfResult.Result == RenderResult.Success)
result.StatusCode = HttpStatusCode.OK;
result.Content = new ByteArrayContent(File.ReadAllBytes(pdfResult.File));
result.Content.Headers.ContentType = new MediaTypeHeaderValue("application/pdf");
result.StatusCode = HttpStatusCode.InternalServerError;
result.Content = new StringContent("Error");
and the chromerender class is
public static class ChromePdfRenderer
public static PdfRenderResult RenderPdf(string url, string outputDirectory, int renderTimeout = 20000, bool enableLogging = false)
var basePath = @"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe";
var outputFile = Path.Combine(outputDirectory, Guid.NewGuid() + ".pdf");
arguments = "--headless --enable-logging --v=1 --disable-gpu --no-margins --print-to-pdf=" + outputFile + " " + url;
arguments = "--headless --disable-gpu --no-margins --print-to-pdf=" + outputFile + " " + url;
var startInfo = new ProcessStartInfo();
startInfo.FileName = basePath;
startInfo.Arguments = arguments;
startInfo.CreateNoWindow = true;
startInfo.RedirectStandardOutput = false;
startInfo.UseShellExecute = false;
var result = new PdfRenderResult();
var watch = Stopwatch.StartNew();
var process = Process.Start(startInfo);
//result.Log = process.StandardOutput.ReadToEnd();
result.Result = RenderResult.Error;
result.ExitCode = process.ExitCode;
if (result.ExitCode == 0)
result.Result = RenderResult.Success;
result.File = outputFile;
result.Result = RenderResult.Error;
result.Runtime = watch.ElapsedMilliseconds;
basepath needs to be correct of course.. but if you have access to the server you can check that var basePath = @"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe";
so then you just have an api you can use that get's a url and outputs a pdf (using print style of the page)
no dependency on any cms (version)... so doesn't break when ugrading
Thanks Tim, I will look into this. I am on my own server (albeit a VM) so I do have access to file system and executables. Thanks again.
sure should be doable on a VM... we do the same...
Haven't had time to test on a server, but does this need to have any user settings (it, Chrome that is, is supposed to run in a user context)?
nope.. it is run --headless , just piping the params to the .exe and getting the result
Hi Dan, I've set this up using iTextSharp on multiple v7 sites and the code should work fine on v8 with a few syntax tweaks. Happy to share the code with you if you need.
Thanks jonok, I like what I am seeing, and would love it if you could share your code. my email is [email protected]
I've just implemented pdf-generation with SelectPdf.HtmlToPdf (it's for free now) and its about 4 lines of code.
var converter = new SelectPdf.HtmlToPdf();
var doc = converter.ConvertUrl(uri.ToString());
var bytes = doc.Save();
I tried several of the solutions that the community suggested including Chrome2HTML, iTextSharp and wkhtmltopdf. I got all three of these to work, but found the results of converting an HTML page to a PDF lacked much of the fine grained control that I was accustom to using XML-FO and PDF Creator. After doing some research I found that PDF Creator was based on the ibex40 engine. I then disassembled the Moriyama PDF Creator package and manually installed the components and templates per the packing list into the Umbraco 8 structure. This seemed to work, leading me to think that the only problem with Moriyama PDF Creator in Umbraco 8 is the packaging and deployment list.
I want to Thank the community for all the great help
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted