Select to view content in your preferred language

Is there any print example that can be referenced for SL 4?

10730
71
07-14-2010 01:18 PM
weiliang
Deactivated User
I try to incorporate the print feature into our website (with SL 4, and ESRI API 2.0). I used the following code, but it direct me to the print dialog box only. How can I make a print template (e.g., http://citizengis.chesterfield.gov/) to print the current map extent with some controls (e.g, scale bar) into a pdf. Is there any easy way to do so or I must create a WCF service?


PrintDocument doc = new PrintDocument();
doc.PrintPage += (s, e) =>
{
   e.PageVisual = MyMap
   e.HasMorePages = false;
};
doc.Print("Map");

Many thanks,

Wei
0 Kudos
71 Replies
LisaChesley
Emerging Contributor
Good afternoon, Scott!

I've sent the project - please don't hesitate to ask if you have any questions.

Thanks!

Lisa
0 Kudos
JoshV
by
Regular Contributor
Does Lisa's Print Function allow printing to scale?  Many folks are asking for a way to print to scale before the PDF is created.  If so can you email me your print function too Lisa?  my email is josh_vickrey@swn.com

Thanks Lisa

-Josh
0 Kudos
LisaChesley
Emerging Contributor
Good afternoon, Josh!

I've seen that mentioned before, and pardon my lack of GIS knowledge (I'm a .NET/Silverlight developer by trade, and am very new to all things geographic), but could you clarify what you mean by print to scale, please?

Thanks!

Lisa
0 Kudos
JoshV
by
Regular Contributor
Good afternoon, Josh!

I've seen that mentioned before, and pardon my lack of GIS knowledge (I'm a .NET/Silverlight developer by trade, and am very new to all things geographic), but could you clarify what you mean by print to scale, please?

Thanks!

Lisa


Hi Lisa-

So for instance in the Silverlight Print Function, the user would select that they want a PDF and they want it to be 1 inch = 100 feet.  So there would probably be a dropdown with the option of 1" = 100' and 1" = 200', etc..  When the PDF is produced 1 inch on the PDF would be exactly 100 feet.  Hope that helps
0 Kudos
LisaChesley
Emerging Contributor
Good morning, Josh!

Thank you for the clarification - no, my print sample does not do anything of the sort.  My users haven't requested it, however, as they are mainly concerned with printing out very small geographic areas (usually a single property), and want to print out exactly what they're seeing on the screen.

Off the top of my head, I can't think of any way to get that working, except to allow the user to pick the scale before they print, and then somehow zoom your print preview map to scale before showing it to the user.

I'm going to send you the sample anyway, and you can see how it works - Silverlight printing does *not* allow much in the way of fit to page, or other functionality you may have become used to in the past.

Thanks!

Lisa
0 Kudos
BruceVandenberg
Emerging Contributor
Lisa:
Could you send me your code sample at bruce.vandenberg@comcast.net ? Thanks much.

Bruce
0 Kudos
LisaChesley
Emerging Contributor
Good morning, Bruce!

Project sent!  If you have any questions, please let me know!

Thanks!

Lisa
0 Kudos
BruceVandenberg
Emerging Contributor
Lisa:
      Very nice job on code! Have you considered a scalebar to tell what scale you print at?

Bruce
0 Kudos
LisaChesley
Emerging Contributor
Good morning, Bruce!

Thank you for pointing that out - I threw that project together in a bit of a hurry, and must have forgotten to add a scale bar.  The other projects I'm working on all have one, though - they're quite useful, and very easy to add now with element binding.

In the interests of keeping the printing project lean and mean, though, I'll leave that up to your discretion to add or not.

Thanks!

Lisa
0 Kudos
JamesS1
Regular Contributor
Lisa:
Could you send me your code sample at jsamek@nycwatershed.org? Thanks much.

James
0 Kudos