Printing in SL 2.0 comparsion

4829
59
10-04-2010 05:27 AM
LakshmananVenkatesan
Occasional Contributor II
Dear All:

We have developed Print functionality in Web application using ESRI SL 1.2, ArcGIS 9.3.1. Client application willl send all visible layers, graphics (poly,line and point) as string , text symbols as string to server side and recreate a map document and construct geometry from string and generate a image and display in web page.

If we have say 100 lines as graphics, string which we generate is very big and unable to process( or send via http). Server side is done using GP Tool. Question is we have planned to move to ArcGIS 10 and SL 2.0.

What are all advantages in print functionality using ArcGIS 10 and SL 2.0  (MS SL 4.0) or rather how easy to print the map with graphics and other options ?

Please throw light on this
0 Kudos
59 Replies
dotMorten_esri
Esri Notable Contributor
Silverlight 4 comes with built-in APIs for printing, so you don't need to roundtrip to the server. Basically you can print out any control. That control could be either the map, or a custom user control that contains the map, a title etc.
0 Kudos
LakshmananVenkatesan
Occasional Contributor II
Silverlight 4 comes with built-in APIs for printing, so you don't need to roundtrip to the server. Basically you can print out any control. That control could be either the map, or a custom user control that contains the map, a title etc.



Iam adding some graphics (polygon,line, point) n graphisc layer, can print API accomdate custom graphics also?.  I have map with several dynamic layer,feature layer, graphics laeyer. I want print of all the same in  a single click, will that level of sophistication is available?

Please elobrate
0 Kudos
DominiqueBroux
Esri Frequent Contributor
Using the Silverlight print API, you can print any control.
If the printed control contains a map with several dynamic layer,feature layer, graphics layer... , all these layers will be printed.

It becomes a little more difficult if you want a print preview or if you want to print at scale. In this case you may need to clone the map, and so you need to clone all the layers as well.

A little time ago,I posted a print sample allowing:
- print preview
- print at scale
- print on multi pages
- templatable print pages

This sample can be tested here.

The silverlight limitation I noticed is that SL don't allow to print using large format and high resolution (probably because Silverlight's print implementation is done by printing to a bitmap and this bitmap could become huge).
For example to print in A0 I have to reduce the the printer resolution to 150dpi.
0 Kudos
LakshmananVenkatesan
Occasional Contributor II
Thanks for wonderful sample and replies.
0 Kudos
NathalieNeagle
New Contributor III
Dominique,

Your sample is great but I'm having a little bit of trouble migrating your printing code to my application do you have any documentation to do this?

Thanks
Nathalie
0 Kudos
DominiqueBroux
Esri Frequent Contributor
Hi Nathalie,

I am sorry, there was no documentation on how include the controls in a new project.

I just posted a new version with a Readme (readme.txt under MapPrintingControls) and a few bugs/enhancements to simplify the user experience with Blend.

Please download this new version and let me know if you get any problem with.

Thanks
0 Kudos
NathalieNeagle
New Contributor III
Thanks Dominique,
I will check it out.
Nathalie
0 Kudos
SamuelDantas
New Contributor
Dominique,

I'm trying to change the layout of the page by changing the template property in execution time to another ControlTemplate definition but it's not working.

How can I change the template in execution time?

Thanks a lot.
0 Kudos
DominiqueBroux
Esri Frequent Contributor
To change the layout of the page with Blend:

  • Right click on the map printer control

  • Select 'Edit Template'

  • Select 'Edit a Copy'

  • Accept the creation of the new style

  • You can now change the page layout

Basically, the template property in XAML looks by default like this:
 
         <Setter Property="Template">
          <Setter.Value>
           <ControlTemplate TargetType="controls:MapPrinter">
            <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="0">
             <Border Padding="{TemplateBinding Padding}" Background="{TemplateBinding Background}" Margin="0">
              <Grid>
               <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition />
                <RowDefinition Height="Auto"/>
               </Grid.RowDefinitions>
 
               <!-- Header -->
               <TextBlock Text="{Binding PrintDocumentName}" HorizontalAlignment="Center" FontSize="12" Grid.Row="0"
                Visibility="{Binding PrintDocumentName, Converter={StaticResource toVisibility}}"/>
 
               <!-- Body-->
               <Grid Grid.Row="1">
                   <!-- Map-->
                   <esri:Map x:Name="PrintMap" IsLogoVisible="False" />
                  <!-- Scale Bar -->
                  <esri:ScaleBar Map="{Binding ElementName=PrintMap}" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="20,0,0,10" Grid.Row="1" TextColor="Black"/>
               </Grid>
 
               <!-- Footer -->
               <TextBlock HorizontalAlignment="Left" VerticalAlignment="Bottom" Grid.Row="2"
                Text="{Binding Now, StringFormat='Printed \{0:d\} '}" />
               <TextBlock HorizontalAlignment="Center" VerticalAlignment="Bottom" Grid.Row="2"
                Text="{Binding Scale, StringFormat='1 : \{0:F0\} '}" />
               <StackPanel HorizontalAlignment="Right" VerticalAlignment="Bottom" Orientation="Horizontal" Grid.Row="2">
                <TextBlock Text="{Binding CurrentPage, StringFormat='Page \{0\} '}" />
                <TextBlock Text="{Binding PageCount, StringFormat=/ \{0\}}" />
               </StackPanel>
              </Grid>
             </Border>
            </Border>
           </ControlTemplate>
          </Setter.Value>
         </Setter>


By changing this template, you will change the layout of the page.
0 Kudos