Rotativa, ABCPdf and EO.Pdf don't work in Azure WEBSITES and I don't want to upgrade to Azure "Cloudapp"

3.4k views Asked by At

Given the circunstances (take them as a fact):

1) Rotativa PDF (https://github.com/webgio/Rotativa) uses an exe for creating PDFs, so it doesn't work on azure websites (no permission to execute that exe)

2) ABCPdf has the same problem

3) EO.Pdf has a similar problem ("uses Windows GDI but Windows GDI is not supported by Windows Azure WebSite", http://www.essentialobjects.com/doc/4/install/deploy.aspx)

4) I don't want to have an Azure Cloudapp (which would allow to me to use Rotativa or ABCPdf). I'm fine with my Azure Website (except for the previous problems).

Is there an alternative solution?
Is there any other library for creating PDFs from HTML that can run on an Azure Website (not CloudService nor VM)?




Update nov-2014:
I'm today using MvcRazorToPdf, it is great.

Controller's code:

return new PdfActionResult(palletReception, (writer, document) =>
{
    document.SetPageSize(new Rectangle(792f, 612f));
    document.NewPage();
})
{
    FileDownloadName = "foo.pdf"
};

View code:

A normal view with normal css.
Must be accepted by iText XMLWorker

Check this: http://demo.itextsupport.com/xmlworker/itextdoc/flatsite.html
and this: http://demo.itextsupport.com/xmlworker/
2

There are 2 answers

2
Simon W On

You could leverage iTextSharp (http://sourceforge.net/projects/itextsharp/). Have used it very successfully in the past. It's even available as a nuget package these days - https://www.nuget.org/packages/itextsharp/.

1
Jason On

Is the task a good fit for WAWS?

Windows Azure Web Sites is great platform for applications that do not consume much processing time. But WAWS may not be the best option for processor intensive work like converting web page to PDF. Downloading and rendering web pages can take a few seconds, generating a PDF document consumes a few more. And if you're unfortunate enough to hit a timeout or two (like this would ever happen), any processing quota on your WAWS account could be vaporized in a flash. What happens to the site when a cap is exceeded?

As far as I understand, the free and shared WAWS tiers are subject to processing caps. I'm unsure whether this affects the standard tier also. Anyone?

If web page to PDF conversion is a must for your WAWS site, I would like to suggest using it in conjunction with a Worker Role, or just use a Web Role instead (cloud services). An additional advantage is that you can connect multiple WAWS sites to a single worker role, possibly helping to reduce licensing costs and saving time on deploying and maintaining sites.