Item11881: Create PdfPlugin

pencil
Priority: Normal
Current State: Closed
Released In: n/a
Target Release: n/a
Applies To: Extension
Component: PdfPlugin
Branches: trunk
Reported By: ArthurClemens
Waiting For:
Last Change By: ArthurClemens
-- ArthurClemens - 19 May 2012

It would be better for Foswiki to have more cooperation on already existing plugins rather than creating YAP (yet another plugin), i.e. as there already is a wkhtmltopdf based pdf generator at GenPDFWebkitPlugin.

-- MichaelDaum - 20 May 2012

I agree. I was not aware of that - didn't look far enough.

I am ready to remove PdfPlugin if these features can be merged:
  • have a ready template to show PDF buttons on the page
  • specify display parameters (as URL param and defaults in Configure); as default I use cover=print;viewtemplate=plain
    • keep rev as special display parameter that doesn't override the previous parameters

Note that it is not necessary to create a html file first. Passing the url to wkhtmltopdf is sufficient.

-- ArthurClemens - 20 May 2012

Frankly, calling the plugin PdfPlugin is indeed the obvious choice. Much better then GenPDFFooBarPlugin.

I haven't looked at your code at the moment, but it seems the two plugins integrate a bit different where GenPDFWebkitPlugin sits in a completePageHandler and checks for an url param contenttype matching application/pdf. When that's the case it saves the html generated by foswiki into a temp file, calls wkhtmltopdf, and then forwards the result to the browser instead of the original html. Does that fit into the feature set that you are requiring?

-- MichaelDaum - 21 May 2012

I'm fine with an completePageHandler approach, as long as it is possible to set view parameters. But perhaps these can go in the url of the 'PDF' button link.

We could also consider a simpler url param like ?pdf instead of ?contenttype=application/pdf, which feels like a complexity that is better hidden.

The template file is just for convenience: add pdf to the skin path and the buttons should appear.

-- ArthurClemens - 21 May 2012

The reason for contenttype is that this is actually a feature of the foswiki core to determine the content type being transfered. So instead of adding another url param, it hooks into the existing ones used to specify the returned content type. And of course any other url params understood by the core influence the content that goes thru that rendering pipeline (view, cover, skin, rev, ...)

-- MichaelDaum - 21 May 2012

I am adopting the 'best practice' of using completePageHandler. It also does away with checking access controls and checking if the topic exists and eliminates the bin script.

-- ArthurClemens - 21 May 2012

So which one are we going to keep: PdfPlugin or GenPDFWebkitPlugin?

-- MichaelDaum - 22 May 2012

PdfPlugin is the better name. It works how GenPDFWebkitPlugin works, except:
  • slightly different configuration settings
  • the binary is not distributed in tools dir
  • it has an additional skin template view.pdf.tmpl to add buttons to the screen

So effectively GenPDFWebkitPlugin is almost integrated into PdfPlugin, and can be deprecated.

PdfPlugin has a "feel free to modify" policy.

-- ArthurClemens - 22 May 2012
 
Topic revision: r19 - 22 May 2012, ArthurClemens
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy