This site uses cookies for better user experience. To use HTML PDF API, you must agree to our Privacy policy, including Cookie policy.
You can easily add google maps in your HTML to PDF exports by using Google Static Maps API and create rich and beautiful reports.
Google Static Maps works without javascript and it will generate an image for a given URL. You can embed this image by simply using <img>
tag in your HTML file which you wich to convert to PDF.
There are also various options in Google Static Maps API which you can customize, for example:
You can find full documentation in the following url:
https://developers.google.com/maps/documentation/staticmaps/
Google Static Maps API terms of service:
"If a Static Maps API image is used outside of a web-based application (such as a browser) then a link must be included pointing to the displayed location in a web browser or native Google Maps application."
https://maps.google.com/maps/api/staticmap?center=51.502312,-0.122608&zoom=11&size=640x300
Following tools will help you create a Google Static Map URL:
<!DOCTYPE html>
<html>
<head>
<title>Export Google Map to PDF with HTML PDF API</title>
</head>
<body>
<img src="https://maps.google.com/maps/api/staticmap?center=51.502312,-0.122608&zoom=11&size=640x300" />
<!-- Link for Google terms of service -->
<div>
<small>
<a href="https://maps.google.com/maps/api/staticmap?center=51.502312,-0.122608&zoom=11&size=640x300">
https://maps.google.com/maps/api/staticmap?center=51.502312,-0.122608&zoom=11&size=640x300
</a>
</small>
</div>
<!-- Link for Google terms of service -->
</body>
</html>
You can learn how to send HTML file to our API in usage and documentation section.
Here is a more complex example of using Google Maps with HTML PDF API.
Download (ZIP)
Compressed (zipped) folder containing:
index.html
Download (PDF)
Generated PDF from HTML/CSS