Select to view content in your preferred language

Advanced print solution

53735
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 didn't forgot you.
I think I found the problem, but I'm looking for a good solution.
I have to write a lyr file for each separate annotation-sublayer (id 1-4 in your example)
Has anybody experience on annotation-sublayer suing the ArcObject API?

Tom
0 Kudos
MattiasEkström
Frequent Contributor
Thanks Tom, I hope you'll find a solution.
/Mattias
0 Kudos
TomSchuller
Frequent Contributor
mattias_j,
I posted a new beta jar with the annotation fix:
http://gis.pche.etat.lu/flexViewerprint/PCHarcgisSOE.jar

Could you try this out? (copy the jar and restart your mapservices)
It should now correctly write out your annotation lyr files.

Tom
0 Kudos
MattiasEkström
Frequent Contributor
Tom,
Thanks for all your help, the annotation problem seems to be solved now, I was able to export a PDF with annotations.
But I'm still having other problems that occured a long the way.
I still can't enable the PCHPrintSOE on any mapservice that is based on a .msd document, the services just can't be started with that capability checked.
And when trying with the .mxd based services the result does not include any layout elements and the scale is not what it's supposed to be. Don't know if this layout thing is SOE or Flex problem, but haven't changed anything to the flex part and that worked before...

/Mattias
0 Kudos
TomSchuller
Frequent Contributor
mattias_j,
for "msd" support, you have to have the mxd stored in the same directory. There is no way to read all needed informations from the msd. We have to use the mxd to get full printing capabilities.
E.g. the msd "c:\data\basemap.msd" must have the equivalent mxd "c:\data\basemap.mxd"

When you want to use layout elements defined in your mapservice, you have to modify the "toExcludeElement" from the url. By default it does contain "*" which  means remove any elements.

Tom
0 Kudos
MattiasEkström
Frequent Contributor
Tom,
Good to know that it's the mxd documents that is used, but it's supposed to work when using .msd documents if there's also a corresponding .mxd document? right?
I do have both mxd and msd, and it did work before the annotation fixes on mapservices without annotations, but now it doesn't.
And concerning the layout elements I meant the elements that comes from the flex widget, not anything in my mapservice. That also worked before but not anymore, it isn't even possible to get a portrait PDF. I'm attaching two pdf examples one from before and one from today, and I think you'll get what I mean.

I tried to use fiddler to see the URL and all parameters that are sent from the flexWidget, I'm not familiar with fiddler but I think theese are the parameters in the URL:
mapExtent {"xmin":1459779.8223054777,"ymin":6549481.999576666,"xmax":1459879.8223054777,"ymax":6549625.499576666,"spatialReference":{"wkid":3021}}
layoutElements [{"symbol":{"type":"pchNorthArrow","size":48},"visible":true,"name":null,"geometry":{"x":0.5,"y":0.5},"yOffset":0,"xOffset":0,"anchor":"bottomleft"},{"symbol":{"textSymbol":{"borderLineColor":null,"xoffset":0,"type":"agsJsonSymbol","angle":0,"yoffset":0,"text":null,"font":null,"color":{"green":0,"alpha":255,"blue":0,"red":0}},"type":"pchTextElement","text":"Title"},"visible":true,"name":"myTitle","geometry":{"x":10.5,"y":29.2},"yOffset":0,"xOffset":0,"anchor":"topmid"},{"symbol":{"barHeight":5,"type":"pchScaleBar"},"visible":true,"name":"myScaleBar","geometry":{"x":0.5,"y":0.5},"yOffset":0,"xOffset":0,"anchor":"bottomleft"},{"symbol":{"textSymbol":{"borderLineColor":null,"xoffset":0,"type":"agsJsonSymbol","angle":0,"yoffset":0,"text":null,"font":null,"color":{"green":255,"alpha":255,"blue":255,"red":255}},"type":"pchTextElement","text":"�?© copyright pch"},"visible":true,"name":"myCopyRight","geometry":{"x":10.5,"y":0.5},"yOffset":0,"xOffset":0,"anchor":"bottommid"},{"symbol":{"numberFormat":{"roundingOption":0,"roundingValue":3},"pageUnitLabel":"","mapUnitLabel":"","mapUnits":8,"type":"pchScaleText","backgroundColor":{"green":255,"alpha":255,"blue":255,"red":255},"pageUnits":9,"separator":":","style":0},"visible":true,"name":null,"geometry":{"x":0.5,"y":29.2},"yOffset":0,"xOffset":0,"anchor":"topleft"}]
mapElements []
f json
printOutput {"mapRotation":0,"width":21,"height":29.7,"resolution":100,"pageUnits":8,"toRemoveLayoutElements":["*"],"format":"pdf","exportSettings":null,"borderWidth":[0.5,0.5,0.5,0.5]}
mapServices [{"name":"BGKtest_mxd","alpha":1,"visibleIds":"0,1,2,5,6,7","type":"AGS","url":"http://10.202.101.108:8399/arcgis/rest/services/BGK/BGKtest_mxd/MapServer"}]

/Mattias
0 Kudos
TomSchuller
Frequent Contributor
mattias_j,
could you please post the verbose server log concerning your msd problem?

For the portrait example, could you please post the generated mxd-files (before and now) and the according urls?

Tom
0 Kudos
MattiasEkström
Frequent Contributor
Tom,
You'll find everything in the attached zip-file, logs, mxd-files, pdf-files and URLs.
Thanks!
/Mattias
0 Kudos
SylvainKerdreux
Emerging Contributor
I have few questions about the SOE.
I try to print using the SOE but it does not work.
MXD only contains graphic elements but no layer.
I often use your SOE and it's the first time I do not succeed to print.

The 2 mains difference between other projects are :
- server name which contain a -    --> vm-geotest
- ArcGis Desktop is not installed on the server.

Do you think the problem is linked to one of difference listed above.
0 Kudos
TomSchuller
Frequent 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
0 Kudos