[Mapserver-users] PHP/mapscript - Inserting vector maps into PDF documents
Antti.Roppola at brs.gov.au
Antti.Roppola at brs.gov.au
Tue Jan 28 20:43:32 PST 2003
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.
More information about the MapServer-users
mailing list