Select to view content in your preferred language

Advanced print solution

53529
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
evanpicard
Emerging Contributor
Evan,
could you ping the "MWELLAGSSERVER"?
If not could you ping the ip-address?

Mostly the problem is coming from the firewall.

You could get more infos of this problem in my BitBucket:
http://bitbucket.schuller.lu/pchprintsoe/issue/3/error-trying-execute-soemanagerbat

Tom


Yes, I can ping the server.  Firewall doesnt cause a problem with any AGS applications or services used.  Would it cause a problem here?
0 Kudos
TomSchuller
Frequent Contributor
Evan,
yes, it seems that the firewall has blocked some access needed by the "soemanager".

You just have to disable temporary the firwall during the registration  of the SOE by the "soemanager".
After registration, you can switch again on the firewall.

Tom
0 Kudos
evanpicard
Emerging Contributor
Evan,
yes, it seems that the firewall has blocked some access needed by the "soemanager".

You just have to disable temporary the firwall during the registration  of the SOE by the "soemanager".
After registration, you can switch again on the firewall.

Tom


I'm pretty sure the firewall is turned off completely, but I'll give it a shot when I'm back in the office on Friday.  Thanks for the help.
Evan
0 Kudos
MattGiles
Deactivated User
I have downloaded the PchPrintWidget and have several errors in flash builder..

I had no problems with the java part of the install...everything looks good in my rest services etc.

However, after loading the widget into my flash builder project (and adding the mxml to compiler modules) I have several errors when compiling:

1. lines 294-298, 312-316: error 1120: access of undefined property JSON. (i can fix this by adding com.esri.ags.utils. before JSON in each line).
2. However, I am left with the following error:

[Can not resolve a multiname reference unambiguously.JSON (from c:\programfiles(x86)\adobe\Adobe Flash Builder 4.6\sdks\4.6.0\frameworks\libs\player\11.1\playerglobal.swc(JSON,Walker)) and com.esri.ags.utils:JSON (from c:\workspace\ARCAPIFLEX2_5\ArcGIS_Flex\libs\agslib-2.5-2011-11-30.swc(com.esri.ags.utils:JSON)) are available.

I have a feeling that this has something to do with a version of something, but im not sure what.

I am running Flex SDK 4.6 and arcgis flex api 2.5

Any suggestions / pottential fixes would be great!

Thanks
0 Kudos
TomSchuller
Frequent Contributor
Hy,
The Flex 4.6 SDK includes JSON support, if you are including your own JSON classes either directly or through a shared library you�??ll have to remove them in order to use the new SDK.


Seems to be related with the JSON support now new in 4.6! I didn't yet installed FlexSDK4.6
To get a quick fix, just install the FlexSDK4.5 and compile with 4.5

I will download the SDK4.6 and will update the code.

Tom
0 Kudos
TomSchuller
Frequent Contributor
I just updated the Flex code to make it "Flex SDK 4.6" compatible:
http://bitbucket.schuller.lu/pchprintwidget/changeset/e9bccb0a5d23/

T
om
0 Kudos
MattGiles
Deactivated User
Thanks for the update to SDK 4.6.

I have the PCHPrintSOE installed on my server and i now have the widget working in my flex viewer app. When i use the "current extent" in the widget (simple GUI) it works great and exports my current extent to pdf. However, when i try to export to pdf from the select extent GUI, it fails (after not changing any options and after turning off all layout elements) and an "Error during print!" alert shows, with error message: {"error":{"code":500,"message":"An unexpected error occured processing the request","details":[]}}

Also, do i have to enable PCHPrintSOE and printmap for each service that i publish for them to be captured in the pdf?
Finally, do i need to make a seperate mxd for each layout option (A4 portrait, A4 landscape, A3 portrait,...)? and do i need to set up my mxd (currently blank but i set the dataframe projection to that of my flex application) in any way?

I have attached a copy of my server log during the print process (in verbose mode). I looked through it and the last log says "server object instance is successfully created on machine geoserver"...so it seems like it worked but nothing makes it to output folder on arcserver like it does when i run the "current extent" (where 3 files are created: png, pdf, esri arcmap document).

Thanks in advance for any help you can provide
Cheers!
0 Kudos
MattGiles
Deactivated User
sorry here's the log file..
0 Kudos
TomSchuller
Frequent Contributor
Hy,
could you please first update the PchPrintSOE to the latest version?
-> http://bitbucket.schuller.lu/pchprintsoe/src
  -> enter the "build" folder
  -> download the JAR file
-> override your existing JAR file with this one in <ags-server>\java\lib\ext
-> restart your mapservices which are using the PChPrintSOE


For the latest FlexWidget source, you can check here:
-> http://bitbucket.schuller.lu/pchprintwidget/src


You just need 1 layout mapservice. The paperformat A4/A3/..., orientation, projection is passed by parameter to the PrintSOE. It's adjusting dynamically.


Does the print now work?
If not, could you please make these checks:
Did you have a "h:\arcgisserver\arcgisoutput\Base_E2MDataBundle_nomaplex_MapServer" folder?
Did you have a "h:\arcgisserver\arcgisoutput\Base_E2MDataBundle_nomaplex_MapServer\lyr" folder?
Did you have lyr-files in "h:\arcgisserver\arcgisoutput\Base_E2MDataBundle_nomaplex_MapServer\lyr"?
Did your lyr-files work if you add them manually in ArcMAP (test it directly on GEOSERVER if ArcMAP is installed)


Does this url "http://geoserver/arcgisoutput/Base_E2MDataBundle_nomaplex_MapServer/lyr/0.lyr" return a working lyr-file in ArcMAP?
Does this lyr-file "C:\Users\ARCGIS~1\AppData\Local\Temp\PCHPrintSOELayer1401398120745192480.lyr" work in ArcMAP?


Please post again the new DEBUG log using the latest version PChPrintSOE version.

Could you run the FlexViewer in debug mode? After doing a print, there will be a "generated print url" written out int the output window of FlashBuilder. Could you please post this generated print url for a "current extent" print and a "select extent" print.

Tom
0 Kudos
MattGiles
Deactivated User
Yes it works now! Thanks so much Tom.

A few more questions:
-how difficult would it be to add more scale options? My application covers all of Canada so, although the large scales will be useful, id like to incorporate smaller scales as well to cover more of the country.

-Also, I have a number of ImageServices running in my application and the PrintSOE option is not available in the capabilities of these services. Does this tool not support ImageServices?

Great tool Tom, thanks alot for your help getting it running!
0 Kudos