This is a migrated thread and some comments may be shown as answers.

Replace Silverlight report viewer with Telerik

9 Answers 117 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Clay
Top achievements
Rank 1
Clay asked on 04 Apr 2013, 08:20 PM
We have a Telerik report that uses the Silverlight viewer, but when printing a particular landscape report, it prints in portrait orientation. It seems this is a known problem with Silverlight that can be rectified by switching to the Telerik web viewer. 

I'm about to look into this issue and would like to know just how to do that.

9 Answers, 1 is accepted

Sort by
0
Elian
Telerik team
answered on 08 Apr 2013, 01:38 PM
Hi Clay,

When printing through the Silverlight ReportViewer the viewer may automatically rotate the report depending on the setup. It always tries to match the wider side of the page to the wider side of the report and neglects the Landscape property. 
The ASP.NET viewer behaves differently because it prints through the PDF plugin.

Please share with us some more details around the case:
  • What version of Telerik.Reporting are you using?
  • What is the page size you set in the report's page settings? 
  • What is the page size of the printer? 
  • How do you expect it to print and how is it different?
 

Kind regards,
Elian
the Telerik team

Have you tried the new visualization options in Telerik Reporting Q1 2013? You can get them from your account.

0
Clay
Top achievements
Rank 1
answered on 08 Apr 2013, 03:10 PM
I don't yet have access to the project, I just know this is the first "bug" I need to fix, so all I can say for sure is that they want the report to be landscape, but it prints portrait/vertical and "stuff gets squished." Since it works fine with the other (non-Silverlight) viewer, all I need to know is how to switch to that one (is it obvious? According to your reply, it's an ASP.NET viewer, so that makes more sense to use, anyway, as Silverlight seems to have gone the way of the Brooklyn Dodgers, or should I say Milwaukee Braves, as the Brooklyn Dodgers have been "resurrected," so to speak, by "42".
0
Elian
Telerik team
answered on 09 Apr 2013, 02:55 PM
Hi Clay,

Basically the calculations that we do behind the curtains should prevent report from being squished or cropped. However, we will be able to give you more concrete guidance when you provide us with the information details asked in the previous post. 
As a note - one option would be to set the UseNativePrinting Property to False. This will cause the viewer to use the PDF plugin of the browser for printing becoming virtually the same as the WebViewer in that aspect. 
  

Greetings,
Elian
the Telerik team

Have you tried the new visualization options in Telerik Reporting Q1 2013? You can get them from your account.

0
Clay
Top achievements
Rank 1
answered on 24 Apr 2013, 09:14 PM
I see no "UseNativePrinting" property.

The report is declared like this:

public partial class TransactionLineItemSalesReport : DuckbillReportBase, DuckbillReportInterface

DuckbillReportBase is declared like this:

public class DuckbillReportBase : Telerik.Reporting.Report
0
Elian
Telerik team
answered on 29 Apr 2013, 11:51 AM
Hello Clay,

The UseNativePrinting Property is a property of the SilverlightReportViewer and not the Report. Settings it tells the viewer not to use the native Silverlight printing and use the PDF plugin to print (as in the Web viewer). 
 

Regards,
Elian
the Telerik team

Have you tried the new visualization options in Telerik Reporting Q1 2013? You can get them from your account.

0
Clay
Top achievements
Rank 1
answered on 11 Jun 2013, 11:45 PM
I still don't know where to set this. The .cshtml file that hosts the Silverlight has this:

<div id="silverlightControlHost">
    <object data="data:application/x-silverlight-2," type="application/x-silverlight-2"
        width="100%" height="100%">
        <param name="source" value="@Url.Content("~/ClientBin/TLDReporter-SL.xap")" />
        <param name="onError" value="onSilverlightError" />
        <param name="background" value="white" />
            <param name="minRuntimeVersion" value="4.0.60310.0" />
        <param name="autoUpgrade" value="true" />

...do I need to add a param name to this, such as:

           
<param name="UseNativePrinting" value="false" />


...or...???
0
Squall
Top achievements
Rank 1
answered on 12 Jun 2013, 01:38 PM
You have to open the Silverlight project PAGE that contains the viewer in XAML editor. Then set the viewer UseNativePrint:
<telerik:ReportViewer Grid.Row="1" x:Name="ReportViewer1"
                      Width="1000"
                      telerikControls:StyleManager.Theme="{Binding SelectedItem, ElementName=ThemeSelector}"
                      ReportServiceUri="../ReportService.svc"
                      UseNativePrinting="True"
                      Report="Telerik.Reporting.Examples.CSharp.ReportCatalog, CSharp.ReportLibrary" />

SN
0
Clay
Top achievements
Rank 1
answered on 12 Jun 2013, 03:36 PM
I have no "<telerik:ReportViewer" anywhere in my project.

The report that displays after the user enters the criteria and posts the form displays inside a cshtml file that has this html:

<span style="font-size: 13.63636302947998px;">    <form id="form1" runat="server" style="height: 100%"></span><br style="font-size: 13.63636302947998px;"><span style="font-size: 13.63636302947998px;">    <div id="silverlightControlHost"></span><br style="font-size: 13.63636302947998px;"><span style="font-size: 13.63636302947998px;">        <object data="data:application/x-silverlight-2," type="application/x-silverlight-2"</span><br style="font-size: 13.63636302947998px;"><span style="font-size: 13.63636302947998px;">            width="100%" height="100%"></span><br style="font-size: 13.63636302947998px;"><span style="font-size: 13.63636302947998px;">            <param name="source" value="@Url.Content("~/ClientBin/TLDReporter-SL.xap")" /></span><br style="font-size: 13.63636302947998px;"><span style="font-size: 13.63636302947998px;">            <param name="onError" value="onSilverlightError" /></span><br style="font-size: 13.63636302947998px;"><span style="font-size: 13.63636302947998px;">            <param name="background" value="white" /></span><br style="font-size: 13.63636302947998px;"><span style="font-size: 13.63636302947998px;">                <param name="minRuntimeVersion" value="4.0.60310.0" /></span><br style="font-size: 13.63636302947998px;"><span style="font-size: 13.63636302947998px;">            <param name="autoUpgrade" value="true" /></span><br style="font-size: 13.63636302947998px;"><span style="font-size: 13.63636302947998px;">            <a href="http://go.microsoft.com/fwlink/?LinkID=149156&;v=4.0.60310.0" style="text-decoration:none"></span><br style="font-size: 13.63636302947998px;"><span style="font-size: 13.63636302947998px;">                <img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight"</span><br style="font-size: 13.63636302947998px;"><span style="font-size: 13.63636302947998px;">                    style="border-style: none" /></span><br style="font-size: 13.63636302947998px;"><span style="font-size: 13.63636302947998px;">            </a></span><br style="font-size: 13.63636302947998px;"><span style="font-size: 13.63636302947998px;">        </object></span><br style="font-size: 13.63636302947998px;"><span style="font-size: 13.63636302947998px;">        <iframe id="_sl_historyFrame" style="visibility: hidden; height: 0px; width: 0px;</span><br style="font-size: 13.63636302947998px;"><span style="font-size: 13.63636302947998px;">            border: 0px"></iframe></span><br style="font-size: 13.63636302947998px;"><span style="font-size: 13.63636302947998px;">    </div></span><br style="font-size: 13.63636302947998px;"><span style="font-size: 13.63636302947998px;">    </form></span><br style="font-size: 13.63636302947998px;">

Or:

    <form id="form1" runat="server" style="height: 100%">
    <div id="silverlightControlHost">
        <object data="data:application/x-silverlight-2," type="application/x-silverlight-2"
            width="100%" height="100%">
            <param name="source" value="@Url.Content("~/ClientBin/TLDReporter-SL.xap")" />
            <param name="onError" value="onSilverlightError" />
            <param name="background" value="white" />
                <param name="minRuntimeVersion" value="4.0.60310.0" />
            <param name="autoUpgrade" value="true" />
            <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.60310.0" style="text-decoration:none">
                <img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight"
                    style="border-style: none" />
            </a>
        </object>
        <iframe id="_sl_historyFrame" style="visibility: hidden; height: 0px; width: 0px;
            border: 0px"></iframe>
    </div>
    </form>

I added the "width: 100%" to this:

        #silverlightControlHost
        {
            height: 100%;
            width: 100%;
            text-align: center;
        }

...but it made no difference in the report's display (should be landscape/horizontal but appears vertical/portrait).

There is also a ReportViewer.cshtml in the project, which has:

    <form id="form1" runat="server" style="height: 100%">
    <div id="silverlightControlHost">
        <object data="data:application/x-silverlight-2," type="application/x-silverlight-2"
            width="100%" height="100%">
            <param name="source" value="@Url.Content("~/ClientBin/TLDReporter-SL.xap")" />
            <param name="onError" value="onSilverlightError" />
            <param name="background" value="white" />
                <param name="minRuntimeVersion" value="4.0.60310.0" />
            <param name="autoUpgrade" value="true" />
            <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.60310.0" style="text-decoration:none">
                <img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight"
                    style="border-style: none" />
            </a>
        </object>
        <iframe id="_sl_historyFrame" style="visibility: hidden; height: 0px; width: 0px; border: 0px"></iframe>
    </div>
    </form>

...but the report actually displays in \LoadReport (that's seen in the URL)
0
Clay
Top achievements
Rank 1
answered on 12 Jun 2013, 10:06 PM
I added the bolded code below, but it makes no difference - the report still displays in "vertical" orientation.

    public partial class ReceiptRpt : UserControl, IReportServiceClientFactory
    {
        public String GUID { get; set; }
        public String SerialNumber { get; set; }
        
        public ReceiptRpt()
        {
            InitializeComponent();

            this.ReportViewer.ReportServiceClientFactory = this;

            //this.ReportViewer.ZoomMode = ZoomMode.FullPage;
            string baseURL = Application.Current.Host.Source.AbsoluteUri;
            int index = baseURL.IndexOf("/ClientBin");
            baseURL = baseURL.Substring(0, index) + "/ReportService.svc";
            this.ReportViewer.ReportServiceUri = new Uri(baseURL);
            this.ReportViewer.UseNativePrinting = true;
            this.ReportViewer.RenderBegin += new RenderBeginEventHandler(ReportViewer_RenderBegin);

Tags
General Discussions
Asked by
Clay
Top achievements
Rank 1
Answers by
Elian
Telerik team
Clay
Top achievements
Rank 1
Clay
Top achievements
Rank 1
Squall
Top achievements
Rank 1
Share this question
or