So after beginning my azure websites-adventure, I have been encountering disappointment after disappointment to the point of 'almost' regretting taking the azure route..the latest: my app uses wkhtmltopdf(Rotativa) for all its PDF generation. And as I discovered now during my staging testing...that doesnt work. According to most info on the web, azure websites cannot run .exe's. However, most info I've seen is by now 2 years old and I know Azure development is going fast.
Is there by now a way to run wkhtmltopdf on azure websites, or a workaround atleast? I cannot really find a free alternative like wkhtmltopdf to seems to be working.(Itextsharp doesnt seem to like my html, so thats no option).
Running wkhtmltopdf
is now supported in Azure Web Apps - just make sure you are using Basic, Standard, or Premium App Service Plan. Consumption Service Plan and Free App Service Plan have a more limited sandbox and are NOT supported in my testing. MS confirms supportability of wkhtmltopdf
in Azure Web Apps.
There are numerous wrappers available (TuesPechkin, Codaxy, etc.). Codaxy
is an EXE wrapper in .NET while TuesPechkin
is a .NET wrapper around C++ runtime using P/Invoke over wkhtmltox.dll
.
Running wkhtmltopdf in Azure Websites in a simple way seems to be impossible, still. Static .NET wrappers like Pechkin wont work either in WebSites, there are very few alternatives that are 1. free and 2. dont use wkhtmltopdf or similar under the hood. Most alternatives like iTestSharp are not very advanced when it comes to html/css3/javascript reading (as I do some design changing with .js on page load).
I ended up creating a Azure Cloud Service, that runs wkhtmltopdf.exe without any issues. I send the html to the service, and get a byte[] in return. So far this seems to be working fine. Hope this helps others with similar problems.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With