API 2.0 and Printing to scale

1313
16
08-01-2010 08:40 PM
BrianBorg
New Contributor
I am using the API 2.0 and I want to print maps using pre-defined scales (e.g. 1:1000, 1:2500, etc.) on different papersizes up to A0. I also want to use print templates. I think that I need to use some sort of services (e.g. ArcObjects) to generate such maps. Are there any examples around? or can someone point me to the right direction please?

I have read that there is something called layout SOE. What is it? How to use it?
0 Kudos
16 Replies
DominiqueBroux
Esri Frequent Contributor
I am going to write a print sample (at the client side) which is multi pages and printing at fixed scale.

A first version is available here :
http://broux.dominique.free.fr/Silverlight/MapPrinting/MapPrinting.html

Your feedback would be appreciated.

I will post the code soon

Note : The print extent is the current map extent at the time the preview window is opened. I guess, a way to change the print extent from the preview would be useful.
0 Kudos
JohnPalmbach
New Contributor II
The sample looks great Dominique.  I'll be excited to see the source code whenever it's available.  Thanks
0 Kudos
BrianBorg
New Contributor
Excellent example. My only question remains how can I generate images large enough to be printed on for example A0 paper?
0 Kudos
JoshuaDye
New Contributor III
I am having this issue as well can you post the printing code. Thanks.

I am going to write a print sample (at the client side) which is multi pages and printing at fixed scale.

A first version is available here :
http://broux.dominique.free.fr/Silverlight/MapPrinting/MapPrinting.html

Your feedback would be appreciated.

I will post the code soon

Note : The print extent is the current map extent at the time the preview window is opened. I guess, a way to change the print extent from the preview would be useful.
0 Kudos
DominiqueBroux
Esri Frequent Contributor
Excellent example. My only question remains how can I generate images large enough to be printed on for example A0 paper?


I did some tests with A0 printer driver.

I ran into 2 limitations:

1) Need to decrease the printer resolution when the size increases

From A2 size, 600dpi is no more working, I have to use 300dpi or less
With A0, 300dpi is not working, need 150dpi or less.

Not working means that nothing happens when clicking OK in the printer dialog box.
As I only tested on one machine and one high size driver, I don't know if it's a generic Silverlight behavior in order to limit the size of the print job or if it's tied to my OS or my driver.

2) With my sample, the ArcGISDynamicMapService layers don't print from A2 size. Unfortunately I don't think I will find a workaround soon:(

Here are the results of my tests (with PDF driver):
- A4 600dpi (default)
- A3 600dpi
- A4 4 pages 300dpi (would work with 600dpi, I set 300 to limit the result size)
- A4 16 pages 150dpi (would work with 600dpi, I set 150 to limit the result size)
- A2 300dpi (I was unable to get better resolution)
- A0 150 dpi (I was unable to get better resolution)





�??
0 Kudos
DominiqueBroux
Esri Frequent Contributor
I just posted the print sample on the ArcGIS.com code gallery : http://www.arcgis.com/home/item.html?id=e361c2cc69784fcba34358d0458f66e3

It would have needed a few code refactoring and clean-up but as I am in vacations 🙂 during the next 2 weeks:), I'd rather to post it as is. So I'll get your feedbacks when I am back.
0 Kudos
KevinSesock
New Contributor
I just posted the print sample on the ArcGIS.com code gallery : http://www.arcgis.com/home/item.html?id=e361c2cc69784fcba34358d0458f66e3

It would have needed a few code refactoring and clean-up but as I am in vacations 🙂 during the next 2 weeks:), I'd rather to post it as is. So I'll get your feedbacks when I am back.


Dominique:

Wanted to thank you for your awesome print controls. Unfortunately, having a bit of trouble integrating it into my application. As you may be able to gather from my posting history, I'm a bit new to Silverlight, so I'm still learning the ropes.

Long story short, my print_preview button (utilizing your ToggleVisibilityAction) doesn't do anything, and my Button utilizing the PrintCommand Binding is disabled. What determines if the control bound to PrintCommand will be enabled or disabled? I'm still working on the ToggleVisibilityAction, but please keep in mind, as new as I am to Silverlight, I'm even more new to MVC.
0 Kudos
DominiqueBroux
Esri Frequent Contributor
Hi Kevin,

Thank you for your nice feedback.


What determines if the control bound to PrintCommand will be enabled or disabled?


The command is disabled if the map attached to the map printer is null or is being printed.
I guess your issue is coming from the map binding. Check that the map element name (Map is this sample) is the right one:
 
<esri:Map x:Name="Map" Background="White" Extent="-400000, 5230000, 840000, 6870000">
<esri:ArcGISTiledMapServiceLayer ID="Basemap" Url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" />
<esri:ArcGISDynamicMapServiceLayer ID="TourDeFrance" Url="http://88.191.74.143/ArcGIS/rest/services/TourDeFrance2010/MapServer" Opacity="1.0" />
</esri:Map>
 
.......... 
 
 <controls:PrintPreview x:Name="PrintPreview">
<controls:MapPrinter x:Name="mapPrinterWithPreview"Map="{Binding ElementName=Map}" PrintDocumentName="Tour de France 2010" IsActive="True" Height="1050" Width="750"
BorderBrush="#20000080" BorderThickness="2" Foreground="White" Background="{StaticResource CommonBackgroundBrush}" />
</controls:PrintPreview>




my print_preview button (utilizing your ToggleVisibilityAction) doesn't do anything

No clue without more info. I suggest you set IsActive to True, so you should see the print preview without using the button. (You might also try to set the Visibility of the PrintPreviewPanel to 'Visible' instead of using a binding :
 
<local:WindowPanel x:Name="PrintPreviewPanel" Width="340" Height="405" Effect="{StaticResource dropShadow}"
Background="{StaticResource CommonBackgroundBrush}"
Visibility="Visible"
VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,60,10,0" BorderBrush="{StaticResource CommonBorderBrush}">
).
0 Kudos
KevinSesock
New Contributor
Hi Kevin,

Thank you for your nice feedback.



The command is disabled if the map attached to the map printer is null or is being printed.
I guess your issue is coming from the map binding. Check that the map element name (Map is this sample) is the right one:
 
<esri:Map x:Name="Map" Background="White" Extent="-400000, 5230000, 840000, 6870000">
<esri:ArcGISTiledMapServiceLayer ID="Basemap" Url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" />
<esri:ArcGISDynamicMapServiceLayer ID="TourDeFrance" Url="http://88.191.74.143/ArcGIS/rest/services/TourDeFrance2010/MapServer" Opacity="1.0" />
</esri:Map>
 
.......... 
 
 <controls:PrintPreview x:Name="PrintPreview">
<controls:MapPrinter x:Name="mapPrinterWithPreview"Map="{Binding ElementName=Map}" PrintDocumentName="Tour de France 2010" IsActive="True" Height="1050" Width="750"
BorderBrush="#20000080" BorderThickness="2" Foreground="White" Background="{StaticResource CommonBackgroundBrush}" />
</controls:PrintPreview>





No clue without more info. I suggest you set IsActive to True, so you should see the print preview without using the button. (You might also try to set the Visibility of the PrintPreviewPanel to 'Visible' instead of using a binding :
 
<local:WindowPanel x:Name="PrintPreviewPanel" Width="340" Height="405" Effect="{StaticResource dropShadow}"
Background="{StaticResource CommonBackgroundBrush}"
Visibility="Visible"
VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,60,10,0" BorderBrush="{StaticResource CommonBorderBrush}">
).


Unfortunately, my Binding to my Map control is correct. Setting IsActive=true on the print preview panel brings up the PrintPreviewPanel, but with nothing inside it. I'm at a loss as to why it doesn't seem to want to handle my map.
0 Kudos