Select to view content in your preferred language

Flex Viewer printing

2858
10
06-29-2010 02:25 PM
DanielSmith
Frequent Contributor
hello,

I have read through the forums and not sure if its a function of the new search appliance that is used but i am failing to find good information on printing the Flex viewer map plus the open widgets.  The current print widget does a dandy job printing the map itself but clients are asking for the ability to include the open widgets in the printed map. any suggestions would be graciously accepted and returned with a bump. thank you very much and have a nice day.

Daniel,
some GIS guy
Tags (2)
0 Kudos
10 Replies
RobertScheitlin__GISP
MVP Emeritus
Daniel,

   This is how you do it.

In the PrintWidget.mxml add this import and change the line bellow that I have commented out to the new line below it.

            import com.esri.solutions.flexviewer.SiteContainer;
                                 var bmpMap:BitmapData = ImageSnapshot.captureBitmapData(SiteContainer.getInstance());
               //var bmpMap:BitmapData = ImageSnapshot.captureBitmapData(map);
0 Kudos
DanielSmith
Frequent Contributor
Thanks Robert, that works great. Is there a way to specify individual items with in the container to include or exclude from the print/exported version? 

This is actually the 5th time i have tried to reply hopefully it works. Also i guess the Support forum has not implemented the "mark as answered" or the tools to give you credit (for the MVP program), i will check back and bump you when the functionality is there. But for the time being "Bump" to you kind sir.

Daniel
0 Kudos
philippschnetzer
Frequent Contributor
Is there an update to this for FV2.1 ? The code above does not seem to work for the latest viewer...
Thanks.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Phillip,

   Sure just use:

import com.esri.viewer.ViewerContainer;
                                 var bmpMap:BitmapData = ImageSnapshot.captureBitmapData(ViewerContainer.getInstance());
0 Kudos
WillHughes1
Frequent Contributor
var bmpMap:BitmapData = ImageSnapshot.captureBitmapData(map);

Is this above what you would use to grab a snapshot of the last map image, if for instance you want to insert the map image snapshot into a report?

Anyone out there have a tool that does this or something similar?
I want to query two points on the map, zoom to the two points, and then get a snapshot of the map and have that inserted into a report (report is a cf page but it could be .mxml or html).

Thanks.

Will
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Will,

  Yep that will work for getting the bitmap data but that is not a image in the sense of something like a jpg that you could share with some html code. You are dealing with client memory and if you have to get an actual image (like a jpg) to the server than you have a lot more to do. I prefer to handle all the report generation and printing client side in actionscript or mxml code. Anyway to accomplish what you are asking for you need to add an event listener to the map service that the two points are in and listen for com.esri.ags.events.LayerEvent.UPDATE_END and on that event fire the image snapshot code.
0 Kudos
WillHughes1
Frequent Contributor
Ok, I get the idea.

So ArcGIS Server doesn't store the most recent map image somewhere on the ArcGIS server box?
It seems like a .PNG or .JPG would get written to the server every time a user pans,zooms,etc.
I guess I am expecting it to work like ArcIMS(??).

Thanks.

Will
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Will,

   Well technically yes it does but you really have to understand how things work under the hood. Each map service produces an image in it's default format on the server and then Flex API merges those (Could be several)  images into one on the client. So if you have a map service coming from ArcGIS Online and it is cached than it is just returning those cached tiles that make up the AOI of your map but those come from the ArcGIS online server and not yours.
0 Kudos
LeeAllen
Frequent Contributor
Thanks Robert, that works great. Is there a way to specify individual items with in the container to include or exclude from the print/exported version? 

Daniel


Is there an easy solution to get an individual widget to print?  I would like the static image widget to show up and none of the others?
0 Kudos