Silverlight printing sample

6926
52
05-25-2011 11:22 AM
DanDong
New Contributor
Hi everyone,

I am using the silverlight printing sample from code gallery (http://www.arcgis.com/home/item.html?id=e361c2cc69784fcba34358d0458f66e3).

According to the ReadMe, I should add a reference to the MapPrintingControls.dll (located at
MapPrintingControls/Bin/Release) to my silverlight application.

But I cannot find MapPrintingControls.dll in that path and neither the whole download folder, thus I cannot add this reference. Does anyone has clue for this? or if you have the dll, could you please share it with me 🙂 Really appreciate.
0 Kudos
52 Replies
PaulHuppé
Occasional Contributor
Hi Dominique,

Thanks for the reply.  I will have a look at the code and start tweaking!  The longest thing to do is localisation. For landscape mode, I will give it a try.  I was wondering if when you pick landscape in the printer properties if it would stretch or if it would leave the size of the map as is.

Cheers,
Paul
0 Kudos
DominiqueBroux
Esri Frequent Contributor

I was wondering if when you pick landscape in the printer properties if it would stretch or if it would leave the size of the map as is.



Yes, when you select a printer, the mapprinter will stretch automatically to the printer area depending on the printer size, the printer orientation,....
As a consequence, when the scale is fixed, the number of printed pages can be different of the number of pages shown initially in the printer dialog.
Nevertheless, the print dialog keeps the parameters of the latest print. So after printing once in landscape mode, the printer dialog will show the result in landscape mode.
0 Kudos
PaulHuppé
Occasional Contributor
Thanks Dominique.
0 Kudos
DanDong
New Contributor
Hey Dominique, I use the two types of print styles in my application, one is with legend and the other is with text. The one with legend works well. But there is some wrong with the one with text. I actually need the text change instead of keeping it fixed. So the logic is that first it will perform a spatial query, then a childwindow pop up to show the query result, the summary information and two buttons[ATTACH]10494[/ATTACH]. So if the user clicks 'Generate printable report', he will see the report that is going to be printed[ATTACH]10495[/ATTACH]. The text on the left side will actually changed as the spatial query results. I put a textloaded event in the printer style. Then I found for the first time, the map and the text in the print report is correct. But if I close it and do another spatial query, the stuff showed in the print report doesn't change, which should change since I go to another place to draw a polygon and do the spatial query. My first thought is that maybe the binding is wrong. But I realize that the binding should be correct since for the first time both map and text info are good. It looks like the print page never get updated! Could you advice what might be the problem? I have struggled for a few days but still didn't get is solved 😞 Thank you advance!

<!-- Header -->
                                        <StackPanel Background="{TemplateBinding Background}" Grid.Row="0" Grid.ColumnSpan="2">
                                            <TextBlock Text="{Binding Title, RelativeSource={RelativeSource TemplatedParent}}" HorizontalAlignment="Center" FontSize="12" 
               Visibility="{Binding Title, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource toVisibility}}" />
                                        </StackPanel>

                                        <!-- Body-->
                                        <StackPanel Grid.Row="1" Grid.Column="0">
                                            <TextBlock TextWrapping="Wrap"
                     Loaded="WirtReportText_Loaded" FontSize="14" Margin="5"/>                                            
                                        </StackPanel>
                                        <StackPanel Grid.Row="1" Grid.Column="0" VerticalAlignment="Bottom" Orientation="Horizontal">
                                            <Image Height="100" Width="50" Source="/wirt1.0;component/Images/IDNRlogo1.png" />
                                            <Image Height="100" Width="200"  Source="/wirt1.0;component/Images/DIRT_logo.png" />
                                        </StackPanel>
                                        <Grid Grid.Row="1" Grid.Column="1">
                                            <!-- Map-->
                                            <esri:Map x:Name="PrintMap" IsLogoVisible="False"
                                                  controls:CloneMap.Map="{TemplateBinding Map}"
              controls:SurrogateBinder.OverviewMapPrinter="{Binding RelativeSource={RelativeSource TemplatedParent}}">                                               
                                            </esri:Map>
0 Kudos
DanDong
New Contributor
Never mind. I figure that out. It is because that I didn't set the isactive property binded to the button, so clicking button doesn't make the map refreshed.
0 Kudos
DominiqueBroux
Esri Frequent Contributor
Glad you got it to work:).
Seems to be a very nice usage of the print sample.
0 Kudos
HariAdduri
New Contributor
Dominique,
     Is there any way i can provide interface for the user to select the page layout and page size on the print window. I prefer making the default Layout to 'Landscape' if there is a possibility. As of now the user we have to go to 'Properties' and 'Advanced Preferences' for setting these attributes, it will be helpful for the user if these options are provided on the print options page.
Let me know.
Thanks,
Hari
0 Kudos
DominiqueBroux
Esri Frequent Contributor
Dominique,
Is there any way i can provide interface for the user to select the page layout and page size on the print window.

AFAIK, there is no Silverlight native solution to do that.

It's possible to do it with WPF (using System.Drawing.Printing namespace) and it's probably possible to do it with circonvoluted Silverlight code in OOB with elevated trust permissions, but I never tested that.

To facilitate the choice between landscape and portrait, the users might create 2 printers with different default properties pointing to the same device. So they have just to select the printer.
0 Kudos
thilagavathi
New Contributor
hai,
 
am using silverlight with microsoft visual web developer 2010 express, how to retrieve the following error

No best type found for implicitly-typed array
0 Kudos
DominiqueBroux
Esri Frequent Contributor
[INDENT]hai,

am using silverlight with microsoft visual web developer 2010 express, how to retrieve the following error

No best type found for implicitly-typed array [/INDENT]

In lack of any context, I can just redirect you to the general error description : http://msdn.microsoft.com/en-us/library/bb384226.aspx
0 Kudos