[Chameleon] Re: can't Print in 24bit with a transparent scalebar
Maciej Sieczka
tutey at o2.pl
Fri Sep 7 21:49:27 EDT 2007
Maciej Sieczka wrote:
> Hi
>
> Can someone tell what bug the line 677 of
> widgets/PrintProduction/preview.php:
>
> //TODO: fix me when pasteImage is fixed (bug 463)
>
> refers to? I could not find a relevant bug report "466" in Chameleon or
> Mapsever trackers.
>
> I was hoping this bug report could maybe shed some light on my problem.
> The problem is that I can't display a transparent scalebar in the
> Printer Friendly Map preview nor in the final output.
>
>
> The scalebar is defined as:
>
> SCALEBAR
> BACKGROUNDCOLOR 255 255 255
> COLOR 0 0 0
> OUTLINECOLOR 0 0 0
> LABEL
> COLOR 0 0 0
> SIZE SMALL
> END
> SIZE 150 5
> UNITS kilometers
> INTERVALS 5
> STATUS ON
> TRANSPARENT TRUE
> END
>
>
> Now, when the output type is defined as:
>
> IMAGETYPE png
>
> OUTPUTFORMAT
> NAME png
> DRIVER "GD/PNG"
> MIMETYPE "image/png"
> IMAGEMODE RGBA
> TRANSPARENT ON
> EXTENSION "png"
> END
>
> on the map display everything looks fine - rasters are displayed in
> 24bit, scalebar is transparent. However, in the Print tool preview and
> output, the scalebar is not transparent; see the attached
> bar_opaq_24b.png print preview screenshot. Actually it's always opaq
> white, matter if/what IMAGECOLOR I set and if TRANSPARENT is
> TRUE/FALSE. Although manipulating these values affects the map display
> as expected.
>
>
> When I change the output type into:
>
> IMAGETYPE PNG24
> TRANSPARENT TRUE
>
> again, on the map display everything looks fine - rasters are displayed
> in 24bit, scalebar is transparent. In the Print tool output now the
> scalebar is also transparent - great, but rasters are reduced to 8bit
> (see the attached bar_trans_8b.png print preview screenshot).
>
> How can I have both - 24bit Print output and a transparent scalebar on it?
My original post didn't make it here due to huge attachments (sorry!),
but in the meantime I have found a solution. In
PrintProduction/preview.php change line 647:
$oScalebar->set("transparent",MS_TRUE);
to:
$oScalebar->set("transparent",MS_FALSE);
With this change, setting SCALEBAR's IMAGECOLOR to 255 255 255 makes it
transparent. Other colors work as expected. Good. It is also consistent
with BACKGROUNDCOLOR behaviour now.
BTW - for PrintProduction widget to work I had to change line 252 in
preview.php from:
$image = pdf_open_image_file($pdf, "png", $szTmpImage);
to:
$image = pdf_open_image_file($pdf, "png", $szTmpImage, "", 0);
Without this, trying to print to PDF it returns an error:
"Fatal error: Uncaught exception 'PDFlibException' with message
'pdf_open_image_file() expects exactly 5 parameters, 3 given' (...)"
Maciek
P.S.
Using Chameleon 2.4.1, Mapserver 4.10.2, PHP 5.1.2, PDFlib Lite 7.0.1,
pdflib 2.1.3.
More information about the Chameleon
mailing list