Skip to content

Commit

Permalink
Item892: Convert GenPDFAddOn to Foswiki - Initial checkin, a lot of c…
Browse files Browse the repository at this point in the history
…leanup is still required.

git-svn-id: http://svn.foswiki.org/trunk/GenPDFAddOn@2222 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
GeorgeClark authored and GeorgeClark committed Jan 29, 2009
1 parent 4f66b34 commit 328115d
Show file tree
Hide file tree
Showing 11 changed files with 168 additions and 179 deletions.
57 changes: 29 additions & 28 deletions bin/genpdf
@@ -1,44 +1,45 @@
#!/usr/bin/perl -wI.
#!/usr/bin/perl -wT
#
# pdf (converts TWiki page to PDF using HTMLDOC)
# (based on PRintUsingPDF pdf script)
# Foswiki - The Free and Open Source Wiki, http://foswiki.org/
#
# This script Copyright (c) 2005 Cygnus Communications
# and distributed under the GPL (see below)
#
# TWiki WikiClone (see wiki.pm for $wikiversion and other info)
#
# Based on parts of Ward Cunninghams original Wiki and JosWiki.
# Copyright (C) 1998 Markus Peter - SPiN GmbH (warpi@spin.de)
# Some changes by Dave Harris (drh@bhresearch.co.uk) incorporated
# Copyright (C) 1999 Peter Thoeny, peter@thoeny.com
# Additional mess by Patrick Ohl - Biomax Bioinformatics AG
# January 2003
# Copyright (C) 1999-2007 Peter Thoeny, peter@thoeny.org and TWiki Contributors
# Copyright (C) 2008-2009 Foswiki Contributors.
# All Rights Reserved. TWiki Contributors and Foswiki Contributors
# are listed in the AUTHORS file in the root of this distribution.
# NOTE: Please extend that file, not this notice.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
# of the License, or (at your option) any later version. For
# more details read LICENSE in the root of this distribution.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details, published at
# http://www.gnu.org/copyleft/gpl.html
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# As per the GPL, removal of this notice is prohibited.


use strict;
use warnings;

BEGIN {
# Set default current working directory (needed for mod_perl)
if( $ENV{"SCRIPT_FILENAME"} && $ENV{"SCRIPT_FILENAME"} =~ /^(.+)\/[^\/]+$/ ) {
chdir $1;
if ( defined $ENV{GATEWAY_INTERFACE} ) {
$Foswiki::cfg{Engine} = 'Foswiki::Engine::CGI';
use CGI::Carp qw(fatalsToBrowser);
$SIG{__DIE__} = \&CGI::Carp::confess;
}
# Set library paths in @INC, at compile time
unshift @INC, '.';
else {
$Foswiki::cfg{Engine} = 'Foswiki::Engine::CLI';
require Carp;
$SIG{__DIE__} = \&Carp::confess;
}
$ENV{FOSWIKI_ACTION} = 'genpdf';
@INC = ('.', grep { $_ ne '.' } @INC);
require 'setlib.cfg';
}

use strict;
use TWiki::Contrib::GenPDF;

TWiki::Contrib::GenPDF::viewPDF();

use Foswiki;
use Foswiki::UI;
$Foswiki::engine->run();
64 changes: 26 additions & 38 deletions data/TWiki/GenPDFAddOn.txt → data/System/GenPDFAddOn.txt

Large diffs are not rendered by default.

Expand Up @@ -13,7 +13,7 @@ Here are some headings - note that <h1> level 1 headers always appear on a
---++++ Level 4 Heading
---+++++ Level 5 Heading
---++++++ Level 6 Heading
TWiki only goes this far :-( HTMLDOC goes to level 15 :-) %BR%
Foswiki only goes this far :-( HTMLDOC goes to level 15 :-) %BR%
<!-- <h7>Level 7 Heading</h7>%BR%
<h8>Level 8 Heading</h8>%BR%
<h9>Level 9 Heading</h9>%BR%
Expand All @@ -26,8 +26,8 @@ TWiki only goes this far :-( HTMLDOC goes to level 15 :-) %BR%

---++ Features
Some of the cool features are:
* Title topic is a fully rendered TWiki topic, editable from within TWiki's normal edit mechanism.
* Headers/Footers are fully rendered TWiki variables embedded in HTMLDOC special comments, but defined in a normal TWiki topic.
* Title topic is a fully rendered Foswiki topic, editable from within Foswiki's normal edit mechanism.
* Headers/Footers are fully rendered Foswiki variables embedded in HTMLDOC special comments, but defined in a normal Foswiki topic.
* Images are included
* Margins can be defined
* PDF permissions can be restricted (this has 'print,no-copy' so you can't copy and paste the text)
Expand All @@ -51,10 +51,10 @@ This topic includes the following settings:
&nbsp;<br/>
&nbsp;<br/>
&nbsp;<br/></p>
<img src="%PUBURL%/%WEB%/ProjectLogos/twikiRobot121x54a.gif"
alt="Powered by TWiki" width="121" height="54" align="left" />
<img src="%PUBURL%/%WEB%/ProjectLogos/twikiRobot81x119.gif"
alt="Powered by TWiki" width="81" height="119" align="right" /><br/>
<img src="%PUBURL%/%WEB%/ProjectLogos/FoswikiRobot121x54a.gif"
alt="Powered by Foswiki" width="121" height="54" align="left" />
<img src="%PUBURL%/%WEB%/ProjectLogos/FoswikiRobot81x119.gif"
alt="Powered by Foswiki" width="81" height="119" align="right" /><br/>
&nbsp;<br/>
&nbsp;<br/>
&nbsp;<br/>
Expand Down Expand Up @@ -112,14 +112,14 @@ Generated: %DISPLAYTIME%

---++ Preferences
<verbatim>
* TWiki.GenPDFAddOn Settings
* Foswiki.GenPDFAddOn Settings
* Set GENPDFADDON_BANNER = Our Slogan %ORANGE%Rocks!!!%ENDCOLOR%
* Set GENPDFADDON_TITLE = %BASETOPIC%
* Set GENPDFADDON_SUBTITLE = %REVINFO{web="%WEB%" topic="%BASETOPIC%"}%
* Set GENPDFADDON_TITLETOPIC = %SYSTEMWEB%.GenPDFExampleTitleTopic
* Set GENPDFADDON_HEADERTOPIC = %SYSTEMWEB%.GenPDFExampleHeaderFooterTopic
* Set GENPDFADDON_HEADFOOTFONT = helvetica-bold
* Set GENPDFADDON_LOGOIMAGE = http://localhost/twiki/pub/TWiki/ProjectLogos/twikiRobot46x50.gif
* Set GENPDFADDON_LOGOIMAGE = http://localhost/Foswiki/pub/Foswiki/ProjectLogos/FoswikiRobot46x50.gif
* Set GENPDFADDON_FORMAT = pdf14
* Set GENPDFADDON_PERMISSIONS = print,no-copy
* Set GENPDFADDON_ORIENTATION = portrait
Expand Down
File renamed without changes.

0 comments on commit 328115d

Please sign in to comment.