Iwan van Ee
Top achievements
Rank 1
Iwan van Ee
asked on 29 Nov 2012, 12:56 PM
Can I print the Map from the Mapcontrol? And even more specific can we print on papersizes bigger than A3?
3 Answers, 1 is accepted
0
Hi Iwan,
The printing of the RadMap content could be done using standard Silverlight approach.
The sample code is below.
Kind regards,
Andrey Murzov
the Telerik team
The printing of the RadMap content could be done using standard Silverlight approach.
The sample code is below.
<
UserControl
x:Class
=
"Printing.MainPage"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
mc:Ignorable
=
"d"
Height
=
"300"
Width
=
"400"
d:DesignHeight
=
"300"
d:DesignWidth
=
"400"
>
<
Grid
x:Name
=
"LayoutRoot"
Background
=
"White"
>
<
telerik:RadMap
x:Name
=
"radMap"
ZoomLevel
=
"4"
Center
=
"37.684297,-99.06924"
>
</
telerik:RadMap
>
<
Button
Content
=
"Print"
Name
=
"btnPrint"
Width
=
"75"
Height
=
"23"
HorizontalAlignment
=
"Right"
VerticalAlignment
=
"Top"
Click
=
"btnPrint_Click"
/>
</
Grid
>
</
UserControl
>
using
System.Windows;
using
System.Windows.Controls;
using
System.Windows.Printing;
using
Telerik.Windows.Controls.Map;
namespace
Printing
{
public
partial
class
MainPage : UserControl
{
public
MainPage()
{
InitializeComponent();
var provider =
new
OpenStreetMapProvider();
radMap.Provider = provider;
}
private
void
btnPrint_Click(
object
sender, RoutedEventArgs e)
{
PrintDocument document =
new
PrintDocument();
document.PrintPage += (s, args) =>
{
args.PageVisual =
this
.radMap;
};
document.Print(
"Silverlight Print Application Demo"
);
}
}
}
Kind regards,
Andrey Murzov
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
0
Adam
Top achievements
Rank 1
answered on 21 May 2013, 08:32 AM
i like this idea but i wonder what i should do if i want add lanscape A1 , lanscape A2 ,lanscape A3 in combobox ??
0
Hello Adam,
Actually this topic is a bit outside of the scope of the RadMap support. But I did a few experiments and searched on the Internet for a possible solution. I've found a very good article on Silverlight printing (including landscape printing) with ready to use code:
http://www.codeproject.com/KB/silverlight/SilverlightEasyPrint.aspx
I've copied the code from this page to my sample application and I was able to print RadMap in landscape mode with full map fit to page. The calling code is simple (it is possible after adding the code from this article):
I hope it will help you.
All the best,
Andrey Murzov
the Telerik team
Actually this topic is a bit outside of the scope of the RadMap support. But I did a few experiments and searched on the Internet for a possible solution. I've found a very good article on Silverlight printing (including landscape printing) with ready to use code:
http://www.codeproject.com/KB/silverlight/SilverlightEasyPrint.aspx
I've copied the code from this page to my sample application and I was able to print RadMap in landscape mode with full map fit to page. The calling code is simple (it is possible after adding the code from this article):
<
ScrollViewer
Width
=
"600"
Height
=
"400"
HorizontalScrollBarVisibility
=
"Visible"
VerticalScrollBarVisibility
=
"Visible"
>
<
telerik:RadMap
x:Name
=
"radMap"
Width
=
"1000"
Height
=
"800"
>
<
telerik:RadMap.Provider
>
<
telerik:OpenStreetMapProvider
/>
</
telerik:RadMap.Provider
>
</
telerik:RadMap
>
</
ScrollViewer
>
this
.radMap.Print(
"Map"
,
HorizontalAlignment.Stretch,
VerticalAlignment.Stretch,
new
Thickness(10),
true
,
true
,
null
);
I hope it will help you.
All the best,
Andrey Murzov
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.