![]() Deployment details are provided at the end of the article you’ll need to make some changes to get the code to work with your particular Web App and WebJob. ![]() Once you’ve created the app, you use this location to deploy the source code contained in the downloadable Visual Studio 2015 solution, convertHTMLtoPDF. To start, create the Web App within the Azure portal by selecting New | Web + Mobile | Web App, then provide the App name, Subscription, Resource Groups and App Service Plan and press the Create button. And for the front end, the features for a given App Service provide specially designed capabilities for a particular App Service type to get your application deployed, configured and running in the shortest amount of time.įor the HTML-to-PDF converter, I’ll use an S2 Azure App Service Web App because I don’t need any of the features provided by the other App Service types. The plans provide features such as deployment slots, disk-space limits, auto-scaling, maximum number of instances and so forth, and the instance sizes describe the number of dedicated CPUs, as well as the memory per App Service Plan (ASP), which is equivalent to a virtual machine (VM). By back end I mean that App Services run in different service plans (Free, Shared, Basic, Standard and Premium) and instance sizes (F1-P4) see bit.ly/1CVtRec for more details. All App Services function in the same way in the back end, with each having additional configurable capabilities on the front end. Azure App Service Web AppĪzure App Services lets you work with a variety of app types: Web, Mobile, Logic (preview) and API. The technical goal is to pass a URL to the App Service Web App and get back a PDF. I’ve ordered the different portions of the solution as I created them, but it could be done using a number of different sequences. Manages response from server back to clientĮach section includes a functional and technical description of a technology, plus the details of coding and/or configuration requirements. The table in Figure 3 presents a brief description of these technologies, and I describe them in more detail in the sections that follow.įigure 3 Technologies Used in the Solution TechnologyĪpp Service Authentication and AuthorizationĬonverts HTML to PDF, uploads PDF to Azure Storage I’ve used numerous technologies to create the real-time HTML-to-PDF App Service Web App solution. The next few sections of this article discuss the technologies used to create the solution, and explain how you can build and utilize them. It takes very little effort to dynamically set this URL to the current page and have the button send the page to the WebJob API for conversion and download. The example code contains an ASP.NET Web site with an index page that allows a user to enter a URL, send that Web page to get converted to a PDF and then download the PDF to a client device. The other components of the solution had already been worked out I finally had the last piece of the puzzle, as Figure 2 shows. I could call the wkhtmltopdf program from my App Service Web App using the WebJob API. WebJobs are made for exactly this situation because they can run executables either continuously or when triggered from an external source for example, manually from the Azure SDK or by using an Azure Scheduler, CRON or the Azure WebJob API ( bit.ly/1SD9gVJ). Having worked on the IIS support team for many years, I knew that making this happen even on a standalone version of IIS would require configurations that would make security analysts lose sleep. The question that remained unanswered was: “How can I get Microsoft Azure App Service Web Apps to spawn this process to create the PDF?” App Service Web Apps runs within a sandbox and I knew from the start that I couldn’t do that-there was zero possibility of having a request sent from a client machine starting and running a process on the server. ![]() ![]() I worked on different portions of this solution over the past months, but the execution of the wkhtmltopdf process stubbornly prevented me from achieving my goal. However, running a program from a command line is a long way from real-time conversion with a button on a Web page. The best, or at least my favorite, Web page-to-PDF converter is the open source program called wkhtmltopdf ( ), which uses the command line, as shown in Figure 1.įigure 1 Running the wkhtmltopdf Converter from the Console There are numerous Web sites and open source binaries that let you do this, but I wasn’t ever able to connect all the dots and get the output I wanted in the way that I wanted it. Volume 31 Number 6 Using Azure App Services to Convert a Web Page to PDFĬonverting aWeb page to a PDF is nothing new, but my goal-to place a link on my Web site that gave visitors a simple way to convert a specific page to a PDF document in real time-turned out to be somewhat complicated. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |