[Mapserver-users] PHP/mapscript - Inserting vector maps into PDF documents
Zak James
zak-ms at aiya.dhs.org
Thu Jan 30 13:42:52 PST 2003
In the 3.7 branch, the DrawMapPDF() function has been removed in favour
of integrating PDF output into the new OUTPUTFORMAT system
(http://mapserver.gis.umn.edu/cgi-bin/wiki.pl?OutputFormat) which is
supported from mapscript. In 3.6.x, the pdf rendering is done by custom
functions - like DrawMapPDF(), so there isn't any support for them in
the mapscript bindings.
I agree that more control over the PDF rendering is needed and should
be handled using the FORMATOPTION field, so that mapscript doesn't have
to be modified to take advantage of it. As an example, the 3.7 flash
support uses this approach. I am hoping to add pdf plot resolution
control through this mechanism, but it would also be possible to
control rendering size and position, or allow the use of pdf template
files.
I'm not sure if my changes will make the 3.7 release.
zj
On Tuesday, January 28, 2003, at 11:43 pm, Antti.Roppola at brs.gov.au
wrote:
> Hi all,
>
> Around this time last year, there was some discussion on the Mapserver
> list about
> how you'd go about including Mapserver elements in arbitrary places on
> a PDF being
> created in PHP/Mapscript.
>
> http://mapserver.gis.umn.edu/data2/wilma/mapserver-users/0202/
> msg00240.html
> http://mapserver.gis.umn.edu/data2/wilma/mapserver-users/0202/
> msg00239.html
>
> I've just spent quite a while browsing the mappdf source and there's a
> DrawMapPDF() function
> that skips the creation of a new PDF object if an existing one is
> given as an argument,
> but I can't find a hook into it through PHP/Mapscript. Nor can I see
> anything in this function that
> would allow me to control the placement of the map in my pdf object. I
> guess I'd really like an
> outputformat that returns PDF instructions rather than a whole
> document, this way I could
> use pdf_translate() and pdf_scale() to do the placement myself:
>
>
> $map->selectOuputFormat("pdf_instructions"); // as opposed to a
> complete PDF doc
>
> $pdf_instructions=$map->draw();
> place($my_pdf, $pdf_instructions, $pos_xmin, $pos_ymin, $pos_xmax,
> $pos_ymax, $angle);
>
> function place ($my_pdf, $pdf_elements, $pos_ymin, $pos_xmax,
> $pos_ymax, $angle) {
> pdf_save($my_pdf); // save default state
> if($angle) {
> pdf_rotate($my_pdf, $angle)
> }
> pdf_translate($my_pdf, $pos_xmin, $pos_ymin);
> ... // stuff happens to calc scaling
> pdf_scale($my_pdf, $pos_dx, $pos_dy );
> include $pdf_elements; // you get the idea...
> pdf_restore($my_pdf); // restore default state
> }
>
>
>
> Has anyone got any insights on where things are at?
>
> Cheers,
>
> Antti
> N.B. I do have all the other PDF functionality such as 3.7
> outputformat working, I just
> want to be able to write my map objects into an existing PDF as
> vectors.
>
> _______________________________________________
> Mapserver-users mailing list
> Mapserver-users at lists.gis.umn.edu
> http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
>
More information about the MapServer-users
mailing list