This discussion is archived
1 Reply Latest reply: Sep 19, 2012 12:50 AM by grueningd RSS

Native oraclemaps printing issue

grueningd Newbie
Currently Being Moderated
Hi,

when using native oraclemaps print() function there is a poor effect:

Before printing, customers want to see what the maps printput will look like to set up the page accordingly. Therefore customers go to the browsers print preview. Before one has triggered the mapview.print() function the div which is holding the printable map isnt filled. So when you go to printpreview you will only the an emtpy page. Once you have triggered the print function you can see the print output in the browser print preview.

Question: Is there a way to trigger mapviewer to fill the div which is holding the print map before one is printing the map?

When looking at mapviewer sample for mapprinting you will discover that the div holding the origin map hasn't got the css class "noprint". Therefore one can see this map in the printpreview but that is not the map that will be printed out later on. You can check the behaviour be the follwoing customized mapviewer print sample:
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>Map Cache Server/Map Client</TITLE>
<link rel="stylesheet" type="text/css" href="../t.css" />
<style type="text/css">
@media screen
{
  .noscreen {display: none;}
}

@media print
{
  .noprint{display: none;}
}
</style>

<script language="Javascript" src="/mapviewer/fsmc/jslib/oraclemaps.js"></script>
<script language=javascript>
  var mapview;
  var baseURL  = "http://"+document.location.host+"/mapviewer";
  
  function showMap()
  { 
    var mapCenterLon = -122.45;
    var mapCenterLat =  37.6706;
    var mapZoom      =  4;  
    mapview = new MVMapView(document.getElementById("map"), baseURL);
    mapview.addMapTileLayer(new MVMapTileLayer("mvdemo.demo_map"));
    var center=MVSdoGeometry.createPoint(mapCenterLon, mapCenterLat,8307)
    mapview.setCenter(center);   
    mapview.setZoomLevel(mapZoom);
    mapview.display();
  }

  function mapPrint()
  {
    var a=document.getElementById("printmap");
    mapview.print(a);
  }
</script>
    
</head>

<body onload=javascript:showMap()>
<h3>Oracle Maps example - map printing function</h3>
  <div id="map" class="noprint" style="position:absolute;top:50px; left:10px; width:600px; height:450px;border:0px"></div>   
  <div id="printmap" class="noscreen"></div>
  <div id="navigation" style="position:absolute;left:650px;top:50px;width:35%" class="noprint">
    <p>Please click <a href="javascript:mapPrint()">here</a> to print map</p>
  </div>

<div style="position:absolute;top:550px; left:10px;width:98%" class="noprint"></div>

</body>

</html>
For some reason the
 option removes the some style information from the html above. Nevertheless... the only important thing to see the effect is to set the css class to "noprint" for the map div

Edited by: grueningd on Aug 1, 2012 2:38 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points