Select to view content in your preferred language

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

10670
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
DominiqueBroux
Esri Frequent Contributor
0 Kudos
weiliang
Deactivated User
Thanks for your reply. But I still confused on how to "print a control that contains a map plus header etc". Should I create a user control and add the map control and scale bar, etc into it (how to maintain the map extent and make the whole map just fit onto the page)?

Best,

Wei
0 Kudos
LisaChesley
Emerging Contributor
Good afternoon, Wei!

I have since polished my print application, and it now includes legend information, graphics, and custom titles, and the user can preview the map before they print it.  If it would be helpful to you, I'd be happy to post a stripped down version of the application for you to see.  Controlling the size of the print page was a matter of trial and error - a 500x500 pixel map, for instance, will print nicely on an 8.5 x 11 sheet of paper with room at the bottom for notes, and at the side for a legend.

I'm sad to say many trees died to bring you this information. 😉

Please let me know if the application would be useful!

Lisa Chesley
0 Kudos
LisaChesley
Emerging Contributor
I just tried to upload my quickie printing project, and I got the following:

The requested resource
/newattachment.php
does not allow request data with POST requests, or the amount of data provided in the request exceeds the capacity limit.
ArcWS/4.0.20 Server at forums.arcgis.com Port 80

The .rar file is just over 1MB and the attachment tool says I can have 2MB, so is there a mismatch somewhere?

In the meantime, I'd be happy to email the project to anyone who'd like to see it.  Just post back with an email address that I can reach you at, and whether you'd like .zip or .rar.

Thanks!

Lisa
0 Kudos
MarkFlory
Deactivated User
Lisa, I would like to look at your example.  mflory-at-burnsmcd.com.  Thanks.

I In the meantime, I'd be happy to email the project to anyone who'd like to see it.  Just post back with an email address that I can reach you at, and whether you'd like .zip or .rar.

Thanks!

Lisa
0 Kudos
weiliang
Deactivated User
Many thanks for your kindly help, Lisa. I appreciate it very much. You may send your example to lwconquer@gmail.com if possible.

BTW, I put all my desired info (scale bar, title, and a map control) into one Child Window (name: ChildWindow), and try to print a grid control inside this child window by using new SL 4 class. The initial size of this Child Window is small (e.g., 300 width and 400 height),  and I try to readjust it to make it fit the whole paper after it print to the paper. Does anyone have any idea how I can do that?

Thanks,

Wei
0 Kudos
LisaChesley
Emerging Contributor
I have fired off the project to those that have requested it so far - hopefully you find it helpful!  If anyone else would like it, please give an email address and I'll send it.

Thanks!

Lisa
0 Kudos
russellham
New Contributor
Lisa,

Could you send your sample to rham@kcsgis.com? Many thanks in advance.

Rusty
0 Kudos
LisaChesley
Emerging Contributor
Good morning, Rusty!

I've sent you the project.  Please feel free to email me back with any questions!

Thanks!

Lisa
0 Kudos