473,387 Members | 1,573 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to generate pdf file from an html page??

Hi everyone, I am trying to generate a PDF printable format file from
an html page. Is there a way to do this using python. If yes then
which library and functions are required and if no then reasons why it
cant be done.

Thank you All
Dec 16 '07 #1
6 2471
I'm sure it can be done but there is no reason to reinvent the wheel
unless it's for a programming exercise. You can use pdftohtml and run
it from a Python program if you want.
http://pdftohtml.sourceforge.net/
Dec 16 '07 #2
Sorry, I read that backwards. I do it the opposite of you. Anyway a
google for "html to pdf python" turns up a lot of hits. Again, no
reason to reinvent the wheel.
Dec 16 '07 #3
On Dec 16, 2007 7:26 PM, Zentrader <ze********@gmail.comwrote:
Sorry, I read that backwards. I do it the opposite of you. Anyway a
google for "html to pdf python" turns up a lot of hits. Again, no
reason to reinvent the wheel.

--
http://mail.python.org/mailman/listinfo/python-list
Like Zentrader said, theres no reason to reinvent the wheel. An HTML
to PDF converter is no trivial task. You would essentially have to
implement an HTML layout engine that outputs PDF files. Not only does
that mean you would have to programatically produce a PDF file, but it
means you would have to parse and correctly render HTML and CSS
according to accepted web standards, the W3C's specifications. This
has proved difficult to do and get right in practice, as is evident
from the browser compatibility issues that continue to plague the web.

Theres a package called Prince that's supposed to do an excellent job.
Check it out:

http://www.princexml.com/

Its layout engine surpasses some browsers in terms of compatibility
with web standards. I don't think its free for commercial use, though,
so this might depend on what exactly you're trying to do.

An alternative idea it to wait for Firefox 3 to come out. If I'm not
mistaken, it will feature a new version of the Gecko layout engine
which will use Cairo for all its rendering. Coincidently, Cairo can be
made to output PDF files. So, you may be able to hack something
together.

--
nasser
Dec 16 '07 #4
On Dec 16, 3:51 am, abhishek <guptaabhishek1...@gmail.comwrote:
Hi everyone, I am trying to generate a PDF printable format file from
an html page. Is there a way to do this using python. If yes then
which library and functions are required and if no then reasons why it
cant be done.

Thank you All
You may want to investigate.
http://pisa.spirito.de/
It worked for me in some simple conversions
Dec 17 '07 #5
On Dec 16, 10:21 pm, Zentrader <zentrad...@gmail.comwrote:
I'm sure it can be done but there is no reason to reinvent the wheel
unless it's for a programming exercise. You can use pdftohtml and run
it from a Python program if you want.http://pdftohtml.sourceforge.net/
Hi Zentrader, thanks for your help.
Dec 17 '07 #6

abhishek wrote:
sh: a2ps: not found
This should make you think. Sounds like a good reason to install a2ps...

Stefan
Dec 19 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Mike | last post by:
I am just wondering if it is possible to save a HTML string from PHPs? Let me elaborate more on what I mean. If you do <?php include 'abc.php' ?> //abc.php <html>
1
by: Tim:. | last post by:
Hi Can someone tell me how I generate a new XML file that I can then use with an XSLT file. I am trying to use an XML file generated from Microsoft Project or even better generate an XML file from...
4
by: Dehaibe François | last post by:
Hi, I'm making a program which uses a scanner which is enable to can multiple pages. I want to save all the scanned images into a PDF FILE. Does exist an API which can generate PDF FILE in...
4
by: k.mitz | last post by:
Hi, I have a PHP application that allows users to generate a .pdf report of their database content. Normally, I've had to refresh a page to call the script to generate the report, so there's a...
7
by: Rathtap | last post by:
I want to write a C# application (lets call it Generator) that will receive an argument(patient account number) and dynamically generate a series of linked HTML files (claim information, payments,...
3
by: Dennis M | last post by:
Hey everyone, I am curious what the performance impact of a custom control would be if it had a significant hierarchy of children. For example, 40 child controls, 5 levels deep, each control on...
0
by: ward | last post by:
Greetings. Ok, I admit it, I bit off a bit more than I can chew. I need to complete this "Generate Report" page for my employer and I'm a little over my head. I could use some additional...
6
by: ash | last post by:
i have a web page using frameset split into few pages. And I want to generate one page of HTML code and send it through email. My question is have to generate a HTML page using asp? Thx very much.
2
by: c.l.rogers | last post by:
I've been searching for few days trying to find an answer to my question... hopefully I ofund the right place to help me out! What I am trying to do is use javescript inside column of a <table>...
1
by: Daniel Hilgarth | last post by:
Hello, I am currently trying to use XSLT for the creation of multiple HTML-files from a single XML-File. This HTML-files need to have links to each other. The following information might be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.