Select to view content in your preferred language

Advanced print solution

52347
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
TomSchuller
Frequent Contributor
mattias_j,
I'm currently in holidays.
So I'm having 'some time' to take a look at your problem. Is it still present?

Tom
0 Kudos
SylvainKerdreux
Emerging Contributor
sylvain.kerdreux.
does the generated mxd file contain invalid layers or are there no layers in it.

If there are no layers in it, that means that either the server couldn't access the lyr-files or the layer was invalid.
Could you post the server.log from ArcGIS Server in verbose log?. The reason should be written in it.

If ther are layers in it but they aren't displayed, please add the manually and check the difference between them in the properties.

Tom


here the log from ArcGIS Server :

ERROR unable to add mapservice layers for :http://vm-geotest/arcgis/rest/services/Fond_de_plan/MapServer 2011-09-07 11:04:04 layout.MapServer VM-GEOTEST
INFO3 addAGSMapServiceByLayerFile.agsMapServiceLayerUrl = http://vm-geotest/arcgis/rest/services/Fond_de_plan/MapServer?f=lyr&v=9.3 2011-09-07 11:04:04 layout.MapServer VM-GEOTEST ERROR AutomationException: One or more arguments are invalid 2011-09-07 11:04:04 layout.MapServer VM-GEOTEST
INFO3 mapService: http://vm-geotest/arcgis/rest/services/Fond_de_plan/MapServer 2011-09-07 11:04:04 layout.MapServer VM-GEOTEST

0 Kudos
MattiasEkström
Frequent Contributor
Tom
Yes, my problem is still present. I don't want you to spend all you holidays working on that, but I'm very thankful if you could find some time to look at it. 🙂

/Mattias
0 Kudos
DavidCaussin
Deactivated User
Hi Tom,

I have a question over the layout.
Is it possible to create our own layout...

For exemple, 2 parts on a A3 with the map above and the text,logo,.... in the other?

Thanks
0 Kudos
TomSchuller
Frequent Contributor
mattias_j,
your log file "Now_when_annotations_works_but_msd_and_layout_doesnt" didn't contain any PrintSOE entries.
Could you please post a new log file the the opertation entries?

Mercator007,
did you think about a 2page layout? Is this possible in ArcMAP?

Thanks,
Tom
0 Kudos
DavidCaussin
Deactivated User
Hi Tom,

No on 1 page but with 2 section (1 for the map and 1 for the other elements(title,scale,....)

for exemple

0 Kudos
MattiasEkström
Frequent Contributor
Tom,
Here's some new log files.

/Mattias
0 Kudos
JustinFail1
Deactivated User
Hi Tom,

We're having issues accessing the resulting images from your SOE because the url that is returned does not match the virtual folder that we've specified for the output folder. This is because we are using our site under a different domain name via secure https access.

For example, under verbose logging the url is returned as follows:

handleRESTRequest.answer: {"outputFile":"http://<server name>/arcgisoutput/PrintTask_Printing_1316752688844_layout.jpg"}

Whereas, I was hoping that it would be:

handleRESTRequest.answer: {"outputFile":"<server output directory url>/PrintTask_Printing_1316752688844_layout.jpg"}

Is there a way that we can either configure your SOE, or ArcGIS Server, to ensure that our https output folder url is used instead?

Thanks in advance.

Justin
0 Kudos
TomSchuller
Frequent Contributor
UnkleJ,
you have to configure the virtual output directory on your "Printing" mapservice.

If you have configured it, could you please post the ArcGIS server log in verbose mode.

Tom
0 Kudos
AshleyOwens
Emerging Contributor
When I click "Print" I see "An error occurs during print". The tmpUrl displayed in the console is below. Notice the carriage return character at the beginning. What's the best way to remove that?
I can't test it in a browser - it doesn't copy the entire URL to the address bar and I can't type anything else - I think the limit is exceeded.

�?� http://servernm:8399/arcgis/rest/services/layout/MapServer/exts/PCHPrintSOE/printLayout?mapExtent={"xmin":-9365144.5,"ymin":3908651.5511669656,"xmax":-9305144.5,"ymax":3994751.5511669656,"spatialReference":{"wkid":102100}}&printOutput={"height":29.7,"resolution":100,"format":"pdf","toRemoveLayoutElements":["*"],"pageUnits":8,"borderWidth":[0.5,0.5,0.5,0.5],"mapRotation":0,"width":21}&mapElements=[]&layoutElements=[{"symbol":{"type":"pchNorthArrow","size":48},"visible":true,"xOffset":0,"geometry":{"x":0.5,"y":0.5},"yOffset":0,"anchor":"bottomleft"},{"symbol":{"type":"pchTextElement","textSymbol":{"type":"agsJsonSymbol","xoffset":0,"angle":0,"yoffset":0,"color":{"alpha":255,"red":0,"blue":0,"green":0}},"text":"Title"},"visible":true,"xOffset":0,"geometry":{"x":10.5,"y":29.2},"yOffset":0,"anchor":"topmid","name":"myTitle"},{"symbol":{"barHeight":5,"type":"pchScaleBar"},"visible":true,"xOffset":0,"geometry":{"x":0.5,"y":0.5},"yOffset":0,"anchor":"bottomleft","name":"myScaleBar"},{"symbol":{"type":"pchTextElement","textSymbol":{"type":"agsJsonSymbol","xoffset":0,"angle":0,"yoffset":0,"color":{"alpha":255,"red":255,"blue":255,"green":255}},"text":"© copyright pch"},"visible":true,"xOffset":0,"geometry":{"x":10.5,"y":0.5},"yOffset":0,"anchor":"bottommid","name":"myCopyRight"},{"symbol":{"mapUnits":8,"mapUnitLabel":"","backgroundColor":{"alpha":255,"red":255,"blue":255,"green":255},"separator":":","pageUnitLabel":"","type":"pchScaleText","style":0,"numberFormat":{"roundingOption":0,"roundingValue":3},"pageUnits":9},"visible":true,"xOffset":0,"geometry":{"x":0.5,"y":29.2},"yOffset":0,"anchor":"topleft"},{"symbol":{"includeAllLayers":true,"legendTitle":"Legend","exceptionLayerNames":["ortho2010_white","Orthophotos2007","Orthophotos2004","Orthophotos2001","topo_100k","topo_050k","topo_020k","topo_005k"],"exceptionLayerNamesStr":"ortho2010_white,Orthophotos2007,Orthophotos2004,Orthophotos2001,topo_100k,topo_050k,topo_020k,topo_005k","showLayerNames":true,"showLabels":true,"showHeadings":false,"type":"pchLegend","legendBackground":{"style":"esriSFSSolid","color":{"alpha":255,"red":255,"blue":255,"green":255},"type":"esriSFS"},"legendColumns":1},"visible":true,"xOffset":0,"geometry":{"x":20.5,"y":29.2},"yOffset":0,"anchor":"topright"},{"symbol":{"type":"pchPictureElement","pictureUrl":"http://intranet.pch.etat.lu/files/images/prix_carburants.jpg"},"visible":true,"xOffset":0,"geometry":{"x":20.5,"y":2.5},"yOffset":2,"anchor":"bottomright"}]&mapServices=[{"visibleIds":"2,4","url":"http://serverprd:8399/arcgis/rest/services/Facility/MapServer","alpha":0.796875,"type":"AGS","name":"ITS Facility"}]
0 Kudos