Select to view content in your preferred language

Advanced print solution

53322
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
EricVenden
Frequent Contributor
Eric,
you can make the following tests:
- create the same mapservice (smae mxd) under a different name
- log you in with an other user and try the mxd again (maybe IE cache)

Tom


Tom,
Here's the latest.  I did not create the same map service (same mxd) under a different name..but I did log on as a different user (domain admin to the AGS server).  The resultant PDF did not contain the parcel lines, but when I opened the generated MXD on the server (under the domain admin login), the parcel lines displayed as they should - not cached.  I then logged back on to AGS Server as the local admin (as I usually do) and the mxd did not display the parcel lines and had it listed as cached.  I will now try adding the same map service under a different name...
Eric
0 Kudos
TomSchuller
Frequent Contributor
Hy,
you could try to clear the browser cache or any temp directory.

But never heard about this before.

Tom
0 Kudos
DavidCaussin
Deactivated User
Tom,

I still have the problem with the poor quality of the pdf 😞

the printSOE are enabled on the map services

in the generated MXD the layers link to the map services (is it correct??)

Any ideas???

Thanks

David
0 Kudos
TomSchuller
Frequent Contributor
David,
could you post your mxd and your "verbose" server.log of the ArcGIS server?

Tom
0 Kudos
NathanEnge
Esri Contributor
Hi tom
I posted in the java section of the forum instead of this section by accident.

How did you configure the service so that it outputs to the fully qualified domain name instead of the localhost machine name?

0 Kudos
NathanEnge
Esri Contributor
The PChPrintSOE is running on both:
a .NET ArcGIS Server
and on a Java ArcGIS Server


New version with new functionalities:
- supports WMSLayer
- added NorthArrow
- added Legend
- bug fixes and code cleanup

HI tom, great widget.
I'm not seeing where the northarrow is being called in the xml?
0 Kudos
VladislavMasatin
Deactivated User
Are I understand correctly that I need 10 version of server for this widget? My current server is 9.3.1. I also use ArcMap 9.3.1
0 Kudos
TomSchuller
Frequent Contributor
You really need the version 10 of the ArcGIS server (java or .NET).
The code is using a functionality (rest exposed soe) which isn't available in 9.3.1

Tom
0 Kudos
AlexanderBrown1
Deactivated User
Hi Tom,

Excellent Widget! I have almost succeeded in getting it to work, but I am afraid I have run into some problems.  I attached an image of the error that I am receiving; as well as the full text within the error window below.

I believe the issues I am having are based upon my server's name.  Locally our server is named GIS.  The full path is "gis.wff.nasa.gov."  Unfortunately, we have recently moved to an enterprise NASA network called the NDC.  Our computer's path locally is still GIS, gis.wff.nasa.gov, but is also now gis.ndc.nasa.gov.   There is another server on this larger domain named gis.ndc.nasa.gov, which is gis.larc.nasa.gov. 

The problem is when we try to connect to on the network to \\gis for example it tries to connect to the machine gis.larc.nasa.gov, which we don't have access.  Therefore everything needs to reference gis.wff.nasa.gov.  This includes our SDE geodatabase.  Prior to this migration we could connect to it using GIS_SQLEXPRESS, but now I must type in GIS.WFF.NASA.GOV_SQLEXPRESS.  I am wondering if this is causing my issue.  I hope this is enough background information, but let me know if you need more.

Thanks,

Alex Brown
GIS Analyst
NASA Wallops Flight Facility



<html>

<head>

<meta http-equiv="X-UA-Compatible" content="IE=7" />

  <title>printMap (PCHPrintSOE)</title>

  <link href='https://community.esri.com/ArcGIS/rest/ESRI.ArcGIS.Rest.css' rel='stylesheet' type='text/css'>

<script>



                    function addParameter() {

                      var table = document.getElementById("parameterTable");

                      var numRows = table.rows.length;

                      

                     var row = table.insertRow((numRows - 1));

                     row.vAlign = "top";

                      var cell1 = row.insertCell(0);

                      cell1.innerHTML = "<input name='__paramName__' type='text' size='20' value='' />";

                      var cell2 = row.insertCell(1);

                      cell2.innerHTML = "<textarea name='__paramValue__' rows='3' cols='50'></textarea>";

                    }



                    function submitForm(method) {

                      var nameNodes = document.getElementsByName("__paramName__");

                      var valueNodes = document.getElementsByName("__paramValue__");

                      

                     var form = document.createElement("form");

                      form.method = method;form.action = "http://gis.wff.nasa.gov/ArcGIS/rest/services/layout/MapServer/exts/PCHPrintSOE/printMap"

                for (var i = 0; i < nameNodes.length; i++) {

                  var name = nameNodes.value;

                  var value = valueNodes.value;

               

                    name = name.replace(/\ /g, "");

              

                    if(name) {

                    var field = document.createElement("input");

                    field.type = "hidden";

                    field.name = name;

                    field.value = value;

                    form.appendChild(field);

                  }

                }

              

                document.body.appendChild(form);

                form.submit();

            }

</script>

</head>

<body>

<table width="100%" id="userTable">

<tr>

<td id="titlecell">ArcGIS Services Directory</td>

</tr>

</table>

<table id="navTable" width="100%">

<tbody>

<tr valign="top">

<td id="breadcrumbs">

<a href="https://community.esri.com/ArcGIS/rest/services">Home</a> > <a href="https://community.esri.com/ArcGIS/rest/services/layout/MapServer">layout (MapServer)</a> > <a href="https://community.esri.com/ArcGIS/rest/services/layout/MapServer/exts/PCHPrintSOE">PCHPrintSOE</a> </td>

<td align="right" id="help">

<a href="http://GIS/ArcGIS/SDK/REST/servicesdirectory.html" target="_blank">Help</a> | <a href="?f=help" target="_blank">API Reference</a></td>

</tr>

</tbody>

</table>

<div class='restHeader'>

<h2>printMap (PCHPrintSOE)</h2>

</div>

<div class='restBody'>

<form>

<table style="border:1px solid #000000;">

<tr valign="top">

<td>mapExtent: </td>

<td><textarea name="mapExtent" rows="10" cols="50"></textarea></td>

</tr>

<tr valign="top">

<td>printOutput: </td>

<td><textarea name="printOutput" rows="10" cols="50"></textarea></td>

</tr>

<tr valign="top">

<td>mapElements: </td>

<td><textarea name="mapElements" rows="10" cols="50"></textarea></td>

</tr>

<tr valign="top">

<td>mapServices: </td>

<td><textarea name="mapServices" rows="10" cols="50"></textarea></td>

</tr>

<tr>

<td>Format:</td>

<td>

<select name="f">

<option value="pjson" selected='true'>json</option>

</select></td>

</tr>

<tr><td colspan="2"><input type="submit" value="printMap" /></td></tr>

</table>

</form>


outputFile: http://gis/arcgisoutput/PrintTask_layout_1307476698542_map.pdf<br/><br/></div>

</body>

</html>
0 Kudos
TomSchuller
Frequent Contributor
albroham,
your installation seems to work because your html ouput contains:
outputFile: http://gis/arcgisoutput/PrintTask_layout_1307476698542_map.pdf


DId you use the latest PCHPrintSOE version (at least 30/05/2011):
  http://www.arcgis.com/home/item.html?id=6809086326ea4c76bf026a32bb9dd698

It seems that the param "f=json" is missing. This is fixed in the latest version.

Download both parts: Java + Flex

Tom
0 Kudos