[Mediawiki-l] export wiki to PDF
White, Steve S [NTK]
Joseph.S.White at mail.sprint.com
Fri Apr 8 13:48:08 UTC 2005
Export of a given article in a Wiki to PDF is nearly trivial using wget,
tidy, html2ps and ps2pdf:
<?php
$page = $_GET['page'];
$content=`export HOME=/home/apache;links -source \
http://localhost/wikids/index.php/$page | clip.pl | /usr/local/bin/tidy
| \
/usr/local/bin/html2ps | /usr/bin/ps2pdf - -`;
header('Content-type: application/pdf');
header("Content-Disposition: attachment; filename=$page.pdf");
print $content;
?>
clip.pl is a simple perl parser to strip out the nav bar and the like
and leave only the article div; any perl neophyte should be able to hack
it together. I added a link to the standard template on the intranet
wiki I administer, "Get PDF of this page"; it basically just calls
[http://evo.mydomain.com/pdfgen/index.php?page={{NAMESPACE}}:{{PAGENAMEE
}} Get PDF of this page]
I might not want to try this on something like Wikipedia ( all the
disk/memory action involved in the multiple conversions might push the
system load over-the-top ), but on a fairly busy intranet wiki, the load
is nominal, and it's a quick-and-useful hack. :D
Have a good one!
Steve
-----Original Message-----
From: mediawiki-l-bounces at Wikimedia.org
[mailto:mediawiki-l-bounces at Wikimedia.org] On Behalf Of Rowan Collins
Sent: Friday, April 08, 2005 7:58 AM
To: MediaWiki announcements and site admin list
Subject: Re: [Mediawiki-l] export wiki to PDF
On Apr 8, 2005 3:29 AM, Aaron Macks <amacks at techtarget.com> wrote:
> is there anyway to export an entire wiki to some fixed format, like
> linked html or pdf?
Some of the tools listed on
http://meta.wikimedia.org/wiki/Alternative_parsers are designed for
this exact purpose; others could be adapted to it.
I've also added a note there about the dump-using-internals parser
that Brion mentionned, because although it's not an alternative
parser, it could well be an alternative to using an alternative... :p
--
Rowan Collins BSc
[IMSoP]
_______________________________________________
MediaWiki-l mailing list
MediaWiki-l at Wikimedia.org
http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
More information about the MediaWiki-l
mailing list