DIGIT-ARC read-only archive · snapshot: July 23, 2026

Create 'download as PDF' option in web pages

11 posts · originally from https://geek.digit.in/community/threads/create-download-as-pdf-option-in-web-pages.148425/

gdebojyoti
gdebojyoti Original post #1
Nov 6, 2011 at 3:17 PM
I have often come across web pages which contain 'download-as-PDF' buttons (used to convert and download the data contained in that page in PDF format). How can I implement the same for my personal site?

P.S.: I don't want to use any web service for this. I prefer to do it from scratch.
coolpcguy
Nov 7, 2011 at 11:50 AM
I hope you're atleast willing to use some libraries - writing such a converter from scratch is painful

Writing my own HTML to PDF conversion library in PHP
thetechfreak
Nov 9, 2011 at 12:42 PM
Rather than messing around too much I would say download as HTML and convert to PDF using this
Download PrimoPDF 5.1.0.2 - FileHippo.com
d6bmg
d6bmg #4
Nov 9, 2011 at 9:36 PM
Use foxit reader and there will be an option to save any webpage as .pdf file (via print option)
coolpcguy
Nov 10, 2011 at 10:37 AM
Rather than messing around too much I would say download as HTML and convert to PDF using this
Download PrimoPDF 5.1.0.2 - FileHippo.com

Use foxit reader and there will be an option to save any webpage as .pdf file (via print option)

Umm -

I have often come across web pages which contain 'download-as-PDF' buttons (used to convert and download the data contained in that page in PDF format). How can I implement the same for my personal site?
Garbage
Garbage #6
Nov 10, 2011 at 12:27 PM
See, we need some more information about your site.

1) Is it a CMS site? (Built using softwares like Wordpress, Drupal, Joomla, etc.). If yes, then you might be able to find an add-on / extension for this.

2) If it's a programmed web app, what is the language used? (PHP, Ruby, Python, Java, .Net, etc.)
Vyom
Vyom #7
Nov 10, 2011 at 7:39 PM
Rather than messing around too much I would say download as HTML and convert to PDF using this
Download PrimoPDF 5.1.0.2 - FileHippo.com

Use foxit reader and there will be an option to save any webpage as .pdf file (via print option)

Quoted before you remove.
:-D
gdebojyoti
Nov 26, 2011 at 3:24 PM
See, we need some more information about your site.

1) Is it a CMS site? (Built using softwares like Wordpress, Drupal, Joomla, etc.). If yes, then you might be able to find an add-on / extension for this.

2) If it's a programmed web app, what is the language used? (PHP, Ruby, Python, Java, .Net, etc.)

No, I am not using any CMS. I am developing my website from scratch using PHP.

P.S. Sorry for such a late reply. My internet connection was down for a couple of weeks.
Garbage
Garbage #9
Nov 27, 2011 at 9:14 PM
This might help then:

dompdf - HTML to PDF converter (PHP5) - Google Project Hosting
dompdf is an HTML to PDF converter. At its heart, dompdf is (mostly) CSS 2.1 compliant HTML layout and rendering engine written in PHP. It is a style-driven renderer: it will download and read external stylesheets, inline style tags, and the style attributes of individual HTML elements. It also supports most presentational HTML attributes.

OR

HTML 2 PDF - a PHP script | Free software downloads at SourceForge.net
Get a HTML text and generate a PDF file to make it printer-friendly. This PHP script is based upon FPDF PHP script (FPDF). More info can be found on the home page (HTML 2 (F)PDF Project).

Additionally, have a look at here as well - *stackoverflow.com/questions/391005/convert-html-css-to-pdf-with-php
Cool Buddy
Nov 29, 2011 at 11:22 AM
You will need to have a look at the FPDF library. This is a good place to look: Tutorials

However, I'd also suggest using Printfriendly. If you do it on your own, you will need to figure out how you would remove unnecessary content like ads from the PDF.
gdebojyoti
Nov 29, 2011 at 3:08 PM
Okay guys. Thanks a lot for your suggestions. I'll try them out ASAP.

:)