There are many .NET component options on the market (even some for free) that will generate PDFs.  Many of them lack the ability to take in a URL and translate it to a PDF.  Programmatically designing a PDF though code just stinks.  Trying to get all of your graphics in place, text and paragraphs to line up, and then trying to integrate your dynamic content, it takes a lot of time.  Then, just when you think you have got it all just right, the client or boss wants to make a change. 

Converting HTML to PDF

pdf-component-toolMy preferred method to generate PDF’s is from a URL or webpage.  There are plenty of tools for creating pretty webpages, and there are plenty of designers that would enjoy creating the page for you.  Why not take advantage of all of these graphical tools for handing design, and then leveraging existing .NET components to process your data to for merging content?  I have used several free or cheap PDF components, such as aspPDF, which do a decent job at converting HTML to PDFs or allowing you to merge your data and graphics into an existing PDF.  I have also used a variety of mid-range to high end PDF generating utilities such as ASPOSE.PDF, ExpertPDF, activePDF Server, and activePDF webGrabber.

ExpertPDF

ExpertPDF did the best job at rendering URLs as PDFs quickly while keeping the design of the page intact, and for my purposes was the best fit for PDF generation.  ASPOSE has an excellent budget suite of tools that I use often, and will continue to use for PDF modifications, but had some issues with handling the design layouts of some of the HTML to PDF reports that needed to be generated.  I had started with their HTML to PDF .NET control, and was really trying to get it to work, but couldn’t get the end result to look the way I needed it.   Don’t get me wrong, it does “work”, as it does create a PDF from a URL, but the resulting file seems to be a little heavier, and not as true to the design.  ASPOSE.Cells and ASPOSE.words, 2 other utilities that they put out are fantastic, and I have not yet found anything better for the tasks that those components handle.

ActivePDF

pdf-component-toolkitActivePDF was a beast of tool set.  It is an enterprise suite of tools to handle massive bulk generation of PDFs on a PDF server, with queuing and priorities.  However it does not seem to be as fast as other non enterprise rendering engines, but I guess it doesn’t really need to be, if it can queue jobs and allow you to escalate priorities.  This is the same tool that a lot of large mortgage lenders and banks will use for bulk PDF generation of loan docs.  Their WebGrabber tool, which is an add-on to the ActivePDF server, is the component that turns a URL into a PDF, but the design is often butchered, and you need to be very careful with your HTML design.

ExpertPDF Review

ExpertPDF was something that I had stumbled upon, after using all of the other HTML to PDF components mentioned above.  I was having issues with the design of some of the reports as they were rendered, and finally decided it might be better to find a new rendering engine.  The features and options that it presents are amazing.  It was very quick to integrate and eventually swap out in place of the other tools.

Designing HTML for PDF

htmlDesigning HTML for print or as a PDF can sometimes be challenging.  Often people will elect to create a second version of the page, just for print, or have a completely different style sheet.  Common design changes are to narrow the page, and to remove the header and footer graphics, or even to replace the header and footer graphics.  ExpertPDF has tags that it will look for, that making excluding headers and footers a snap, without having to design a whole new page, just for print.  The .NET component also has methods for handling security of the page, and security of the PDF.  Most of the other features are pretty common amongst all HTML-to-PDF components, so I can’t warrant listing them here, but believe me… ExpertPDF is the best HTML to PDF generation tool I’ve come acrossed and used.