AR16 detect/control duplex printing in XML-Section Report

Posted by: softcomlimited on 22 January 2024, 6:23 am EST

    • Post Options:
    • Link

    Posted 22 January 2024, 6:23 am EST

    Hello,

    In an XML-Section Report AR16, is there a way in VBScript to determine is a report is printing in duplex mode?

    I have a report with a single data-table for all customer statements and it would be nice to print back and front, but not if any customers have an odd number of pages , I need to force an extra blank page in that case. How might I force a blank page?

    The only other way would be to split the data-table and generate multiple reports - seems too clunky.

    Thanks

    Brian

  • Posted 22 January 2024, 5:04 pm EST

    Hi Brian,

    >> In an XML-Section Report AR16, is there a way in VBScript to determine is a report is printing in duplex mode?

    You can set and get the rpt.PageSettings.Duplex in the Report Script. Please refer to the following sample code:

    	this.TextBox4.Text = rpt.PageSettings.Duplex.ToString();
    

    However, The report script runs at the time of render(or when rpt.Run()) is called so if you are setting Duplex in any Print dialog after the report is rendered is not possible to re-run the script.

    >> I need to force an extra blank page in that case. How might I force a blank page?

    Once rpt.Run() is called all the generated pages are added into rpt.Document.Pages collection. You may add a new page is this collection based on your requirement. Please refer to the following code:

    if (report.Document.Pages.Count % 2 != 0)
        report.Document.Pages.Add(new GrapeCity.ActiveReports.Document.Section.Page());
    

    For reference, I have also attached a sample application.PrintTestReport.zip

  • Posted 23 January 2024, 2:14 am EST

    Akshay,

    Thanks for the reply.

    I see the limitation of rpt.PageSettings.Duplex. It does not indicate that the printer actually supports duplex. If the printer does not duplex I don’t want to force the extra blank.

    I’ll check out your sample.

    Thanks

    Brian

  • Posted 23 January 2024, 10:03 pm EST

    Hi Brian,

    Since you want to add a new page when the printing with Duplex. You do not have to check this in the report script as the pages are going to be added once the report script has already ran and report document is created.

    You can simply add some custom code to open a print dialog and use it to allow users to set printer settings once the user press OK you can add a page to the reportDocument and call reportDocument.Print(false, , );

    Please refer to the attached sample.

    I hope it helps!

    PrintTestReport.zip

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels