Select to view content in your preferred language

Advanced print solution

52081
296
02-19-2011 10:52 AM
TomSchuller
Frequent Contributor
Please find in the codegallery my first version of an advanced print solution:
http://www.arcgis.com/home/item.html?id=6809086326ea4c76bf026a32bb9dd698

The backend is developed in Java as a ServerObjectExtension: PChPrintSOE

The communication to the SOE is realized by the REST.
So, any client can be used Flex, Javascript, ...
I just created a simple FlexWidget.

Some features:
- full print over the rest api (usable by any client)
- export to pdf,jpeg,png,emf and mxd!
- view paper layout extent live on map
- make print on a "template" mapservice by keeping the predefined layout
- multi-mapservices/multi-server support
- add graphics on the map view positioned in map units
- add elements on the layout view positioned in paper units like scalebar, scaletext


The code is under full development:
- support for wms layer
- code clean up and reorganization

Any suggestions, remarques or help is welcome.

Live demo with public Esri mapservices (last print button):
http://gis.pch.etat.lu/flexViewerPrint/
   - use this print widget with your PChPrintSOE-enabled mapservices for high quality
   - draw first some graphics with the DrawWidget prior making your print (in mxd format)
Tags (2)
0 Kudos
296 Replies
EricVenden
Frequent Contributor
Thanks much Tom - I will post the url from the FlashBuilder.    I have changed a couple lines (360 & 361) to account for using inches and feet - at least I believe this is where I should change this.  I also change the PchPrintOutput.as file at line 19 so that the pageUnits are =1 (inches)....the red box that shows the print area now appears to reflect the proper selected scale...the output on the pdf is incorrect.  If I pick 1:2400 (1 in = 200 ft), the output scale is 1:7874.
0 Kudos
EricVenden
Frequent Contributor
Tom,
I cannot get the print to work in debug mode....I do not have Flash Builder and AGIS Server on the same box...so this may be the issue....
Could I use Fiddler running on Firefox?  I will attempt to do so.

Thanks
Eric
0 Kudos
EricVenden
Frequent Contributor
Tom,
Attached is a screenshot of what Fiddler captured.

Last 3 lines....
Thanks
Eric
0 Kudos
TomSchuller
Frequent Contributor
Eric,
the line 359 is the right line.
Could you post the complete url with all the params?

You find it by selecting in fiddler the line and look under "inpectors->Raw" or similar.

Tom
0 Kudos
EricVenden
Frequent Contributor
Tom,
Thank you for your assistance.  Attached is a text file of the details from Fiddler for the PchPrintSOE call.

Eric
0 Kudos
DavidCaussin
Deactivated User
Hi Tom,

Everything works fine now.

but i receive e error when the pdf is to be open in the navigator.

It is the

Server Error
500 - Internal server error.

The pdf is well generate in the arcgisoutput and readable on the server but not throw IE 😞

any idea??

Thanks a lot

David


Tom,

The URL gived by the JSON url is

outputFile: http://swarcgis001/arcgisoutput/PrintTask_layout_1302766588558_layout.pdf

and it is the good location for the pdf

When i put it in a browser i obtain the error 500....

I work on windows
with arcgisserver .NET

the URL's are

http://swarcgis001/ArcGIS/rest/services/layout/MapServer/exts/PCHPrintSOE/printLayout?mapExtent={"xmin":145475,"ymin":165195.4174075015,"xmax":155475,"ymax":179545.4174075015,"spatialReference":{"wkt":"PROJCS[\"Belge_Lambert_1972\",GEOGCS[\"GCS_Belge_1972\",DATUM[\"D_Belge_1972\",SPHEROID[\"International_1924\",6378388.0,297.0]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]],PROJECTION[\"Lambert_Conformal_Conic\"],PARAMETER[\"False_Easting\",150000.01256],PARAMETER[\"False_Northing\",5400088.4378],PARAMETER[\"Central_Meridian\",4.367486666666666],PARAMETER[\"Standard_Parallel_1\",49.8333339],PARAMETER[\"Standard_Parallel_2\",51.16666733333333],PARAMETER[\"Latitude_Of_Origin\",90.0],UNIT[\"Meter\",1.0]]"}}&printOutput={"toRemoveLayoutElements":["*"],"exportSettings":null,"mapRotation":0,"pageUnits":8,"resolution":100,"height":29.7,"borderWidth":[0.5,0.5,0.5,0.5],"width":21,"format":"pdf"}&mapElements=[]&layoutElements=[{"visible":true,"name":"myScaleBar","anchor":"bottomright","geometry":{"x":20.5,"y":0.5},"symbol":{"type":"pchScaleBar","barHeight":5}},{"visible":true,"name":"myScaleText","anchor":"topmid","geometry":{"x":10.5,"y":29.2},"symbol":{"type":"pchScaleText","separator":" : ","pageUnits":9,"backgroundColor":{"blue":255,"green":255,"alpha":255,"red":255},"mapUnits":8,"mapUnitLabel":"","pageUnitLabel":"","numberFormat":{"roundingOption":0,"roundingValue":3},"style":0}},{"visible":true,"name":"myLegend","anchor":"bottomleft","geometry":{"x":0.5,"y":0.5},"symbol":{"type":"pchLegend","showHeadings":false,"showLabels":true,"showLayerNames":true,"exceptionLayerNames":["ortho2010_white","Orthophotos2007","Orthophotos2004","Orthophotos2001","topo_100k","topo_050k","topo_020k","topo_005k"],"includeAllLayers":true,"legendColumns":1,"legendTitle":"Legend","legendBackground":{"type":"esriSFS","outline":null,"style":"esriSFSSolid","color":{"blue":255,"green":255,"alpha":255,"red":255}}}},{"visible":true,"name":"myLegend","anchor":"topright","geometry":{"x":20.5,"y":29.2},"symbol":{"type":"pchPictureEl


AND 


http://swarcgis001/arcgisoutput/PrintTask_layout_1302766588558_layout.pdf
0 Kudos
EricVenden
Frequent Contributor
Tom,
I've reset everything back to the original "settings" in an attempt to fix 1 problem at a time.  The printout is actually leaving 1 map service off the print (this service includes the parcel lines).  I have excluded some of the layers of that particular map service from showing on the legend. 

Regarding the scale issue.  I have configured the config xml for the widget to use cm for paper sizes and I've adjusted the scales to choose from.  I have also kept the settings for cm/m in the flash project.  The resulting PDF, although missing the 1 map service, is showing the correct information for the scale chosen.  The problem is with the red box outlining the area that will be printed - it is not sized properly.
Thank you
Eric
0 Kudos
TomSchuller
Frequent Contributor
David,
your url was cutted off. But I don't think that the problem is related to the SOE
The SOE is generating the pdf in the arcgisoutput folder.
This seems to be something of your IIS configuration.
Could you try to open an other file in the arcgisouput direcory as url from the IE (or create a simple html file in it to control the access)?
If other files are working, you should check the file permissions.



Eric,
I'm looking for implementing "inch/feet" support.
You are saying that 1 mapservice isn't displayed.
Could you post the complete url and the mxd?

Tom
0 Kudos
DavidCaussin
Deactivated User
Hi Tom and thanks for all

I'm pretty sure that the problem come from the server, a question of security i believe.

BUT

now all work fine but the created PDF  dont show the map. The legend, the scale .... well but not the elements of the map????

I dont think that i have modify something .....

here is the json URL that return a "empty" pdf

http://swarcgis001/ArcGIS/rest/services/layout/MapServer/exts/PCHPrintSOE/printMap?mapExtent={"xmin":132982.03793074252,"ymin":163767.47311827957,"xmax":167967.96206925748,"ymax":180973.3616967234,"spatialReference":{"wkt":"PROJCS[\"Belge_Lambert_1972\",GEOGCS[\"GCS_Belge_1972\",DATUM[\"D_Belge_1972\",SPHEROID[\"International_1924\",6378388.0,297.0]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]],PROJECTION[\"Lambert_Conformal_Conic\"],PARAMETER[\"False_Easting\",150000.01256],PARAMETER[\"False_Northing\",5400088.4378],PARAMETER[\"Central_Meridian\",4.367486666666666],PARAMETER[\"Standard_Parallel_1\",49.8333339],PARAMETER[\"Standard_Parallel_2\",51.16666733333333],PARAMETER[\"Latitude_Of_Origin\",90.0],UNIT[\"Meter\",1.0]]"}}&printOutput={"borderWidth":[0.5,0.5,0.5,0.5],"format":"pdf","toRemoveLayoutElements":[],"resolution":92,"width":20.532608695652176,"exportSettings":null,"height":10.097826086956522,"pageUnits":1,"mapRotation":0}&mapElements=[]&layoutElements=[]&mapServices=[{"type":"AGS","url":"http://swarcgis001/ArcGIS/rest/services/Ortho_2009/MapServer","visibleIds":"0","name":"Ortho","alpha":1},{"type":"AGS","url":"http://swarcgis001/ArcGIS/rest/services/Cadastre/MapServer","visibleIds":"0,1,2,3,4,5,6,7,8","name":"Fond de plan - Grondplan","alpha":1},{"type":"AGS","url":"http://swarcgis001/ArcGIS/rest/services/Region/MapServer","visibleIds":"0","name":"Région - Gewest","alpha":0.6484375}]

David
0 Kudos
TomSchuller
Frequent Contributor
Could you post also the mxd and a printscreen of ArcMAP having the mxd opened.

Tom
0 Kudos