RotativaHQ brings generating PDF files with the ease and control of Rotativa to the Microsoft Azure cloud infrastructure. Let’s see how it works.
Using RotativaHQ is really simple, but to achieve this simplicity a smart and complex architecture has been built using the best resources available in Microsoft Azure.
14 October 2016 Update: This document is based on the .Net client implementation. The PHP client will work similarly, except that the HTML generation is left to the PHP developer to implement, see here for details. Instead, this will apply only partially if you are using the API directly with your own code. In this case only the RotativaHQ side will be relevant.
TLTR. For those not willing to go through all the steps below we could simply explain the process with:
RotativaHQ takes your view and model, turns it into a PDF and transparently sends your user to Azure storage to securely and privately download it.
The following image represents all steps taken by the RotativaHQ solution to generate PDF files.
Step 1. Your web site user makes a request that hits an action on your web app returning ViewAsPdf.
Step 2. The ViewAsPdf call in your code packages the HTML page resulting from evaluating your view, optionally (and usually) with your model and grabs local assets too. It sends everything as a compressed binary package to RotativaHQ. Packaging everything in a single file enables the process to limit connections between RotativaHQ and the calling server to just one, regardless of the number of assets (images, css files, js files). Plus it enables using the service even if the calling server is not exposed to public internet, this means it works also from a intranet or from a developer PC.
Step 3. RotativaHQ unwraps the package and turns it into a PDF file. It stores it in Azure storage as a temporary file.
Step 4. RotativaHQ communicates the temporary PDF file URL to the ViewAsPdf call in the calling server.
Step 5. ViewAsPdf redirects the user to Azure storage.
Step 6. User downloads the PDF file from Azure storage over HTTPS with the filename configured in the ViewAsPdf call. URL works for 2 minutes.
Step 7. RotativaHQ systems persist logging data and counters and delete the temporary PDF file.
This is, in summary, what happens when the simple call to ViewAsPdf is made.
If you have any questions / doubts / concerns please feel free to write us at email@example.com.