1
votes

I need to insert an image with several links into a Google Doc via Google Apps Script. The image is a basic map, created in HTML5, with several hotspots. If displaying this image via my existing application, I would export the image to SVG and use SVG's native hyperlinking. Otherwise I can generate a PNG of the diagram and a map and area tags for the links. For my google apps script, I have no problem in pulling in a PNG of the image and inserting it, but I have no way of adding my link maps. I also cannot find a way to import an SVG (as a Google Drawing) which can be placed inline of the document. Here are the things that I would do to solve this, but I am missing critical pieces of each one, any help on any of the three problems would be greatly appreciated:

  1. Generate an SVG of the image and insert it into the Google Doc Problem: Google Doc does not accept SVG. Is there a way to make the Doc accept the SVG or is there a converter that will take my SVG and return a Google Drawing that can be inserted?

  2. Generate a PNG and insert that into the Google Doc. Problem: No links. Is there a way to define a link map in Google Doc via Google Apps Script?

  3. Insert an HTML5 Canvas Problem: not possible in Google Docs

2

2 Answers

3
votes

Google Docs doesn't support images with hyperlinked sections, therefore Apps Script doesn't either. You can set a link for an entire image using InlineImage.setLinkUrl().

0
votes

Google Drawings looks like a no as well. I'm not sure how complex your map is but could you maybe break it into smaller images and link each image separately? I understand its not exactly what you were looking for but maybe an option?