<p>When you print from Google Docs (using the "print" link, not File/Print) you end up printing a nicely formated PDF file instead of relying on the print engine of the browser.  Same is true for some of the reports in Google Analytics . . . the printed reports as PDF's are beautiful.  How do they do that?  I can't imagine they use something like Adobe Acrobat to facilitate it but maybe they do.  I've seen some expensive HTML to PDF converters online from time to time but have never tired it.  Any thoughts?</p>

[{'answer_id': 47712, 'author': 'FlySwat', 'author_id': 1965, 'author_profile': 'https://Stackoverflow.com/users/1965', 'pm_score': 2, 'selected': False, 'text': '<p>iTextSharp and iText are opensource and free PDF generation libraries for .NET and Java respectively.</p>\n\n<p>I\'ve used them to generate report PDF\'s before and was quite happy with the results.</p>\n\n<p><a href="http://itextsharp.sourceforge.net/" rel="nofollow noreferrer">http://itextsharp.sourceforge.net/</a></p>\n\n<p><a href="http://www.lowagie.com/iText/" rel="nofollow noreferrer">http://www.lowagie.com/iText/</a></p>\n'}, {'answer_id': 47737, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': -1, 'selected': False, 'text': "<p>Rendering a PDF is hard, complex problem. However generating them, is not. Simply make up some entities, and generate. It's about same problem domain as generating HTML for webpage vs. displaying (rendering) it.</p>\n"}, {'answer_id': 47986, 'author': 'tooshel', 'author_id': 4835, 'author_profile': 'https://Stackoverflow.com/users/4835', 'pm_score': -1, 'selected': False, 'text': "<p>Well, I doubt it's as easy as generating HTML . . . I mean, first of all, PDF is not a human readable format and it's not  plain text (like SVG).  In fact, I would compare a SVG file to a PDF file in that with both you have precise control over the layout on a printed page.  But SVG is different in that it's XML (and also in that it's not supported completely in the browser . . . still looking into SVG too).  Come to think of it, SVG should probably will be my next question. </p>\n\n<p>I know Google doesn't use .NET and I doubt they use Java so there must be some other libraries they use for generating the PDF files.  More importantly, how do they create the PDF's without having to rewrite everything as a PDF instead of as HTML?  I mean, there has to be some shared code for between when they generate the HTML view as opposed to the PDF view.  Come to think of it, maybe the PDF view and the HTML view are completely separate and they just have two views and hence why the MVC development style seems to be the way to go.</p>\n"}, {'answer_id': 48029, 'author': 'Mark Nold', 'author_id': 4134, 'author_profile': 'https://Stackoverflow.com/users/4134', 'pm_score': 5, 'selected': True, 'text': '<p>If you are specifically looking at how Google does it. If you look at the <a href="http://docs.google.com/Doc?id=dd8xj6nh_2q9zprkd6" rel="noreferrer" title="I&#39;ve embedded the image in a document here">PDF Properties</a> page, they use Prince 6.0 (see <a href="http://www.princexml.com/" rel="noreferrer">princexml.com</a>)</p>\n\n<p>There are lots of other PDF generators out there. I\'ve had great success with <a href="http://www.pdflib.com/" rel="noreferrer">PDFlib</a> for tricky jobs.</p>\n\n<p><img src="https://i.stack.imgur.com/NGksE.jpg" alt="alt text"></p>\n'}, {'answer_id': 88919, 'author': 'Brian', 'author_id': 700, 'author_profile': 'https://Stackoverflow.com/users/700', 'pm_score': 1, 'selected': False, 'text': '<p>I have had success with <a href="http://pd4ml.com/" rel="nofollow noreferrer">pd4ml</a>.  It has a tag library, so you can turn any existing HTML into PDF by</p>\n\n<pre><code>&lt;pd4ml:transform&gt;\n&lt;!-- Your HTML is here --&gt;\n\n&lt;c:import url="/page.html" /&gt;\n&lt;/pd4ml:transform&gt;\n</code></pre>\n'}, {'answer_id': 5172302, 'author': 'konung', 'author_id': 198424, 'author_profile': 'https://Stackoverflow.com/users/198424', 'pm_score': 2, 'selected': False, 'text': '<p>Great free alternative to PrinceXML: <a href="http://code.google.com/p/wkhtmltopdf/" rel="nofollow">wkhtmltopdf</a>  . There are plenty of wrapper libraries for various languages - but I\'ve only used Ruby ones. However the  product itseld is on par with PrinceXML IMHO.</p>\n'}]
['https://Stackoverflow.com/questions/47709', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4835/']