I'm replying to my own question. Instead of passing an array I have switched to passing all the strings individually instead. The widget is working better now but the output PDF extent is about a mile or two south of what I am viewing in flex. Any insight would be appreciated.In flex:
<esri:Geoprocessor
id="gp"
jobComplete="openPDF(event)"
url="http://arcgis.allconet.org/ArcGIS/rest/services/PermitDashboard/GPServer/PrintToScale"
showBusyCursor="true"/>
public var urlPDF:String = "http://arcgis.allconet.org/PrintToScalePDF/Print_Output.pdf";
private function submit():void
{
var params:Object = {inMinX:map.extent.xmin.toString(), inMinY:map.extent.ymin.toString(), inMaxX:map.extent.xmax.toString(), inMaxY:map.extent.ymax.toString(), inScale:txtScale.text};
gp.submitJob(params);
}
private function openPDF(event:GeoprocessorEvent):void
{
var urlRequest:URLRequest = new URLRequest(urlPDF);
navigateToURL(urlRequest);
And in Python:
import arcgisscripting
import os
# Import arcpy module
import arcpy
from arcpy import env
# Set active MXD, Data Frame, and Layer
mxd = arcpy.mapping.MapDocument(r"D:\AGIS_MXDs\PermitPrintToScale.mxd")
df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]
# Script arguments
minX = arcpy.GetParameterAsText(0)
if minX == '#' or not minX:
minX = 727834
minY = arcpy.GetParameterAsText(1)
if minY == '#' or not minY:
minY = 649034
maxX = arcpy.GetParameterAsText(2)
if maxX == '#' or not maxX:
maxX = 938634
maxY = arcpy.GetParameterAsText(3)
if maxY == '#' or not maxY:
maxY = 754900
mapScale = arcpy.GetParameterAsText(4)
if mapScale == '#' or not mapScale:
mapScale = 100
# Set Data Frame to the extents passed from Flex
newExtent = df.extent
newExtent.XMin, newExtent.YMin = float(minX), float(minY)
newExtent.XMax, newExtent.YMax = float(maxX), float(maxY)
df.extent = newExtent
# Set scale of the Data Frame to the value passed from flex
# Multiply by 12 to adjust to geographic scale
df.scale = float(mapScale) * 12
# Print to PDF
arcpy.mapping.ExportToPDF(mxd, r"C:\Inetpub\wwwroot\PrintToScalePDF\Print_Output.pdf")
I'm still interested in being able to pass an array to python if possible. Also, the performance of the above code leaves something to be desired. It takes about five minutes to get the PDF.GregAllegany County, MD GIS