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

HTML5 ReportViewer not exporting to PDF according to Report orientation settings

4 Answers 123 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Matt
Top achievements
Rank 1
Matt asked on 05 Jan 2018, 09:04 PM

I have a class library where all my reports are. One of my reports needs to be displayed and exported to PDF in landscape mode instead of portrait. In my web application which is a MVC Core application using a target framework of 4.6.1 displays the report fine in the report viewer. 

Do I need to do something with the jQuery to tell the report to print according to the class report settings?

Do I need to set something else in the report definition itself that will take care of it?

See the screenshot for the report properties settings.

Here is the jQuery I am using to render the report viewer:

<script>
    function setReportSource(report) {
        var viewer =
            $("#reportViewer1")
                .data("telerik_ReportViewer");
 
        viewer
            .reportSource({
                report: report
            });
    }
 
 
    $(document).ready(function () {
        $("#reportViewer1")
            .telerik_ReportViewer({
                serviceUrl: "../api/reports/",
                reportSource: {
                    report: "MBIntranet.Reporting.DownTime.ReasonCodeReport, MBIntranet.Reporting",
                    parameters: {}
                },
                viewMode: telerikReportViewer.ViewModes.INTERACTIVE,
                scaleMode: telerikReportViewer.ScaleModes.SPECIFIC,
                scale: 1.0,
            });
 
        $("#reports")
            .on(
            "change",
            function () {
                setReportSource($(this).val());
            });
    });
</script>

4 Answers, 1 is accepted

Sort by
0
Katia
Telerik team
answered on 10 Jan 2018, 04:38 PM
Hi Matt,

It seems that setting PaperKind property to LetterRotated will be sufficient to display the report in landscape format. There is no need to set Landscape to true in this case.
Landscape=true will switch the width and height of the page.


Regards,
Katia
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Jason
Top achievements
Rank 1
answered on 10 Jan 2018, 08:03 PM

Hi,

I have the same setup (html5 viewer to report Web API) and am experiencing the same issue in that word/PDF exports are still in portrait not landscape.

Code:

this.Report.PageSettings.Margins = new Telerik.Reporting.Drawing.MarginsU(Telerik.Reporting.Drawing.Unit.Inch(1.0),         Telerik.Reporting.Drawing.Unit.Inch(1.0), Telerik.Reporting.Drawing.Unit.Inch(1.0), Telerik.Reporting.Drawing.Unit.Inch(1.0));
this.Report.PageSettings.PaperKind = System.Drawing.Printing.PaperKind.LetterRotated;
this.Report.PageSettings.Landscape = true;

Any ideas?

0
Katia
Telerik team
answered on 12 Jan 2018, 01:57 PM
Hi Jason,

I guess the issue is similar to the one reported by Matt, check my previous reply in this topic and test resetting the Landscape property.


Regards,
Katia
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Matt
Top achievements
Rank 1
answered on 15 Jan 2018, 06:48 PM
So yes, setting the page settings orientation back to portrait and keeping the paper size set to LetterRotated fixed the issue. However, I have to say that is really really strange.
Tags
General Discussions
Asked by
Matt
Top achievements
Rank 1
Answers by
Katia
Telerik team
Jason
Top achievements
Rank 1
Matt
Top achievements
Rank 1
Share this question
or