473,327 Members | 2,069 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,327 software developers and data experts.

export sites/pages to PDF

Hi all,

My employer is asking for a solution that outputs the content of urls
to pdf. It must be the content as seen within the browser.
Can someone help me on this? It must be able to export several kind of
pages with all kind of content (javascript, etc.)
Aug 12 '08 #1
5 1529
jvdb wrote:
Hi all,

My employer is asking for a solution that outputs the content of urls
to pdf. It must be the content as seen within the browser.
Can someone help me on this? It must be able to export several kind of
pages with all kind of content (javascript, etc.)
--
http://mail.python.org/mailman/listinfo/python-list
pdfCreator does the job.

cheers,
Stef
Aug 12 '08 #2
Hi Stef!

Thanks for your answer, but i forgot to mention that i have to run
this on unix/linux.
On Aug 12, 9:06*pm, Stef Mientki <stef.mien...@gmail.comwrote:
jvdb wrote:
Hi all,
My employer is asking for a solution that outputs the content of urls
to pdf. It must be the content as seen within the browser.
Can someone help me on this? It must be able to export several kind of
pages with all kind of content (javascript, etc.)
--
http://mail.python.org/mailman/listinfo/python-list

pdfCreator does the job.

cheers,
Stef
Aug 12 '08 #3
jvdb <st***********@gmail.comwrote:
My employer is asking for a solution that outputs the content of urls
to pdf. It must be the content as seen within the browser.
Can someone help me on this? It must be able to export several kind of
pages with all kind of content (javascript, etc.)
Sounds like you'd be best off scripting a browser.

Eg under KDE you can print to PDF from Konqueror using dcop to remote
control it.

Here is a demo... start Konqueror, select the PDF printer manually
before you start. (You can automate this I expect!)

Run

dcop konq*

to find the id of the running konqueror (in my case
"konqueror-18286"), then open a URL

dcop konqueror-18286 konqueror-mainwindow#1 openURL http://www.google.com

To print to a PDF file

dcop konqueror-18286 html-widget2 print 1

Web site converted to PDF in ~/print.pdf ;-)

Easy enough to script that with python.

See here for some more info on dcop :-

http://www.ibm.com/developerworks/linux/library/l-dcop/

--
Nick Craig-Wood <ni**@craig-wood.com-- http://www.craig-wood.com/nick
Aug 12 '08 #4
Nick Craig-Wood wrote:
jvdb <st***********@gmail.comwrote:
> My employer is asking for a solution that outputs the content of urls
to pdf. It must be the content as seen within the browser.
Can someone help me on this? It must be able to export several kind of
pages with all kind of content (javascript, etc.)

Sounds like you'd be best off scripting a browser.

Eg under KDE you can print to PDF from Konqueror using dcop to remote
control it.

Here is a demo... start Konqueror, select the PDF printer manually
before you start. (You can automate this I expect!)

Run

dcop konq*

to find the id of the running konqueror (in my case
"konqueror-18286"), then open a URL

dcop konqueror-18286 konqueror-mainwindow#1 openURL http://www.google.com

To print to a PDF file

dcop konqueror-18286 html-widget2 print 1

Web site converted to PDF in ~/print.pdf ;-)

Easy enough to script that with python.

See here for some more info on dcop :-

http://www.ibm.com/developerworks/linux/library/l-dcop/
=========================================
If you are running KDE - go with Nick's method.

If the project is as it sounds - an in-house thing.
Meaning the web stuff is created by "you".

IF (BIG IF) you have a limited amount of URLs to deal with
AND
The pages are NOT going to change shape via the print command
(some use one .css for screen and another for print)
AND
you are using UNIX of some sort:

Open the page and print the postscript output to a file.
One file per page.

Then:

with this in a script:
>>>>>>>>>>>>>>>>
#!/bin/sh
# ps2pdf.scr
# converts a single ps file to a pdf file
# april 2000
# SLT
#
ofil=`basename $1 .ps`
gs -sDEVICE=pdfwrite -q \
-dBATCH -dNOPAUSE -r300 \
-sOutputFile=\|cat >$ofil.pdf $1
>>>>>>>>>>>>>>>>
Do:
ps2pdf.scr file.ps
If you have a number of .ps files to convert:

for f in *.ps; do ps2pdf.scr $f; done
In Windows - set the default printer to PDF to file and just print.
Don't expect to concat the PDFs into a single "book",
without a third party program.
NOTE:
If (in UNIX) you want the whole base-on in one file, set up the
printer section to ">>" (append) each output to the single file.
Depending on browser you may need to do some header cleaning.

Steve
no******@hughes.net
Aug 13 '08 #5
jvdb <st***********@gmail.comwrote:
>
My employer is asking for a solution that outputs the content of urls
to pdf. It must be the content as seen within the browser.
Can someone help me on this? It must be able to export several kind of
pages with all kind of content (javascript, etc.)
There are a number of obstacles to this. Printer pages are a different
size from screen windows, so the browser does the layout differently.
Further, many style sheets have rules that are "screen only" or "print
only".

If you really want an image of exactly what's on the screen, then I don't
think you have any option other than a screen capture utility, like "xwd".
--
Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Aug 18 '08 #6

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

Similar topics

0
by: Mike | last post by:
Sites using thumbnail preview for world wide web file navigation and searching. Below are list of sites that are either researching or providing thumbnail preview images for online web...
55
by: Jonas Smithson | last post by:
I've seen a few attractive multi-column sites whose geometry is based on pure CSS-P, but they're what you might call "code afficionado" sites, where the subject matter of the site is "coding...
6
by: Chris Cox | last post by:
I'm trying to put together a simple access database that will allow a friend to maintain a simple database of products/pictures/prices, which he can then export to html and upload to a website. ...
2
by: Bidarkota | last post by:
Hi, I have a DataGrid in which there are some images and Data are displayed and in the webform.asp page i am using some stylesheets. when i export the datagrid all the images are also exported...
4
by: Frankie | last post by:
I'm writing a small C# utility application that creates new Web Sites via ADSI. It seems to work just fine for the most part -- meaning that IIS Metabase entries look either identical or "different...
6
by: Sridhar | last post by:
Hi, I have to export data inside the datagrid into an excel worksheet. I have to do this on button click event. I am trying to do like this. First get the DataTable from the datagrid and...
27
by: Raymond | last post by:
They say it's easier, but has anyone tried maintaining an ASP.NET site without the source code of the dlls? This was not a problem with classic ASP, all the code was almost always just in text...
1
by: ellenh | last post by:
I have read postings on the similar subject including the posting from 2003 shown below. This process works fine to display a single page snapshot report in PowerPoint. I need to display...
9
by: pbd22 | last post by:
Hi. This is just a disaster management question. I am using XMLHTTP for the dynamic loading of content in a very crucial area of my web site. Same as an IFrame, but using XMLHTTP and a DIV. I...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.