Item12028: GenPDFAddOn not Work Corretly
Priority: Normal
Current State: Waiting for Feedback
Released In: n/a
Target Release: n/a
I have installed
Foswiki-1.1.5, Tue, 10 Apr 2012, build 14595, Plugin API version 2.2 with
http://foswiki.org/Support/GenPDFAddOn
I have attached two pictures in my thread:
Astigmatism_text_blur.png
and
debian-CD-netinst.png
The details of these images are shown through the program file:
$ File debian-CD-netinst.png
debian-CD-netinst.png: PNG image data, 1024 x 1024, 8-bit/color RGBA, non-interlaced
$ File Astigmatism_text_blur.png
Astigmatism_text_blur.png: PNG image data, 800 x 600, RGB 8-bit/color, non-interlaced
When I generate a PDF using GenPDFAddOn, only the first image is shown in the generated PDF. Note that the first image is RGBA. The second image is RGB.
The images are attached to this topic.
Can anyone confirm this?
--
JarbasJunior - 02 Aug 2012
I just tried
GenPDFAddOn on linux, running htmldoc 1.8.27. I attached both images to a test topic. Both were displayed in the generated pdf. The debian CD was cropped on the right side, and the Astigmatism diagram was not as clear as when viewed directly. But they were both there. Can you provide some more information about your system and htmldoc versions?
--
GeorgeClark - 03 Aug 2012
My system:
# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux unstable (sid)
Release: unstable
Codename: sid
My sources.list
## Debian Unstable
deb http://ftp.br.debian.org/debian/ unstable main contrib non-free
## Foswiki
# http://fosiki.com/Foswiki_debian/
deb http://fosiki.com/Foswiki_debian/ stable main contrib
My version htmldoc
dpkg -l | grep htmldoc
ii htmldoc 1.8.27-8 amd64 HTML processor that generates indexed HTML, PS, and PDF
ii htmldoc-common 1.8.27-8 all Common arch-independent files for htmldoc
--
JarbasJunior - 06 Aug 2012
I'm not sure what else to suggest.
GenPDFAddOn doesn't do any image processing other than to save the images referenced in img tags as temporary files so that
htmldoc
can read them.
Could you also zip up and attach the topic.
Another thing to try would be to create a html file manually that includes the images, and run
htmldoc
from the command line to see how it handles the images. I suspect the issue is on the htmldoc side of things. Also, if you enable the debug parameter, I believe that
GenPDFAddOn will keep all the generated intermediate files so that you can examine the generated html and saved images.
--
GeorgeClark - 07 Aug 2012
This is my Topic
---+ %SPACEOUT{"JarbasPeixoto"}% @ <nop>%WIKITOOLNAME%
<!--
* #Set ALLOWTOPICCHANGE = JarbasPeixoto
-->
* Astigmatism: <br />
<img src="%ATTACHURLPATH%/Astigmatism_text_blur.png" alt="Astigmatism_text_blur.png" width='800' height='600' />
* Debian CD netinst: <br />
<img src="%ATTACHURLPATH%/debian-CD-netinst.png" alt="debian-CD-netinst.png" width='1024' height='1024' />
When I use the
htmldoc
command line, I get the correct pdf.
When I turn on debug parameter, the temporary files is in the directory:
ls -l /var/lib/foswiki/working/tmp
total 2060
-rw-r----- 1 www-data www-data 165 Ago 7 08:07 cgisess_c19210b9ea1e14d7296101d8644c2d63
-rw-r----- 1 www-data www-data 194 Ago 7 08:09 cgisess_c404eeb1866eb62954c39b161c354873
-rw------- 1 www-data www-data 2761 Ago 7 08:09 GenPDFAddOn8qwZ0edYRz.html
-rw------- 1 www-data www-data 7962 Ago 7 08:09 GenPDFAddOnHNmyRohKWL.html
-rw------- 1 www-data www-data 1306884 Ago 7 08:09 GenPDFAddOnW8s72S9j_b.pdf
-rw------- 1 www-data www-data 3043 Ago 7 08:09 GenPDFImga9j9i4JODLti
-rw------- 1 www-data www-data 3177 Ago 7 08:09 GenPDFImgAJoxCQQw3gIb
-rw------- 1 www-data www-data 3043 Ago 7 08:09 GenPDFImgeO48dWMlG0_p
-rw------- 1 www-data www-data 55443 Ago 7 08:09 GenPDFImgEzcBVP2tJODp
-rw------- 1 www-data www-data 695691 Ago 7 08:09 GenPDFImgJUFieRiquq_1
-rw------- 1 www-data www-data 3077 Ago 7 08:09 GenPDFImgNrMPZ1JT2yEf
-rw------- 1 www-data www-data 656 Ago 7 08:09 GenPDFImgo4_H18ygmheM
-rw------- 1 www-data www-data 2866 Ago 7 08:09 GenPDFImgz1XcRvHbOXd9
file /var/lib/foswiki/working/tmp/GenPDF*
/var/lib/foswiki/working/tmp/GenPDFAddOn8qwZ0edYRz.html: HTML document, ISO-8859 text, with very long lines
/var/lib/foswiki/working/tmp/GenPDFAddOnHNmyRohKWL.html: HTML document, ISO-8859 text, with very long lines
/var/lib/foswiki/working/tmp/GenPDFAddOnW8s72S9j_b.pdf: PDF document, version 1.4
/var/lib/foswiki/working/tmp/GenPDFImga9j9i4JODLti: GIF image data, version 89a, 88 x 31
/var/lib/foswiki/working/tmp/GenPDFImgAJoxCQQw3gIb: PNG image data, 16 x 16, 8-bit/color RGBA, non-interlaced
/var/lib/foswiki/working/tmp/GenPDFImgeO48dWMlG0_p: GIF image data, version 89a, 88 x 31
/var/lib/foswiki/working/tmp/GenPDFImgEzcBVP2tJODp: PNG image data, 800 x 600, 8-bit/color RGB, non-interlaced
/var/lib/foswiki/working/tmp/GenPDFImgJUFieRiquq_1: PNG image data, 1024 x 1024, 8-bit/color RGBA, non-interlaced
/var/lib/foswiki/working/tmp/GenPDFImgNrMPZ1JT2yEf: PNG image data, 16 x 16, 8-bit/color RGBA, non-interlaced
/var/lib/foswiki/working/tmp/GenPDFImgo4_H18ygmheM: PNG image data, 16 x 16, 8-bit/color RGBA, non-interlaced
/var/lib/foswiki/working/tmp/GenPDFImgz1XcRvHbOXd9: GIF image data, version 89a, 231 x 46
My Topic:
--
JarbasJunior - 07 Aug 2012
Have you examined the extracted image files.
GenPDFImgEzcBVP2tJODp and
GenPDFImgJUFieRiquq_1 in your temp file list. If htmldoc works with the image files externally, somehow maybe the image file is being corrupted when fetched by
GenPDFAddOn.
The code that saves each image file is in lib/Foswiki/Contrib/GenPDFAddOn.pm around line 552. If the temp files display correctly and yet are corrupted in the pdf, I'm at a complete loss. If the temp file is corrupted, then it seems to be a fundamental issue in reading / saving an attachment. Is your site using UTF8 or Locales?
--
GeorgeClark - 08 Aug 2012
The files GenPDFImgJUFieRiquq_1 and GenPDFImgEzcBVP2tJODp are Ok. See attachment.
My site use this configuration (
/etc/foswiki/LocalSite.cfg
)
# grep Locale /etc/foswiki/LocalSite.cfg
$Foswiki::cfg{LocalesDir} = '/var/lib/foswiki/locale';
'{UseLocale}',
'{Site}{Locale}',
'{Site}{LocaleRegexes}',
$Foswiki::cfg{UseLocale} = 1;
$Foswiki::cfg{Site}{Locale} = 'pt_BR.utf8';
$Foswiki::cfg{Site}{LocaleRegexes} = 1;
# locale
LANG=pt_BR.UTF-8
LANGUAGE=pt_BR:pt:en
LC_CTYPE=pt_BR.UTF-8
LC_NUMERIC="pt_BR.UTF-8"
LC_TIME="pt_BR.UTF-8"
LC_COLLATE=pt_BR.UTF-8
LC_MONETARY="pt_BR.UTF-8"
LC_MESSAGES=pt_BR.UTF-8
LC_PAPER="pt_BR.UTF-8"
LC_NAME="pt_BR.UTF-8"
LC_ADDRESS="pt_BR.UTF-8"
LC_TELEPHONE="pt_BR.UTF-8"
LC_MEASUREMENT="pt_BR.UTF-8"
LC_IDENTIFICATION="pt_BR.UTF-8"
LC_ALL=
I'm thinking of testing a Foswiki virtualbox (
http://foswiki.org/Download/DownloadVirtualMachineImage) to verify this behavior.
What do you think?
--
JarbasJunior - 08 Aug 2012
I'm really running out of ideas. Did you make any changes to
GenPDFAddOn.pm and the generated call to htmldoc to use your pt_BR.UTF8 locale? When you ran with the "DEBUG" flag enabled, the plugin should have recorded:
"Calling htmldoc with args: ...
. If you run htmldoc by hand using the saved files and this argument does it generate a valid pdf.
--
GeorgeClark - 08 Aug 2012
I don't make any changes to
!GenPDFAddOn.pm
.
With "DEBUG" flag enabled, I have:
| 2012-08-13T17:27:03Z debug | GenPDF - preparing JarbasPeixoto depth x |
| 2012-08-13T17:27:04Z debug | GenPDF - fixHtml called for JarbasPeixoto depth 0 |
| 2012-08-13T17:27:04Z debug | GenPDF - title: Foswiki - JarbasPeixoto |
| 2012-08-13T17:27:04Z debug | GenPDF - Read attachmentMain JarbasPeixoto debian-CD-netinst.png |
| 2012-08-13T17:27:04Z debug | GenPDF - Read attachmentMain JarbasPeixoto Astigmatism_text_blur.png |
| 2012-08-13T17:27:04Z debug | GenPDF - Read attachmentSystem DocumentGraphics toggleclose.png |
| 2012-08-13T17:27:04Z debug | GenPDF - Read attachmentSystem ProjectLogos foswiki-badge.gif |
| 2012-08-13T17:27:04Z debug | GenPDF - Read attachmentSystem DocumentGraphics png.png |
| 2012-08-13T17:27:04Z debug | GenPDF - Read attachmentSystem DocumentGraphics toggleopen.png |
| 2012-08-13T17:27:04Z debug | GenPDF - building title topic GenPDFTitleTopic |
| 2012-08-13T17:27:04Z debug | GenPDF - building title topic from a topic Main, GenPDFTitleTopic |
| 2012-08-13T17:27:04Z debug | GenPDF - Read attachmentSystem ProjectLogos foswiki-logo.gif |
| 2012-08-13T17:27:04Z debug | GenPDF - Read attachmentSystem ProjectLogos foswiki-badge.gif |
| 2012-08-13T17:27:04Z debug | GenPDF - No headings present - Overriding structure from book to webpage |
| 2012-08-13T17:27:04Z debug | GenPDF - Calling htmldoc with args: --webpage --quiet --links --linkstyle plain --outfile /var/lib/foswiki/working/tmp/GenPDFAddOnFbY9C0uLP4.pdf --format pdf14 --portrait --size a4 --path /var/lib/foswiki/working/tmp --browserwidth 860 --titlefile /var/lib/foswiki/working/tmp/GenPDFAddOn7aVWClQBOP.html --toclevels 5 --tocheader ... --tocfooter ..i --firstpage toc --toctitle INDICE --logoimage http://www-linuxprev/foswiki/pub/System/ProjectLogos/foswiki-logo.gif --headfootfont helvetica-bold --top 0.5cm --bottom 0.5cm --left 2.0cm --right 1.0cm --pagelayout single --pagemode outline /var/lib/foswiki/working/tmp/GenPDFAddOnYBoPD7oEWO.html |
| 2012-08-13T17:27:04Z debug | GenPDF - htmldoc exited with 0 |
If I run
htmldoc
by hand I have the same pdf (
/var/lib/foswiki/working/tmp/GenPDFAddOnFbY9C0uLP4.pdf
) with the same error.
htmldoc --webpage --quiet --links --linkstyle plain --outfile /var/lib/foswiki/working/tmp/GenPDFAddOnFbY9C0uLP4.pdf --format pdf14 --portrait --size a4 --path /var/lib/foswiki/working/tmp --browserwidth 860 --titlefile /var/lib/foswiki/working/tmp/GenPDFAddOn7aVWClQBOP.html --toclevels 5 --tocheader ... --tocfooter ..i --firstpage toc --toctitle INDICE --logoimage http://www-linuxprev/foswiki/pub/System/ProjectLogos/foswiki-logo.gif --headfootfont helvetica-bold --top 0.5cm --bottom 0.5cm --left 2.0cm --right 1.0cm --pagelayout single --pagemode outline /var/lib/foswiki/working/tmp/GenPDFAddOnYBoPD7oEWO.html
--
JarbasJunior - 13 Aug 2012