VDS Technologies

 

Print Settings for Map

6/27/2014 10:31:23 AM
Total Posts 14

Print Settings for Map

Hi, I'm struggling to find documentation on the Javascript API function: map.print().

 

I need to be able to set a setting "fit to page" when a user wants to print the map. Currently, if a user wants to print the map portrait, the map itself runs off the page and only fits on landscape.

 

I've looked into the Print dialog's settings for Chrome and IE, and there doesn't seem to be a "fit to page" option, is this something that is/can be part of AspMap?

 

​Thanks.

6/27/2014 11:05:13 AM
MVP
Total Posts 323

Re: Print Settings for Map

There is a topic about printing in the documenation (Mapping Basics/Printing a Map).
Try to use the map.printPageArea method (AspMap 4.8.4) and see the PrintPageArea.aspx sample in the standard samples.
To fit the map image into a desired page format (A4 etc.) you have to adjust the width/height of the map proportionally the width/height of the selected page format(plus page orientation). The PrintPageArea.aspx demonstrates how to do this. A "fit to page" setting is a setting of the system print dialog box. AspMap just copies the contents of the map/page area into a hidden IFrame and calls the JavaScript print() method of the frame. There is no other functionality for printing in JavaScript.