HTML5 ReportViewer not exporting to PDF according to Report orientation settings

5 posts, 0 answers
  1. Matt
    Matt avatar
    5 posts
    Member since:
    Nov 2017

    Posted 05 Jan 2018 Link to this post

    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>
  2. Katia
    Admin
    Katia avatar
    760 posts

    Posted 10 Jan 2018 Link to this post

    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
  3. Jason
    Jason avatar
    6 posts
    Member since:
    Jan 2011

    Posted 10 Jan 2018 in reply to Katia Link to this post

    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?

  4. Katia
    Admin
    Katia avatar
    760 posts

    Posted 12 Jan 2018 Link to this post

    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
  5. Matt
    Matt avatar
    5 posts
    Member since:
    Nov 2017

    Posted 15 Jan 2018 Link to this post

    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.
Back to Top