Generate PDF on the server from Google Maps API?

你说的曾经没有我的故事 提交于 2019-12-04 09:08:45

As Mark Storer pointed out, you can use wkhtmltopdf.

If you have polylines or other stuff in your map you will likely need wkhtmltopdf to wait for all the pieces to be in place before generating the PDF. This can be done with the latest version 0.10.0_rc2 and with the --window-status parameter (javascript in your target page will have to update the window.status variable once everything is ready).

Check out the manual here

An example usage goes like this:

wkhtmltopdf.exe --page-size A4 --dpi 600 --window-status ready --print-media-type http://www.yoursite.com/target.html target.pdf

Cons: the whole process is a bit overkill in terms of resources, so if your webapp gets plenty of hits you may want to pay close attention to this aspect.

Once you work out all the legal details, I recommend looking at wkthmltopdf. It will accurately evaluate the page's JavaScript, critical to any Google Map web page.

You will need a Premier license with Google otherwise you will be breaking the Terms of Service

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!