[Chameleon] RE: pdfMap

Sears, Jeremy Jeremy.Sears at CCRS.NRCan.gc.ca
Thu Mar 16 16:09:32 EST 2006


Hi Dejan,
>>Why should I use the scale anyway? 
The scale array is used to scale the objects that get painted to your pdf
template by phppdflib. I included it in the code to help fit the images
generated by mapserver into the pdf. you can set the x and y values of the
array to 1 and 1 for no scaling, or as you indicated, just ignore the
scaling.
 
>>One more question - did you maybe try to place the legend in the pdf?
No I havent tried that. The maps that we plan to serve will have a standard
legend, so our legend has been 'hardwired' into the template. However, I
think it would be totally possible to create the legend and place it on the
pdf... It seems to me that the printproduction widget does that (I dont
remember exactly). If so, you could take a look at that code and attempt to
integrate it into the pdfMap.phtml code. Otherwise, I think that it would
more or less be a matter of tracking down the graphic elements that make up
the legend and assembling them into a legend to be painted to the pdf. 
I hope that helps.
 
Jeremy

-----Original Message-----
From: Dejan Gambin [mailto:dejan.gambin at pula.hr]
Sent: March 16, 2006 3:42 PM
To: 'Sears, Jeremy'
Cc: chameleon at lists.maptools.org
Subject: RE: pdfMap


Thanks Jeremy,
 
I forgot to send the copy to the list, now I corrected this :-)) I have
uncommented the piece of code and now I properly place my map. Regarding the
rectangle, the problem was in using $p in $placement =
$pdf->image_place($image, 50, 0, $pages[0], $p); because of the scale array.
If I don't set $p in image_place then rectangle is placed correctly arround
the map. Why should I use the scale anyway? 
 
One more question - did you maybe try to place the legend in the pdf?
 
regards, dejan

-----Original Message-----
From: Sears, Jeremy [mailto:Jeremy.Sears at CCRS.NRCan.gc.ca] 
Sent: Thursday, March 16, 2006 3:37 PM
To: 'Gambin Dejan'
Subject: RE: pdfMap


Hi Dejan,
Glad to hear you got the 'widget' working.
 
Regarding placement ....
In pdfmap.phtml, around line 174 you should see code that looks exactly
like:
 
****************************************************************************
***************************
 // littl' loop to help determine image placement
 // creates an 'indexgrid' on the pdf. Allows one to adjust pdf element
placement
/*
$pf["height"] = 1.5;
$pf["width"] = 0.125; 
 
for ($x=-100; $x <=1000; $x=$x + 10){
 for ($y=-100; $y <= 1000; $y=$y+10){
   $pdf->draw_text($x, $y, '*'.$x.','.$y, $pages[0], $pf);
   }
 }
*/
****************************************************************************
*****************************
 
If you uncomment this, you will get somthing of a fine graticule. You output
pdf will have many small *'s, each * will have coordinate values next to it.
Use these numbers to help you place you images and such.
 
>> If I want to draw a rectangle around the map, what do I have to do?
You'll have to counsult the phppdflib manual at
http://www.potentialtech.com/ppl.php <http://www.potentialtech.com/ppl.php>
Im guessing you are on the right track with the draw_rectangle() function.
The template we are using contains all map elements not generated by the
mapserver, including a rectangle around the maparea, I have not had to
consider such a task. However Im thinking that after uncommenting the above
mentioned code you should have a better idea of what values should be placed
in draw_rectangle().
 
Best Regards
Jeremy
 
 

-----Original Message-----
From: Gambin Dejan [mailto:Dejan.Gambin at pula.hr]
Sent: March 16, 2006 9:01 AM
To: Sears, Jeremy
Subject: RE: pdfMap


Hi Jeremy,
 
Now we can do our own template using your insctructions. Thanks very much.
Can you answer me something:
 
1. When using image_place function - what are the coordinates relative to?
If I set (0,0) it is not placed on the border of the page...
2. If I want to draw a rectangle around the map, what do I have to do? I
have tried using "$pdf->draw_rectangle(0, 0, 375, 500, $pages[0], $p);" but
the rectangle is wider and higher than map...(I have
$map->set(width,500);$map->set(height,375);)?
 
thanks
 
dejan


-----Original Message-----
From: Sears, Jeremy [mailto:Jeremy.Sears at CCRS.NRCan.gc.ca] 
Sent: Wednesday, March 15, 2006 4:00 PM
To: Gambin Dejan
Subject: RE: pdfMap


Hi Dejan,
OK, The original format of this document didnt work with my application
either. After preforming the steps mentioned below, the pdf now works with
my application. Im running: Appache2, winxp, php4.4.3-dev, mapserver4.6
(basically the latest ms4w). I wonder if php5.0.4 is having problems with
the code? Your chameleon application works ok with version 5.0.4 of php? I
had some problems trying to get chameleon to work with the latest php...
 
The conversion steps again:
Using Adobe Acrobat 7.0 pro (version7.0.7)  I ..
1. opened your document
2. Saved as a tiff (see the attached bmp image for tiff settings)
3. Opened the tiff in acrobat
4. saved as pdf
 
If this document doesnt work in your application, I would suspect that
something, somewhere isnt compatable, ... but Im not sure where.
Let me know if this work on your system.
 
Jeremy
 
 

-----Original Message-----
From: Gambin Dejan [mailto:Dejan.Gambin at pula.hr]
Sent: March 15, 2006 9:40 AM
To: Sears, Jeremy
Subject: RE: pdfMap


Hi Jeremy,
 
Why not here I send you my "sample and simple" pdf template. By the way I am
using mapserver 4.6, chameleon 2.2 (i think), Windows XP, Apache2, php 5.0.4
on my own testing machine...
 
thanks very much, and I'll try your suggestions 
 
dejan

-----Original Message-----
From: Sears, Jeremy [mailto:Jeremy.Sears at CCRS.NRCan.gc.ca] 
Sent: Wednesday, March 15, 2006 3:27 PM
To: Gambin Dejan
Subject: RE: pdfMap


Hi Dejan,
Our media people created a complex template for our mapserver application.
It was created in quark and didnt work with the pdfmap 'widget'. What I did
was open the document in acrobat, then saved as a high resolution .tiff in
the simplest format,.. I believe one of the settings of note was the
conversion-> color space option, I set this to 'color:RGB', also all of the
color management settings were 'off'... I then brought the .tiff back into
acrobat, and saved as pdf. It took me a wile to get a pdf that worked. 
 
If you cant get a format that works, why dont you send me you pdf template,
pre-conversion. Ill see if I can convert it and Ill send it back to you. It
would be helpful to know how you created the template and in what software.
I think I should include this information in the readme so others will be
better suited to deal with this issue. By the way, what are the specs of the
mapserver application( webserver, php version, OS, mapserver version,
chameleon version etc..)  that you are using the pdfmap 'widget' with? 
 
Best Regards
Jeremy

-----Original Message-----
From: Gambin Dejan [mailto:Dejan.Gambin at pula.hr]
Sent: March 15, 2006 8:32 AM
To: Sears, Jeremy
Subject: RE: pdfMap


Thanks Jeremy,
 
Unfortunatelly nothing helps too much. I have tried many thing with
generating images and then back to pdf but then I get another error "there
was a problem reading this document (16)". The only thing that works is when
creating empty word document, exporting to pdf (with adobe acrobat), then to
jpg and back to pdf. But I didn't want an empty template :-((
 
I will try something else but have no idea ay more...I have read aodbe
document regarding the "unrecognized token" error and tried some things but
the result is the same :-((
 
anyway, thanks very much
 
dejan
 

-----Original Message-----
From: Sears, Jeremy [mailto:Jeremy.Sears at CCRS.NRCan.gc.ca] 
Sent: Tuesday, March 14, 2006 4:14 PM
To: Gambin Dejan
Subject: RE: pdfMap


Hi Dejan,
Ill do my best to address your questions....
 
>>why am I getting "unrecognized token 'STRIPPED' was found" 
I agree with your assumption that this error has to do with your pdf file
format. I have not encountered this particular error before, but have had
some toruble getting the phppdflib to work with complex pdf files, such as
those that contain various types of fonts and graphics. Ive found that the
pdfMap 'widget' works best with a pdf template that is all image data, no
fonts or fancy stuff. So, perhaps you could try to 1. create your template.
2. export the pdf template to a high quality image file. 3. convert the
image file back into pdf. . . This is a bit convoluted, but it does seem to
work. I havent used open office for this before.
 
>>because of problem with IE and PNG transparency
Trash IE,.. use Firefox    ;)
 
 
>> I have set my scalebar image to be GIF. I have tried using
imagecreatefromgif instead of imagecreatefrompng PHP function but I get that
the file is not a >>valid image file, although it exists on the right
location and it seems to be valid...
Im not sure about that ... I recommend you consult the documentation on GD
and Mapserver. Perhaps the gif format that mapserver creates is incompatable
with GD, however that would be strange because I think Mapserver uses GD to
create its gif's.... perhaps you're not using imagecreatefrompng correctly
or perhaps there are some more arguments to that function that you need to
specify?
 
Jeremy
 
 
 

-----Original Message-----
From: Gambin Dejan [mailto:Dejan.Gambin at pula.hr]
Sent: March 14, 2006 9:57 AM
To: Sears, Jeremy
Subject: RE: pdfMap


Hi Jeremy,
 
Can you plase tell me, if you know, why am I getting "unrecognized token
'STRIPPED' was found" error when trying to use my own pdf template file. I
have first created a blank pdf file using OpenOffice, then I tried with
another PDF creation software but the result is the same? I suppose this has
to do with phppdflib library? I am not getting this error with your template
file...
 
Also, because of problem with IE and PNG transparency, I have set my
scalebar image to be GIF. I have tried using imagecreatefromgif instead of
imagecreatefrompng PHP function but I get that the file is not a valid image
file, although it exists on the right location and it seems to be valid...
 
regards, dejan

-----Original Message-----
From: Sears, Jeremy [mailto:Jeremy.Sears at CCRS.NRCan.gc.ca] 
Sent: Friday, February 17, 2006 3:35 PM
To: Gambin Dejan
Subject: RE: pdfMap


Hi,
Here's a copy of the required files. Check out the readme file for a breif
description. Note that this 'widget' was developed on Ms4W (Winxp, PHP
4.4.3, Apache2x). You must have chameleon up and running as well. Please let
me know if it does (or does not) work for you.
 
Best Regards
Jeremy

-----Original Message-----
From: Gambin Dejan [mailto:Dejan.Gambin at pula.hr]
Sent: February 17, 2006 2:57 AM
To: Sears, Jeremy
Subject: pdfMap


I am interested in your widget...
 
thanks 
 
dejan

-----Original Message-----
From: chameleon-bounces at lists.maptools.org
[mailto:chameleon-bounces at lists.maptools.org] On Behalf Of Sears, Jeremy
Sent: Friday, February 10, 2006 6:49 PM
To: chameleon at lists.maptools.org
Subject: [Chameleon] print direct to PDF widget



Hi All,

Id like to like the list know that I have pieced together a 'widget' for
chameleon that allows one to print a map directly to a PDF template. 

The 'widget' employs functions from the phppdflib library to create the PDF
map. I chose to use phppdflib instead of the standard pdflib because
phppdflib is free and has the ability to import pdf's (i.e. the template),
you must pay for this functionality in pdflib. One simply inserts their map
template and plays with map element placement properties in order to use it.

 

I hesitate to call this bit of code a widget as I don't think it meets all
of the requirements that the name implies. In order to use it there are a
few conditions that must be met in one's Mapserver app and one's code.
However, I've found it to work great within our application.

I would very much like other's to try it, use it if suitable, give me some
feedback and ideally improve on it. There is much room for improvement.

 

If anyone is interested they can send mail to me at jsears(at)nrcan.gc.ca
<mailto:jsears at nrcan.gc.ca>  (please put pdfMap in the subject heading) and
Ill send a copy of the 'widget'. 

 

Regards,

Jeremy

 

  

phppdflib can be found : http://www.potentialtech.com/ppl.php
<http://www.potentialtech.com/ppl.php> 

 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/chameleon/attachments/20060316/389faf0c/attachment-0001.html


More information about the Chameleon mailing list