[mapserver-users] PDF Output: How?

Paul Ramsey pramsey at refractions.net
Sat Feb 16 17:13:18 PST 2002



Daniel Morissette wrote:
> 
> Paul Ramsey wrote:
> >
> > (b) In terms of implementation of PDF support in PHP/Mapscript, my
> > recommendation would be this:
> >
> > (1) that the existing PDF support in PHP be examined, and depended on,
> > so that to create PDF version of a map you would first create a standard
> > PHP PDF object, then pass that object to the mapscript PDF writing
> > function.
> 
> Taking advantage of the existing PDF module in PHP would be great, and
> we've been thinking about doing the same with GD to use the PHP GD
> module to add annotations on top of a MapScript imageObj.
> 
> The problem is that the PHP GD and PDF modules are separate modules and
> we don't have any control on them, each module uses its own data
> structures internally and I never saw anything in PHP that allowed
> modules to share resources even if they share the same C data structures
> at the lower level (a PDF or GD handle is a resource in PHP).

I just had a quick read through the pdf module. The
zend_get_parameters_ex() and ZEND_FETCH_RESOURCE() functions look pretty
agnostic regarding what modules they are called from. The PDF module
seems to use the Zend resource list to store its document object, but
the document object it is using is not a custom structure, it is the
usual PDFlib PDF struct, same one as the mappdf.c file uses.

There sure seems to be alot of voodoo surrounding the Zend stuff. Just
wave your magic wand. I am a babe in the woods. Is that Zend stuff
subject to a pre-processor or something? It does not look syntactically
correct as it stands.

> This would be a nice thing to research (when time permits), but I'm
> suspecting that we would have to build some kind of bridge to export an
> imageObj into a PHP GD image object and vice-versa... 

I think that if the decision is made to bind into the other modules, it
would be wise to give up all responsibility for instantiating and
destroying objects. Take the reference created by the other module and
use that. That way the bridge only has to be one way. Hopefully GD is as
simpleminded as PDF in terms of just dumping the standard structure
reference into Zend's object store.

> and that we would
> have to maintain this bridge for every release of PHP... that's the main
> reason why we didn't do it yet: it's already hard enough to maintain the
> PHP module compatible between PHP versions without this kind of
> dependencies with external modules.
> 
> BTW, I have created a bug in bugzilla about this... may I suggest that
> you both file your conclusions and suggestions in the bug report so that
> we have access to all the information if/when we work on this:
>  http://mapserver.gis.umn.edu/bugs/show_bug.cgi?id=110

Willdo.

P.


-- 
      __
     /
     | Paul Ramsey
     | Refractions Research
     | Email: pramsey at refractions.net
     | Phone: (250) 885-0632
     \_



More information about the MapServer-users mailing list