If htmldoc sends a minor error,
PublishContrib does not give the resulting PDF to the user even though the PDF has been created.
Example: I have a topic with a too wide picture. When I run htmldoc on the prompt, I get the following message:
$ htmldoc --webpage --links --linkstyle plain --outfile /tmp/tt.pdf /home/httpd/twiki/export/Mettenmeier_940/WebHome.html
ERR014: Image on page 1 too large - truncation or overlapping may occur!
PAGES: 1
BYTES: 226000
Nevertheless the PDF file has been created.
When I try to create a PDF from that topic with the help of
PublishContrib I get the following error in the browser:
Content-type: text/plain TWiki detected an internal error - please check your TWiki logs and webserver logs for more information. htmldoc failed: 1path
In the error.log I get the following:
[Mon Feb 12 21:30:16 2007] [error] [client 192.168.139.1] htmldoc '--webpage' '--links' '--linkstyle' 'plain' '--outfile' '/home/httpd/twiki/export/Mettenmeier_1048.pdf' '/home/httpd/twiki/export/Mettenmeier_1048/WebHome.html' -> , referer: http://twiki-mm-soft/twiki/bin/view/Mettenmeier/ExportToHTML
[Mon Feb 12 21:30:16 2007] [error] [client 192.168.139.1] htmldoc failed: 1// at /usr/share/perl/5.8/CGI/Carp.pm line 314., referer: http://twiki-mm-soft/twiki/bin/view/Mettenmeier/ExportToHTML
[Mon Feb 12 21:30:16 2007] [error] [client 192.168.139.1] \tCGI::Carp::realdie('htmldoc failed: 1//') called at /usr/share/perl/5.8/CGI/Carp.pm line 385, referer: http://twiki-mm-soft/twiki/bin/view/Mettenmeier/ExportToHTML
[Mon Feb 12 21:30:16 2007] [error] [client 192.168.139.1] \tCGI::Carp::die('htmldoc failed: 1//') called at /home/httpd/twiki/lib/TWiki/Contrib/PublishContrib/pdf.pm line 58, referer: http://twiki-mm-soft/twiki/bin/view/Mettenmeier/ExportToHTML
[Mon Feb 12 21:30:16 2007] [error] [client 192.168.139.1] \tTWiki::Contrib::PublishContrib::pdf::close('TWiki::Contrib::PublishContrib::pdf=HASH(0x8695984)') called at /home/httpd/twiki/lib/TWiki/Contrib/Publish.pm line 242, referer: http://twiki-mm-soft/twiki/bin/view/Mettenmeier/ExportToHTML
[Mon Feb 12 21:30:16 2007] [error] [client 192.168.139.1] \tTWiki::Contrib::Publish::publish('TWiki=HASH(0x88bb208)') called at /home/httpd/twiki/lib/TWiki/UI.pm line 109, referer: http://twiki-mm-soft/twiki/bin/view/Mettenmeier/ExportToHTML
[Mon Feb 12 21:30:16 2007] [error] [client 192.168.139.1] \tTWiki::UI::__ANON__() called at /home/httpd/twiki/lib/CPAN/lib///Error.pm line 379, referer: http://twiki-mm-soft/twiki/bin/view/Mettenmeier/ExportToHTML
[Mon Feb 12 21:30:16 2007] [error] [client 192.168.139.1] \teval {...} called at /home/httpd/twiki/lib/CPAN/lib///Error.pm line 371, referer: http://twiki-mm-soft/twiki/bin/view/Mettenmeier/ExportToHTML
[Mon Feb 12 21:30:16 2007] [error] [client 192.168.139.1] \tError::subs::try('CODE(0x8c96628)', 'HASH(0x8c277b0)') called at /home/httpd/twiki/lib/TWiki/UI.pm line 158, referer: http://twiki-mm-soft/twiki/bin/view/Mettenmeier/ExportToHTML
[Mon Feb 12 21:30:16 2007] [error] [client 192.168.139.1] \tTWiki::UI::run('CODE(0x83075fc)') called, referer: http://twiki-mm-soft/twiki/bin/view/Mettenmeier/ExportToHTML
The PDF file is created but it is not handed over to the user.
Of course, the initial error comes out of htmldoc. But I think, this error message should be handeld by the plugin: The user may get a warning but the resulting PDF file should be handed over to the user.
--
TWiki:Main/MarkusHesse - 12 Feb 2007
PublishContrib only reacts to a non-zero exit code coming from htmldoc (in this case, error code 1), which is normally taken as indicating a fatal error. If we have to parse the error message from htmldoc, that's pretty crap.
Anyone got a patch that fixes this? I don't use PDF output myself, so the motivation isn't strong. The obvious hack is to comment out this line from pdf.pm:
die "htmldoc failed: $exit/$data/$@" if $exit;
--
TWiki:Main.CrawfordCurrie - 13 Feb 2007
OK, I refactored the reporter to make this less aggressive, but it
is an error.
CC