How to create an pdf for a dynamic html page?

Hi all,
I want to generate a pdf file dynamically, based on the html page…

Html page is generated from the user submitting the details, based on the details, dynamically i generated one html file contains 3 images, now i want this final html page as pdf format…

I tried some tools by giving the URL of that page, but it is generating only the text part, but not the images… and also i have submit buttons in that html page, i don’t want that in the generated pdf…

Can you give me any regarding this problem, in a better and simple way…

Thanking you…

I’ve used DOM-PDF for this before: dompdf - HTML to PDF converter (PHP5) - Google Project Hosting

Give it a shot. It’s pretty good stuff!

This is good too:
wkhtmltopdf - Convert html to pdf using webkit (qtwebkit) - Google Project Hosting

You’ll find there are many PDF libraries out there that claim to handle HTML to PDF document conversion, but the vast majority of these only partially support CSS and HTML.

What you’ll generally end up with is a PDF document with all the unsupported elements missing. If the HTML is within your control, you may be able to work around some of these issues.

If you need to reproduce high quality PDF documents from arbitrary web pages, the good news is it is possible, but your choice may be limited to commercially developed libraries and may also depend on your server platform.

I can’t recommend one product or another (forum rules! :x), but what I’d like to suggest is this:

Find an online service that can handle the type of pages you want to convert, on the platform that you will be using. Download their output and examine the contents of the file in a text editor. You might be able to identify the PDF component used in the file header.

BTW, if the file’s contents appear gibberish, you may need to decode it first.

This is why wkhtmltopdf is so good - it’s a full webkit engine so you get full css and html support. It’s also massively faster than the pure php solutions around. The down side is you can only use it if you have sufficient access on your hosting to install or execute applications.

The choice of rendering engine will certainly affect the appearance of HTML when converted to PDF, so it’s a point worth considering.

Webkit is fine, as used in Chrome and Safari. But you probably wouldn’t want to select this if your user base was heavily dependent on another browser.

This is sometimes the case in corporate environments, where users choice of browser can be limited. South Korea is another example, where the vast majority of Internet users are obliged to use Internet Explorer (90%?).

FireFox uses the Gecko rendering engine, Internet Explorer uses Trident.

Pick a browser and PDF library that use the same engine, you’ll stand a better chance of producing a PDF that matches what you’d expect to see in your browser.

All the main web browsers use rendering engines that support HTML and CSS. Yes, even Micorsoft’s browser! :lol: :rofl:

Web pages can also include technologies that require browser plug-ins to support, such as Flash. You may want to ask if the PDF library support this too, and JavaScript, etc.