LocalReport.Render() with different device information RRS feed

  • Question

  • User-1048977583 posted

    My requirement it to design RDLC reports with parameters and populating date to parameter at run time and printing them to selected printer.

    I set width and Height in RDLC report and i would like to print the report with same dimension.

    But it always prints with printer's default page dimension.

    One thing i noticed is, even if i give different page with and height of deviceinfo parameter in the LocalReport.Render() method, it prints with printers default dimension.

    How to pass deviceinfo properties to get stream in expected dimension?

    Tuesday, July 11, 2017 1:03 PM

All replies

  • User347430248 posted

    Hi siva26prakas,

    you can try to use code below may help you.

    using System.Drawing.Printing;
    PageSettings ps = new PageSettings(); //Declare a new PageSettings for printing
    ps.Landscape = false; //Set True for landscape, False for Portrait
    ps.Margins = new Margins(0, 0, 0, 0); //Set margins
    //Choose paper size from the paper sizes defined in ur printer.
    //Here we use Linq to quickly choose by name
    ps.PaperSize =
        (from PaperSize p
        in ps.PrinterSettings.PaperSizes
        where p.PaperName == "Legal" select p).First();
    //Alternatively you can set the paper size as custom
    //ps.PaperSize = new PaperSize("MyPaperSize", 100, 100);



    Wednesday, July 12, 2017 7:56 AM