Select to view content in your preferred language

Advanced print solution

53301
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
MattPohl
Frequent Contributor
Matt,
your arcgis server isn't getting any request from the widhet.

Could you check if the "printurl" is correctly configure in the PChprintWidget.xml?
Maybe it's using an older version from your browser cache.

Tom


Hi Tom,

I did some reconfiguration in the PCprintWidget.xml and can now get the widget to appear when clicked, and can go through the whole print dialog. There are however still some issues. first, it is posting the pdf to my web server with its proper name (insight.teamworksintl.net), but on the get procedure it is not using the correct name, its using the server machine name (TWIWEB01). This results in an "Server not Found" error. I have attached a screen shot showing this. If I change the server name in the url to insight.teamworksintl.net (the post server name), it will return the pdf.

Second, only the base map appears on the pdf. None of my services/layers appear. In the arcgisoutput folder there is the pdf and an mxd. When I open up the mxd only the basemaps appear, just like in the pdf.

I attached my Fiddler results for the Post url and the Get url. I also posted the Widget debug file. Thanks again for all your help on this, I think we are close.

Matt
0 Kudos
TomSchuller
Frequent Contributor

teamworksintl,
to get thr right url of the pdf, you have to confiugre your virtual output directory of the "layout" mapservice to "

https://insight.teamworksintl.net" as the other mapservices.


Could you post or mail (tom@schuller.lu) the verbose arcgis server log to see why your mapservices aren't added to the print?
  see here http://bitbucket.schuller.lu/pchprintsoe/wiki/ErrorReporting

Most times, it's related that the url is not resolved correctly on the server.
Could you try this url in InternetExploer on your ArcGIS Server as "arcsoc" user:
  https://insight.teamworksintl.net/ArcGIS/rest/services/ADSPM/USADiocese/MapServer

Tom
0 Kudos
CesarPiovanetti
Deactivated User
Tom, i was able to get the widget to show, but it seems that it cant find the layout map services (url).  when i added the SOE's, the lu.schuller.arcgis.gp.printtool functiofactory failed.when i try to print a map this messages comes up

""2-Error during print !
No 'outputFile' in result
result: {"error":{"code":400,"message":"Unable to complete  operation.","details":["Invalid URL"]}}""

This is the segment of the PchPrintWidget.xml that shows all the paths:

<?xml version="1.0" ?>
- <configuration>
  <PrintUrl url="http://gmtmobile16/arcgis/rest/services/layout/MapServer/exts/PCHPrintSOE" />
- <!--
  <PrintUrl url="http://gmtmobile16/arcgis/rest/services/layout/MapServer/exts/PCHPrintSOE">
   <mxdFile>C:\Users\Administrator\Desktop\DEMOS\MXD\layout.mxd</mxdFile>
   <physicalOutput>C:\arcgisserver\directories\arcgisjobs</physicalOutput> <virtualOutput>http://gmtmobile16/arcgis/rest/directories/arcgisjobs/</virtualOutput>
  </PrintUrl>







i Attached  the cmd line message, and the debug files from the widget.
[ATTACH=CONFIG]15023[/ATTACH]




This is the verbose from server manager

WARNING ExportLayerTask().virtualLayerFileDirectory: http://gmtmobile16/arcgisoutput/layout_MapServer/lyr 2012-06-07 08:07:57 layout.MapServer GMTMOBILE16 
WARNING ExportLayerTask().physicalLayerFileDirectory: c:\arcgisserver\arcgisoutput\layout_MapServer\lyr 2012-06-07 08:07:57 layout.MapServer GMTMOBILE16 
WARNING ExportLayerTask().virtualLayerFileDirectory: http://gmtmobile16/arcgisoutput/layout_MapServer/lyr 2012-06-06 16:39:33 layout.MapServer GMTMOBILE16 
WARNING ExportLayerTask().physicalLayerFileDirectory: c:\arcgisserver\arcgisoutput\layout_MapServer\lyr 2012-06-06 16:39:33 layout.MapServer GMTMOBILE16 
WARNING ExportLayerTask().virtualLayerFileDirectory: http://gmtmobile16/arcgisoutput/layout_MapServer/lyr 2012-06-06 16:05:01 layout.MapServer GMTMOBILE16 
WARNING ExportLayerTask().physicalLayerFileDirectory: c:\arcgisserver\arcgisoutput\layout_MapServer\lyr 2012-06-06 16:05:01 layout.MapServer GMTMOBILE16 
WARNING ExportLayerTask().virtualLayerFileDirectory: http://gmtmobile16/arcgisoutput/layout_MapServer/lyr 2012-06-06 15:54:50 layout.MapServer GMTMOBILE16 
WARNING ExportLayerTask().physicalLayerFileDirectory: c:\arcgisserver\arcgisoutput\layout_MapServer\lyr 2012-06-06 15:54:50 layout.MapServer GMTMOBILE16
like everyone else here, this is exactly what we need!  thanks for your help, its greatly appreciated.


UPDATE:   Tool works perfectly after restart map service,     works like a charm...
0 Kudos
TomSchuller
Frequent Contributor
teamworksintl,
is everything working now fine?

Tom
0 Kudos
MattPohl
Frequent Contributor
Hi Tom-

Thanks for all the help you provided, its greatly appreciated. The widget is working great and preforming as expected, your the man!

Thanks again,

Matt
0 Kudos
FernandaMaraschin
Deactivated User
Hi Tom,

Thank you for this useful widget.

I've followed the quick installation steps and the widget is working properly for MXD mapservice. But it is not okay for MSD. The supported extensions PCExportSOE and PCHPrintSOE are not available for this kind of mapservice.

When I try to print a MSD mapservice, the PrintTask* files are generated, the legend symbology appears in the PrintTask*.MXD file but doesn't appear in PrintTask*.PDF. The same occurs to JPG, PNG, etc. Moreover, I get the following error in the logs.


ERROR   downloadContent.url = null, return empty string
ERROR   downloadContent.url = null, return empty string
ERROR   java.io.IOException: Server returned HTTP response code: 400 for URL: http://myserver.com:8399/arcgis/rest/services/MYSERVICE/MapServer/exts/PCHPrintSOE?NOf=json at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at lu.etat.pch.gis.utils.RESTUtils.downloadContent(RESTUtils.java:275) at lu.etat.pch.gis.utils.RESTUtils.urlExists(RESTUtils.java:167) at lu.etat.pch.gis.utils.json.print.PchPrintMapService.addPChPrintSOEMapServiceLayer(PchPrintMapService.java:387) at lu.etat.pch.gis.utils.json.print.PchPrintMapService.getLayerForMapService(PchPrintMapService.java:225) at lu.etat.pch.gis.utils.json.print.PchPrintMapService.createLayersFromPchPrintMapServices(PchPrintMapService.java:188) at lu.etat.pch.gis.soe.tasks.print.PrintTask.prepareMap(PrintTask.java:311) at lu.etat.pch.gis.soe.tasks.print.PrintTask.print(PrintTask.java:209) at lu.etat.pch.gis.soe.tasks.print.PrintTask.printLayout(PrintTask.java:172) at lu.etat.pch.gis.soe.print.PCHPrintSOE.printLayout(PCHPrintSOE.java:204) at lu.etat.pch.gis.soe.print.PCHPrintSOE.handleRESTRequest(PCHPrintSOE.java:111) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source)

Could you help me?

By the way, the corresponding MXD file for the MSD file is located in the same directory with the same name.

Thank you.
0 Kudos
TomSchuller
Frequent Contributor

PM
fmaraschin,
could you please post or mail (tom@schuller.lu) the complete verbose arcgis server log?

  
http://bitbucket.schuller.lu/pchprintsoe/wiki/ErrorReporting

I will take a look on it to identify the problem.

Tom
0 Kudos
ScottKiley
Frequent Contributor
I have configured the Advanced Print widget successfully.
However, it errors when the widget is run by multiple users from separate computers simultaneously.

It returns the following error on the application where it is first enacted.
2-Error during print !
No 'outputFile' in result
result: {"currentVersion":10.01,"error":{"code":500,"message":"An unexpected error occurred processing the request.","details":[]}}


The error below is returned in the applications enacted while the first is running.
An error occurs during print: 500 / faultCode:Server.Error.Request faultString:'HTTP request error' faultDetail:'Error: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032"]. URL: http://lrs.co.columbia.wi.us/ArcGIS/rest/services/LRS/ColumbiaCo/MapServer/exts/PCHPrintSOE/printLay...'

This behavior only happens when multiple users run the widget simultaneously.
It happens on two separate ArcGIS servers.  One is at Service Pack 1 (10.01).
The other ArcGIS Server is at Service Pack 2 (10.02).  All services use MSDs.

The Widget is great.  Enough so, that a similar widget comes standard in Esri's version 3.0 of the FlexViewer.
Unfortunately, my organization is not ready to upgrade to version 3.0
I really appreciate sharing it with the community.

Thanks for all your Help.
0 Kudos
TomSchuller
Frequent Contributor
Hy,
could you please provide the Arcgis server logs in "verbose mode".
See here:
http://bitbucket.schuller.lu/pchprintsoe/wiki/ErrorReporting

You can also mail them to "tom@schuller.lu"

Tom
0 Kudos
DominiqueBerger
Emerging Contributor
Hi Tom

We have been having great success with your print widget internally  - so big thank you. I have now been asked to configure it to run on our external server. This is a secure server that uses long life tokens for the services and windows authentication for the application.

I have got the widget up and running however it does not show any of the layers in the print. The layout elements are all there and the mxd and JPG are generated in the arcgisoutput directory, so I believe that is all configured correctly.

HOwever, unlike my internal server, the mxd that is produced in the arcgisoutput folder does not have any map services in it.

When I look at the debug file I can see it is requesting the map services using the token so I am not quite sure what else to trouble shoot. Using Fiddler I am not able to see any errors.

Could you have a look at my verbose log file and debug file to see where I could try and trouble shoot.

Thanks again Tom!

Dominique
0 Kudos