Salesforce has a built-in PDF generation engine that can take your HTML markup and turn it into a PDF. This is a very useful feature for generating more formal documents such as invoices or purchase orders.
You can access it using the renderAs attribute of the apex:page element on a Visualforce page, setting it to pdf. Note that you would typically dedicate a specific Visualforce page for this purpose rather than attempt to use this attribute on one that's used for other purposes.
Make sure that you use as much vanilla HTML and CSS as possible; the Visualforce standard components do not always render well in this mode. For this reason, it is also useful to use the standardStylesheets attribute to disable Salesforce CSS as well.
You can also programmatically access this capability by using the PageReference.getContentAsPDF method and attach the...