Select to view content in your preferred language

Advanced print solution

46772
296
02-19-2011 10:52 AM
TomSchuller
Occasional Contributor III
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
Occasional Contributor III
conner_justin,
for some documentation concerning the "toRemoveLayoutElement", you should check this page:
http://bitbucket.schuller.lu/pchprintsoe/issue/16/print-mxd-template-layout

Tom
0 Kudos
TomSchuller
Occasional Contributor III
Burns86,
you don't have to enable the pchPrintSOE capability on your mapservices.

If you have enable the pchPrintSOE capability on a mapservice which has to be printed:
instead of adding the mapservice itself to create the printout, the datasource itself (arcsde layer, fgdb layer, ...) will be added to the printout.
Just check the difference in the generated mxd file in your arcgisoutput directory.

I'm using this functionality to create high-quality large-format printouts.

Tom
0 Kudos
LuciHawkins
Occasional Contributor III
conner_justin,
for some documentation concerning the "toRemoveLayoutElement", you should check this page:
http://bitbucket.schuller.lu/pchprintsoe/issue/16/print-mxd-template-layout

Tom


Good Morning Tom,

I read the above article and I need some extra guidance.  I have a template published on my server called:   "layout2"   It has PCHPrint SOE enabled along with "printMap" under Operations allowed: checked.

In my layout2 map, I have a custom scalebar, legend, north arrow, logo, disclaimer, misc text, etc. that I want printed along with the map extent that I select in your Enhanced print widget.

So, I set the statement below in my PchPrintWidget.xml file:

<toRemoveLayoutElements>
</toRemoveLayoutElements>

Is that a trigger to remove Layout Elements in my "layout2" or in the map template your widget is configuring?

Thanks,

Luci
0 Kudos
TomSchuller
Occasional Contributor III
Luci,


<toRemoveLayoutElements>
</toRemoveLayoutElements>

This is a trigger to control the "remote" elements defined on the mxd of your mapservice 'layout2'.

To control the "local" elements you defined in the PChPrintWidget.xml, you have to make a custom development in the PchPrintWidget.mxml.

Tom
0 Kudos
TomSchuller
Occasional Contributor III
empicard,
your command should replace the second ip-address with the machine name:
java -classpath "C:\Program Files (x86)\ArcGIS\Server10.0\java\lib\arcobjects.jar;C:\Program Files (x86)\ArcGIS\Server10.0\java\tools\soemanager\SOEManager.jar" com.esri.arcgis.tools.SOEManager -a 172.26.197.91 localhost administrator aVp105 PCHarcgisSOE.jar

Just use "localhost" or even better the name of your machine.
Also for the first ip-address, you could use "localhost".

Tom
0 Kudos
MollySandomire
New Contributor II
Hy,


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


Hi Tom, what did you change in your code to update it to the FlexSDK4.6?
Molly
0 Kudos
TomSchuller
Occasional Contributor III
Molly,
I had to use the fully qualified name of the JSON class as the FlexSDK has also a JSON class:
params["mapExtent"]=com.esri.ags.utils.JSON.encode(mapExtent);


Take a look on this:
  http://bitbucket.schuller.lu/pchprintwidget/src/1fdf036db1c0/src/lu/etat/pch/gis/widgets/pchPrintWid...

Tom
0 Kudos
LeroyChristophersen
New Contributor II
Hi Tom,

Are you saying that the MapServices msd's should not be PrintSOE enabled.  I have a blank layout, with no layers, PrintSOE enabled, but also did this for the layers that are being displayed.
Could this be the cause of the 500 error message that I have been getting when I attempt to print?
Leroy


Could you restart your ArcGIS-Server services (not the mapservices).

Is your "ortho2009" printSOE enabled? You just have to make the "layout" mapservice PrintSOE enabled.
If it's enabled on the "ortho2009" mapservice, disable it.

Tom
0 Kudos
TomSchuller
Occasional Contributor III
Leroy,
does this file exits on your AGS-server?
  <arcgisouput-directory>\Ortho_2009_MapServer\lyr\0.lyr

Could you try to add this lyr file to ArcMAP? Does it work?

Could you try this url?
http://swarcgis001/arcgisoutput/Ortho_2009_MapServer/lyr/0.lyr
It should return you the same lyr-file which should also work in ArcMAP.

If you doesn't get the lyr file by url, you have to check the IIS settings.
I think to remember that you have to define a file-mapping for the ".lyr" extensions.

Tom
0 Kudos
DominiqueBerger
New Contributor II
Hi Tom

Firstly thanks heaps for sharing your geat widget 🙂

I have got it up and running with my internal Flex application however I am finding an error when I click on the Print button down the bottom - It throws the following error

[ATTACH=CONFIG]13545[/ATTACH]

I have crossdomain.xml file in my root directory. I have tried a few variations inlcuding the below;

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="*" />
</cross-domain-policy>

When I debug using Fidler I get this really weird error showing that  the host is 'localshost'  - notice the spelling mistake
[ATTACH=CONFIG]13546[/ATTACH]

I have searched the whole server for the spelling mistake however I can't find it - would you be able to shed anylight as to where that might be coming from? I would really love to get this print function working for my users here - they were very excited when i told them I had found one that would do the job.

Thanks again Tom,
Kind regards,

Dominique Berger
0 Kudos