Select to view content in your preferred language

Advanced print solution

46756
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
Hy,
I just fixed it yesterday evening.
Could you download the latest widget code of BitBucket?
http://bitbucket.schuller.lu

Tom
0 Kudos
DominiqueBerger
New Contributor II
Excellant - thanks Tom, it is working well now
0 Kudos
Nature-ActionQuébec
New Contributor
Hi Tom,
Thanks for this nice widget.
I'm trying to install this widget with the new code from http://bitbucket.schuller.lu/pchprintsoe/overview, but I have problems.
All is OK for the installation for PrintSOE (from Java). I have my printmap service url like : http://servercarto/GEONAQWEB/rest/services/layout/MapServer/exts/PCHPrintSOE/
All the setup is OK as in the documentation. But I have an error message and I don't know what can I do with that.
Any ideas, please?
Thanks a lot
0 Kudos
TomSchuller
Occasional Contributor III
Hy,
could you configure the "debug messages" in your PchPrintWidget.xml:

<Debug enabled="true"/>


and post it?

Could you also post or mail (tom@schuller.lu) the verbose arcgis server loges?

Here you find the instructions: http://bitbucket.schuller.lu/pchprintsoe/wiki/ErrorReporting

Thanks,
Tom
0 Kudos
EricGardecki
Occasional Contributor
Hey Tom et al,

I'm trying to figure out an issue I just noticed while using your widget.  I use Google Chrome for most of my internet activities including my testing of the print widget.  Everything is working fine there.  However, when I use Internet Explorer, and print a JPG, IE doesn't seem to respect the resolution/scale...if that makes sense.  The JPG that is created does not fit on the page that it is supposed to.  For example, the print widget is set to JPG, letter size (8.5"x11"), and 200dpi.  When trying to print the resulting image (in IE), the image is much larger (roughly 200% but not exactly) more than the paper it's supposed to be on. This does not happen in Chrome, nor is it a problem using PDF instead of JPG.  I can not find any settings in IE to adjust.   I know it has something to do with the pixels of the image and therefor how they fit on a real-world piece of paper, but I don't know what to do about it.

If I resize the popup window that the print image appears in, in Chrome, then I have the same issue.  But apparently something is forcing the pixel ratio to be correct when it pops up...this doesn't seem to happen in IE.   The easy way to deal with this is just default to PDF, and that works fine, but if a user wanted to do a JPG I want to be sure that when they print it the scale is not screwed up by this. 

Is there a setting that needs to be adjusted in IE, or the widget, so that the JPG image will print correctly in IE?

Hope that makes sense.  I found it rather difficult to describe..

Attached is the result when the output is set to JPG, using IE...printed to acrobat to create a pdf to share.  This is what comes out on the print.

Here is a direct link to the result, of the same map extent, when the output is set to PDF.  http://map.exetertownship.com/arcgisoutput/PrintTask_MapServiceMXD_1337185697392_layout.pdf

Thanks
0 Kudos
grahamcooke
Occasional Contributor
We had similar problems with jpg printing in toms soe. The workaround we found was to go to ie print options and set a custom size option using the drop down.  46% worked for us, but I suggest you play around with it and see what works for you. Also note that the orientation option you choose in the widget you still need to set in the print options of ie when you use jpg.

Hope this helps!
0 Kudos
TomSchuller
Occasional Contributor III
imgoch,
could you enable the debugging in the widget and post the messages for each browser:
- InternetExplorer
- Google Chrome
Don't make a zoom or a pan.Just open the viewer and make a print.

The messages should be the same for both browsers.

In the messages, you are getting the resulting image url.
You could try to open the printed image from Chrome in IE and vice versa.

I think, it's a display issue between the browsers.

Tom
0 Kudos
EricGardecki
Occasional Contributor
Graham,  Yeah it seemed like a little less than 50% is correct but I don't see how I could expect a public user to do this.  Even if I stated it somewhere in the "help", I doubt anyone would even read it.

Tom,  It's definitely a difference between the browsers and how they display.  The image is the same from each browser but they each handle it differently.  IE displays the image at 100% and wants to print as such but it is too big for the paper.  Chrome shrinks the image to fit in the browser without having to scroll.  For whatever reason, this is the correct size....at least when the browser window is full screen.(at least for me on this machine)  However, if I adjust the browser window to not be full screen (in height) then it shrinks the image even further so that it fits in this smaller window....which then causes the print to be a small portion of the paper instead.  I'm afraid to even try this on another machine with a smaller monitor or screen resolution.

I realize this is some product of the print resolution vs the screen resolution vs the browsers' handling of it...but how do I make it work?  In order to have the scale be correct, the images have to printed exactly as presented.  The widget was designed to create these images for print, and to be in scale...how do I ensure that that happens?

I going to force users to print to pdf, and that works perfectly, but for the rare user that doesn't have a pdf viewer, this would be a problem and I'd like to offer jpg as an option.

Thanks
0 Kudos
AngieAllison
New Contributor II
I just got the newest version of this widget running.  had old version running but had some bad areas.  What cache or map is this widget using for basemaps??  in the new widget i cannot get the scale bar to show the correct scale.  Got the scale text wokring but not the scale bar??  any help is much appreciated.
0 Kudos
TomSchuller
Occasional Contributor III

PM
imgooch,
I'm always generating PDF files to be sure that the printout is correctly with papersize and mapscale.
But you can never be sure if a user is printing a A3-pdf to a A4-paper with "fit-to-scale"

mburr,
could you post the generated print url?
  (http://bitbucket.schuller.lu/pchprintsoe/wiki/ErrorReporting)


Tom

0 Kudos