Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I embed Google Map (or other GIS mapping) output in a PDF as I generate it?

Tags:

php

pdf

gis

I need to generate PDF documents server-side that include a map, with markers and the like, but to my knowledge this isn't possible with Google Maps because of JavaScript reliance.

Is there some way to use the Google Maps API for this, or is there some other free (or cheap) alternative with this capability and comparable functionality?

like image 625
Trevor Bramble Avatar asked Mar 02 '09 19:03

Trevor Bramble


2 Answers

what you can do is to use google maps static api to generate an image: http://code.google.com/apis/maps/documentation/staticmaps/

and then import that image into pdf.

like image 173
dusoft Avatar answered Sep 30 '22 16:09

dusoft


Extension to dusoft's answer. You can load the image with Imagick and

$im = new Imagick("image.jpg");
$im->setImageFormat("pdf");
$im->writeImage("image.pdf");
like image 37
Ólafur Waage Avatar answered Sep 30 '22 16:09

Ólafur Waage