Tags:
create new tag
, view all tags

ToPDFAddOnDev Discussion: Page for developer collaboration, enhancement requests, patches and improved versions on ToPDFAddOn 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 ToPDFAddOn

We have work to do.
First of all, currently new features are not the first goal, more it is a user friendly installation, configuration and use

  • header/footer should be read out of a TWiki topic ( like a template ). We need to define some usefull variables like web/topic/user/version etc.
  • pagewidth, media,cssmedia,landscape and margins should be configured though TWiki
    • we could pass them through the console script, which would result in a huge command line ( which is limitted in lenght ). This would be optimal, as we could pass thins like media / landscape individual for a topic
    • we could parse the LocalSite.cfg like we do with the path( so set them through configure ). Not practical for all parameters
    • Any ideas?

-- MayerEugen - 01 Jun 2008

Thank you Mayer for sharing this add-on with the TWikiCommunity! As you stated, at some point it makes sense to merge this into the existing GenPDFAddOn.

Some feedback/questions:

  • Avoid extra question mark links (I escaped them in the add-on topic).
  • Escape top heading so that it does not show up in the TOC.
  • Use interwiki link to point to other extensions, unless there is a dependency (this is to avoid broken links when this add-on is installed).
  • I moved the " We have work to do" to this dev topic.
  • This add-on requires PHP. Not sure if there are any security implications (wiki + open php engine), worth checking.
  • On pagewidth etc, you could use preferences settings. They can be defined site-wide in Main.TWikiPreferences and overloaded by user, on web-level and page level.

-- PeterThoeny - 02 Jun 2008

I tagged the add-on topic, help with tag vote if inclined.

-- PeterThoeny - 04 Jun 2008

I dont think PHP is a security threat in this case. PHP is only used in command line mode, so no way to access PHP through the browser ( or better, no need to let it be accessable for ToPDFAddOn). In addition, yet not parameter are passed directly to the script YET!

This could change with the variables like pagewidth and stuff, which cann be defined on user base even, so this could be a thread i there are "Command line injections" used. We need to check any content passed to the command line for any harmfould things. We could simply pass it with quotes and escape any other content. Esp. dangarous are things like | or &.

-- MayerEugen - 05 Jun 2008

It isn't clear to me from the documentation, but what is the difference between this and GenPDFAddOn? Is it that ToPDFAddOn supports TWiki's CSS and the other doesn't.

I'm asking because I'm having issues with GenPDFAddOn and I'm wondering if this is a potential replacement. But the documentation seems to be written in the future tense, which isn't very encouraging. Plus, I'm on Windows and it isn't tested on that yet. So I'm not sure if it's even worth testing at this point.

-- SeanCMorgan - 05 Jun 2008

the main functional difference is the html to pdf engine they use as a backend. GenPDF uses HTMLDOC a fast C based converter that does not yet have very strong css support (though the development versions are getting better) while ToPDF uses Html2Pdf, which is more complete, and (i find) much much slower.

Have you reported Bugs for the issues you have with GenPDF? I've made a few fixes this week, that I've not yet commited, but are mentioned in the Bugs system.

-- SvenDowideit - 06 Jun 2008

I can't get it to work..

  • If nobody is logged in I get
    • Can't locate object method "wikiName" via package "BaseUserMapping_666" (perhaps you forgot to load "BaseUserMapping_666"?)
  • If I log in, I get
    • Can't locate object method "wikiName" via package "EnricoRos" (perhaps you forgot to load "EnricoRos"?)
  • after changing ToPDF.pm:212 from $session->{user}->wikiName() to $session->{user}; i get
    • infinite recursion on php scripts (btw my tmp dir gets populated with many html2pdf* files ...)
    • php processes recurr with a growing list of params, like this:
      /usr/bin/php /var/www/twiki-dm/pub/TWiki/ToPDFAddOn/topdf.php /tmp/html2pdfBjZ6.html html2pdfBjZ6 /tmp/ TWiki/url(/twiki-dm/pub/TWiki/TWikiTemplates/base/url(/twiki-dm/pub/TWiki/TWikiTemplates/base/url(/twiki-dm/pub/TWiki/TWikiTemplates/base/url(/twiki-dm/pub/TWiki/TWikiTemplates/base/url(/twiki-dm/pub/TWiki/TWikiTemplates/base/url(/twiki-dm/pub/TWiki/TWikiTemplates/base/url(/twiki-dm/pub/TWiki/TWikiTemplates/base/url(/twiki-dm/pub/TWiki/TWikiTemplates/base/url(/twiki-dm/pub/TWiki/TWikiTemplates/base/url(/twiki-dm/pub/TWiki/TWikiTemplates/base/url(/twiki-dm/pub/TWiki/TWikiTemplates/base/url(/twiki-dm/pub/TWiki/TWikiTemplates/base/url(/twiki-dm/pub/TWiki/TWikiTemplates/base/url(/twiki-dm/pub/TWiki/TWikiTemplates/base/url(/twiki-dm/pub/TWiki/TWikiTemplates/base/Css) BaseUserMappi/usr/bin/php /var/www/twiki-dm/pub/TWiki/ToPDFAddOn/topdf.php /tmp/html2pdfBjZ6.html html2pdfBjZ6 /tmp/ TWiki/url(/twiki-dm/pub/TWiki/TWikiTemplates/base/url(/twiki-dm/pub/TWiki/TWikiTemplates/base/url(/twiki-dm/pub/TWiki/TWikiTemplates/base/url(/twiki-dm/pub/TWiki/TWikiTemplates/base/url(/twiki-dm/pub/TWiki/TWikiTemplates/base/url(/twiki-dm/pub/TWiki/TWikiTemplates/base/url(/twiki-dm/pub/TWiki/TWikiTemplates/base/url(/twiki-dm/pub/TWiki/TWikiTemplates/base/url(/twiki-dm/pub/TWiki/TWikiTemplates/base/url(/twiki-dm/pub/TWiki/TWikiTemplates/base/url(/twiki-dm/pub/TWiki/TWikiTemplates/base/url(/twiki-dm/pub/TWiki/TWikiTemplates/base/url(/twiki-dm/pub/TWiki/TWikiTemplates/base/url(/twiki-dm/pub/TWiki/TWikiTemplates/base/url(/twiki-dm/pub/TWiki/TWikiTemplates/base/Css) BaseUserMapping_666
      

-- EnricoRos - 07 Jun 2008

EnricoRos, are you using TWiki 4.2? The following worked for me:
my $userName = TWiki::Func::getWikiName();
(I attached a patch which only uses this form for TWiki::Plugins::VERSION ≥ 1.2)

-- MarkusUeberall - 08 Jun 2008

There are bugs with fetching Images, so in the current version the images are not inlcuded in the PDF, only a placeholder. I fixed this bug and will commit this in a few.

The performace issue is known, but i guess its nothing suprising that supporting such a wide variarity of CSS like html2pdf does, is resulting in a much complex parsing and therefor slower processing. Yet, it did not harm me, it was fast enaugh for any needs. I will probably optimze the code of html2pdf, as its massive OOP and maybe there are some ways to optimize it ( Especilly PHP5 wise ). In addition, its possible to precompile the whole html2pdf thing and use it then, this could really help a lot in performance related things.

Disscussing with SvenDowait it could be reasonable to support both backends, htmldoc and html2pdf for easy switching and choose.

-- MayerEugen - 08 Jun 2008

(Re: SvenDowideit - 06 Jun 2008)
I summarized my issues in TWikibug:Item4437 on 14 May 2008. More details are at TWiki:Support/GenPDFAddOnImageErrors.

-- SeanCMorgan - 09 Jun 2008

ok the code is in under svn now, trunk/ToPDFAddOn The svn version supports images and fixes all bugs i managed to fix yet.

-- MayerEugen - 09 Jun 2008

Licence issues: As just dicussed on the IRC channel, we need to get rid of the included original TrueType fonts, because they may not be redistributed (any more)--both in the downloadable bundles and in the repository. Refer to http://corefonts.sourceforge.net/ for details on how to obtain and use (older) copies on non-Windows systems.

Update: I replaced the archives.

-- MarkusUeberall - 14 Jun 2008 / 10 Jul 2008

> it could be reasonable to support both backends, htmldoc and html2pdf for easy switching and choose

That might avoid some duplication of effort.

BTW, it looks like the intent of HTMLDOC 1.9 is to add CSS support too. It seems to be taking it forever to be released though.

-- SeanCMorgan - 20 Jun 2008

Topic attachments
I Attachment History Action Size Date Who Comment
Texttxt ToPDF_wikiName_patch.txt r1 manage 0.4 K 2008-06-08 - 09:57 MarkusUeberall This patch fixes the way the user's wiki name is determined (as needed for TWiki::Plugins::Version ≥ 1.2)
Edit | Attach | Watch | Print version | History: r13 < r12 < r11 < r10 < r9 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r13 - 2008-07-10 - MarkusUeberall
 
  • 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.