Select to view content in your preferred language

Advanced print solution

53763
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
Thanks for the response Tom,
When you tell me to look in the mxd for the source of the problem...which problem?  The print error?
If so, when the error is kicked out - the only files generated are .tmp files. 
With regards to the layer that is not showing up in the output....I looked in the mxd and the layer is there, it is turned on, but it does not display.  I'm wondering if it has something to do with scale dependency...I do have it set for this feature even though the feature will not turn off until you are zoomed out beyond 8400...
One last question - it appears that I may have some issue relating to switching the paper sizes to inches..if I switch the page sizes to inches in the xml file, can you tell me where I would need to adjust the map scale calculations?  I blieve it may be around lines 356-363 in the mxml.
Thank you for your time Tom.
Eric
0 Kudos
TomSchuller
Frequent Contributor
Eric,
if you have problems and the mxd isn't generated, you have to set the ArcGIS server log to verbose and check the log files.

You are saying that the mxd is correct, but the data isn't displayed. There seems to be a problem in the mxd with the layer. The PrintSOE is just generating the map (content of mxd) and is exporting it.

If the content is'nt valid in the mxd, it can't be exported.
The question is, why is the layer not displayed in the mxd.

For working with inches, you have to set the correct pageUnits of the PchPrintOutput object.
See PchPrintOutput-line138 and PchPrintWidget.mxml-line266.

Tom
0 Kudos
EricVenden
Frequent Contributor
Thank you Tom,
Since I have recompiled the widget, the error I had originally posted appears to have disappeared.  Both the mxd and the pdf/png are generated on the server.  I still have 2 problems.  The parcel lines are not displaying on the output files, even though they are on in the Flex Viewer.  The parcel lines are shown in the output mxd and pdf/png as being "on", but they are missing from the actual display.  The parcel lines feature class is joined to a data table and is set to turn off when you zoom out beyond 8400.  Not sure if this is related to the join?  Seems a bit strange..
My other issue is the scale of the print.  I pick a scale using the widget and the red box appears as it should - that is, it covers the proper extent for the selected scale.  When the pdf is generated, however, the scale has changed dramatically.  I set the print scale at 2400(1:200), but when the output is generated it reads as 1:7874.02.
Any ideas?  Thank you again for your time Tom.
Eric V
0 Kudos
TomSchuller
Frequent Contributor
Eric,
I updated the Flex and Java code concerning the font size in the ScaleText.
You can now configure a TextSymbol which contains a textFormat object to format your text.

Could you post the tmpurl and the mxd concerning your scale problem.

Tom
0 Kudos
DavidCaussin
Deactivated User
Hi Tom,

Everything works fine now.

but i receive e error when the pdf is to be open in the navigator.

It is the

Server Error
500 - Internal server error.

The pdf is well generate in the arcgisoutput and readable on the server but not throw IE 😞

any idea??

Thanks a lot

David
0 Kudos
TomSchuller
Frequent Contributor
David,
when you run the Flexview in debug modus, you will got written out the "tmpurl" in the console window.

When you open this url in your browser, you should got a json url containing an url.
This url should point to your pdf in the arcgisoutput directory.

Could you try to open this url in your browser?

If this doesn't work:
- are you running on Windows/Linux?
- did you use ArcGIS-Server Java or .NET?
- could you post both url's (tmpUrl + pdfUrl from answer)?

Tom
0 Kudos
EricVenden
Frequent Contributor
Eric,
I updated the Flex and Java code concerning the font size in the ScaleText.
You can now configure a TextSymbol which contains a textFormat object to format your text.

Could you post the tmpurl and the mxd concerning your scale problem.

Tom


Hi Tom,
Thank you for updating the code..I have incorporated this addition to my application.  My map services are not publicly accessible...could I attach screen shots?  I believe part of my issue is the print extent calculations.  I do notice you do some calculations in lines 358-361 of the PchPrintWidget for print extent.  You indicate this is cm's and meter's...I'm guessing I have to adjust these..also those calculations use the currentScale - which is set in line 72 as 300000....I think this may have to be changed also?
Thank you
Eric
0 Kudos
TomSchuller
Frequent Contributor
Eric,
I don't need access to the url's.
I just want to analyze the url itself and compare it with the mxd you got.

In line72, the scale is just initialized.
The widget calculates the scale automatically in the layout view.

Tom
0 Kudos
EricVenden
Frequent Contributor
Tom,

I have attached the mxd,pdf, and png.  I apologize, but I'm not sure what you mean by tmpurl...The url of the pdf is:http://gis-srv3.village.gurnee.il.us/arcgisoutput/PrintTask_layout_1302718599166_layout.pdf 
You will notice in the pdf that the scale is 1:4724...I set the scale to be 1:12000 (1 in = 1000 ft)...

See attached.
Thank you
0 Kudos
TomSchuller
Frequent Contributor
Eric,
for the tmpUrl, start the FlexViewer in debug-mode in your FlashBuilder.

After you maked you print, take a look at the console window of your debugger.
There should be displayer an url accessing the PrintSOE.

Could you also post that one?

Tom
0 Kudos