Page 1 of 1

Page size change

Posted: Wed Apr 30, 2008 2:59 pm
by csitol
Hello,

I'm attempting to change the page size (Letter or Legal) at runtime.

I believe I have downloaded the latest version (2008.1.225.0).
I'm running VS2005 C# and ASP.Net 2.0.

The code looks like this:

Code: Select all

        Stimulsoft.Report.StiConfig.Services.Add(new Stimulsoft.Report.Dictionary.StiPostgreSQLAdapterService());
        Stimulsoft.Report.StiConfig.Services.Add(new Stimulsoft.Report.Dictionary.StiPostgreSQLDatabase());
        Stimulsoft.Report.StiReport report = new Stimulsoft.Report.StiReport();
        string RptPath = ConfigurationManager.AppSettings["RptPath"] + Request.QueryString["RptName"].ToString();
        report.Load(RptPath);
        //set the page size to the appropriate value.
        if (Request.QueryString["PgSize"] == "Legal")
            report.Pages[0].PaperSize = PaperKind.Legal;
        else
            report.Pages[0].PaperSize = PaperKind.Letter;

        report.Compile();

        ////set the page size to the appropriate value.
        //if (Request.QueryString["PgSize"] == "Legal")
        //    report.CompiledReport.Pages[0].PaperSize = PaperKind.Legal;
        //else
        //    report.CompiledReport.Pages[0].PaperSize = PaperKind.Letter;

        report["QuoteHdrId"] = Request.QueryString["QuoteHdrId"].ToString();
        Stimulsoft.Report.Web.StiReportResponse.ResponseAsPdf(this, report);

I've tried changing page size on both sides of the report.Compile() command with the same results.

When I run this on my local computer, running VS2005 in debug mode, it work perfectly. When I move the code to my VPS running IIS everything prints as expected, but I'm unable to change the page size.

I suspect this has to do with IIS, but I thought I'd check with you and see if you have any suggestions on how to make this work.

Thank you again for a wonderful product!

Phil Mickelson
CSITOL, LLC

Page size change

Posted: Thu May 01, 2008 2:28 am
by Vital
Hello Phil,

Report engine request data from default printer which size have Letter or Legal page size when you assign property PaperSize. In some cases (for example printer does not exist) report engine can't receive this information.
I recommend you add two lines of code:

Code: Select all

report.Pages[0].PageWidth = widthLegal;
report.Pages[0].PageHeight = heightLegal;
You need use report units. For example if your report have all size in inches then you need assign size in inches too.

Thank you.

Page size change

Posted: Thu May 01, 2008 4:38 pm
by csitol
Vital,

That was exactly it! Thank you again for all your help.

Phil Mickelson