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

2

8

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/
Frisette answered 6/12, 2013 at 18:46 Comment(6)
What about a VM running a webservice to execute rotativapdf and send results back to the website?Ithyphallic
I thought about that: a WS that receives HTML and returns PDF (some byte array encoded to string), though I would have to HAVE that VM (ie: pay for it, maintain it, ...)Frisette
I would dispute your claim that ABCpdf needs to run an exe file to create PDFs. There may be some other reason (medium trust, perhaps?) why ABCpdf won't work in an Azure website, but it's not an exe problem. ABCpdf consists of three DLLs: one managed, two unmanaged. No exe at all.Woodrowwoodruff
I edited the main post. I think its the same reason as EO.PDF ("uses Windows GDI", which Azure Websites don't support)Frisette
Note regarding iTextPdf, unless you're planning to open source your code and adopt the AGPL license you're looking at US$2200 per node/VM/server instance to use this itextpdf.com/pricing/server_license and only includes 12mths updates.Bobsleigh
I'm the creator of Rotativa. I developed a service with the same Rotativa usage but you can use without having to worry about installing executables and having special permissions. It's online at rotativahq.comVortical
A
1

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/.

Airspeed answered 8/12, 2013 at 12:3 Comment(2)
The problem of iTextSharp is that if I want to give the user an "online" version of the pdf (ie: pure HTML), I wont be able to. Rotative and ABCPdf take the html of a view and convert that to PDF, so they are great for giving the user the choice of downloading as PDF or as HTMLFrisette
People seem to get it to work - I guess it depends on the complexity of your markup. am22tech.com/s/22/Blogs/post/2011/09/28/…Airspeed
S
0

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.

Sartre answered 19/12, 2013 at 9:29 Comment(1)
I am indeed using today a webservice. We have an Azure Website and an Azure Cloudservice, the second just converts string to html. Regarding your statement: "great platform for applications that do not consume much processing time", you are forgetting the scale-out capability of WAWS. I think WAWS are a very comfort solution for deploying and managing number of instances.Frisette

© 2022 - 2024 — McMap. All rights reserved.