Select to view content in your preferred language

Problem with Export Map to PDF code

516
2
01-21-2011 07:38 AM
francescodi_vito
Deactivated User
Hi guys,
i have write a script for export Map of my web personal application. The code is

<mx:Script>
  <![CDATA[
   public function PrintPDFx():void
   {
    var sURL:String;
    sURL = "http://193.204.163.134/ArcGIS/rest/services/Roma/Carg_Roma/MapServer/export";
    sURL = "?bbox="+myMap.extent.xmin+","+myMap.extent.ymin+","+myMap.extent.xmax+","+myMap.extent.ymax; 
    //sURL+="&layers=";
    sURL+="&size="+myMap.width+","+myMap.height;
    sURL+="&format=pdf";
    sURL+="&trasparent=false";
    //sURL+="&dpi";
    sURL+="&f=image";
    sURL+="&width"+myMap.width;
    sURL+="&height"+myMap.height;
    navigateToURL(new URLRequest(sURL),'_blank');
   }
  ]]>

but i have a problem. When i click the button on my web application, opens a new website but not pdf with the service I set it to print.
Why? My script is wrong?
Thanks
Tags (2)
0 Kudos
2 Replies
Drew
by
Frequent Contributor
You have a small error  when building your string.

add a + sign in your second line..
It should look like so.

[code
sURL += "?bbox="+myMap.extent.xmin+","+myMap.extent.ymin+" ,"+myMap.extent.xmax+","+myMap.extent.ymax;


Drew
0 Kudos
francescodi_vito
Deactivated User
You have a small error  when building your string.

add a + sign in your second line..
It should look like so.

[code
sURL += "?bbox="+myMap.extent.xmin+","+myMap.extent.ymin+" ,"+myMap.extent.xmax+","+myMap.extent.ymax;


Drew


Thanks you are right
0 Kudos