create new tag
, view all tags

PdfPluginDev Discussion: Page for developer collaboration, enhancement requests, patches and improved versions on PdfPlugin contributed by the TWikiCommunity.
• Please let us know what you think of this extension.
• For support, check the existing questions, or ask a new support question in the Support web!
• Please report bugs below

Feedback on PdfPlugin

Things to do:

Avoid patching view script

The install needs patching the view script; I think I can make this obsolete, if I hook in the MIME output type. I.e. instead of passing pdf="on", then setting the mime type, check for contenttype="application/pdf", then

  1. init plugin
  2. take page after TWiki has done all the rendering
  3. run htmldoc, optionally with title page

Proper access to parms

I currently fiddle with $ENV{'QUERY_STRING'}, but there is an API function for this.

Cleaner book mode / article mode handling

  • template for page in article mode
  • template handling in general - do I need view.pdf.tmpl or could I switch to sth like
    • pdfbody.tmpl
    • pdfbody.article.tmpl
    • pdftitle.tmpl
    • pdftitle.article.tmpl
  • better docs
  • cleaner code,
  • better control per page,
maybe generalize...

Pass thru HTMLDOC options

In PrintUsingPDF, there is a suggested syntax for using HTMLDOC options. I think the most elegant way is to pass HTMLDOC arg per topic with a special variable. this must be filtered correctly, otherwise this would be a gaping security hole.

Bugs to fix

Go here...

-- PeterKlausner - 01 Sep 2003


Even though it is marked "as is" here is some feedback to help get things progressing.

The following need to be addressed to get it working on an AthensRelease installation:

  1. Dependency on the SpacedWikiWordPlugin - suggest that this be added as a requirement or the dependency removed
    • it's just in the template. I like it for the title, but you can get away w/o -- PK
  2. Hard coded, "ssrpkl" specific paths in the pdfcall.tmpl file - this should not be!
    • ok; will rename it to tbd; it's site specifici anyway and you will have to edit it -- PK

And there may be more, as I was attempting to get things operational on a BeijingRelease. PdfPlugin on Beijing has the following issues (we are using Apache 2 with mod_perl 1.0):

  1. PdfPlugin.pm needs to "use TWiki::Plugins::SpacedWikiWordPlugin;" before using a component of the SpacedWikiWordPlugin library
  2. bin/view has moved on somewhat so the patch does not apply
  3. bin/view now uses TWiki::writeHeaderFull, probably should use this to handle the Content-type: header in the same way the RSS stuff does, means removing this from PdfPlugin.pm
    • from my brief excursion into BeijingRelease, I realised major changes ahead frown but I'm confident it will work w/o patching view smile -- PK
  4. If one uses authentication (as we do) this can give trouble - the pdf script from PrintUsingPDF appears to handle this better
    • authentication wise it is identical to regular view -- is this a problem? -- PK

Eventually, I gave up and installed the pdf script from PrintUsingPDF. But a plugin is a better approach, my ideal would be a TWiki variable or something to be included in templates etc that resulted in the appropriate URL to generate the PDF for a given page (ala the webaction list) - can this be achieved with a functional PdfPlugin? If so how?

  • yep; I'm currently using logo/text links like such:
<a href="%SCRIPTURLPATH%/fresh/%WEB%/%TOPIC%%REVARG%?maxage=0&pdf=on&skin=pdf" title="convert to pdf">
<img border="0" src=%PUBURL%/icn/pdf.gif></a>
<a href="%SCRIPTURLPATH%/fresh/%WEB%/%TOPIC%%REVARG%?maxage=0&pdf=on&skin=pdf">PDF</a>
  • Note usage of the CacheAddOn hack to make sure, you get a proper PDF in case of touched %INCLUDEs. -- PK

-- TonyMartindale - 03 Sep 2003

Has anyone had success loading images that are attached to a topic and referenced with an <IMG /> tag? I cannot find a way to get Htmldoc to go to the webpage or get it from the filesystem (through the --path parameter).

Here is my pdfcall.tmpl file:

/usr/bin/htmldoc --bodyfont arial --compression 5 --firstpage p1 --fontsize 10 \
--footer t.1 --format pdf13 --header l.c --headingfont arial --linkcolor '#0000\
00' --linkstyle plain --no-strict --numbered --pagelayout one --pagemode outlin\
e --permissions all --titlefile /dev/null --tocheader t.l  --tocfooter ..i --to\
clevels 4 --webpage --firstpage c1 --logoimage /dev/null %PDFBODY%

(I have made changes, like taking out the title page.)

-- BrentRoberts - 10 Sep 2003

OK. To answer my own question: The key to getting images that are attached to TWiki into the PDF is in the --path parameter. Since my TWiki public directory is /var/www/twiki/pub, htmldoc needs to find the images from that directory. But the img tags already start with "/twiki/pub", so the path parameter should look like --path "/var/www" . Problem solved!

-- BrentRoberts - 17 Sep 2003

Hi, great Plugin but it does not work under the BeijingRelease ( apt-get install twiki ). I can't patch the view command, has everyone the same problem?

I use now the pdf script from PrintUsingPDF, it works very well.

-- MichaelHagmann - 08 Feb 2004

Edit | Attach | Watch | Print version | History: r12 < r11 < r10 < r9 < r8 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r12 - 2004-11-20 - MartinCleaver
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.