Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > export sites/pages to PDF

Reply
Thread Tools

export sites/pages to PDF

 
 
jvdb
Guest
Posts: n/a
 
      08-12-2008
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.)
 
Reply With Quote
 
 
 
 
Stef Mientki
Guest
Posts: n/a
 
      08-12-2008
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
 
Reply With Quote
 
 
 
 
jvdb
Guest
Posts: n/a
 
      08-12-2008
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.com> wrote:
> 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


 
Reply With Quote
 
norseman
Guest
Posts: n/a
 
      08-13-2008
Nick Craig-Wood wrote:
> jvdb <> wrote:
>> 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

 
Reply With Quote
 
Tim Roberts
Guest
Posts: n/a
 
      08-18-2008
jvdb <> wrote:
>
>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,
Providenza & Boekelheide, Inc.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Export to PDF with google maps + msacces export Maarten Porters Ruby 1 07-28-2008 01:45 PM
Postscript to PDF with pdf-tools, pdf-writer, or other Sean Nakasone Ruby 1 04-14-2008 09:13 PM
PDF::Writer, create pdf and insert in other pdf file. Ricardo Pog Ruby 1 03-26-2008 08:24 PM
ReportViewer export to PDF = PDF[1]. Richard Coltrane ASP .Net 1 02-25-2007 11:46 PM
Invalid export DLL or export format =?Utf-8?B?RGF2aWQgVmFsbGU=?= ASP .Net 0 10-29-2003 11:46 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57