In the report generator you can print a report from a code. To do it you should use a special method the print() for a report object.

 

index.php

 

var report = new Stimulsoft.Report.StiReport();

report.loadFile("SimpleList.mrt");

report.renderAsync(function() {

report.print();

});

 

 

Information

 

Print a report doesn't call its automatic rendering, so you should call in advance the renderAsync() method, and it will render a report. This method is not required for ready documents (rendered reports).

 

 

 

When printing a report you can specify a range of pages for printing. The special StiPagesRange class is intended for this and you can set the following parameters as constructor arguments.

 

Name

Description

rangeType

The type of set range. The following values are available:

Stimulsoft.Report.StiRangeType.All - is print of all pages, other parameters of the constructor are not taken into account (the value by default);

Stimulsoft.Report.StiRangeType.Pages - is print of a specified in the second argument of pages range argument;

Stimulsoft.Report.StiRangeType.CurrentPage - is print of the current page, you should specify the current number of the page in the third argument.

pageRanges

The range in a string representation is the numbers of pages separated by commas or via hyphen. It is used together with the Stimulsoft.Report.StiRangeType.Pages variant.

currentPage

The current number of a page. It is used together with the Stimulsoft.Report.StiRangeType.CurrentPage variant.

 

 

Samples of setting print range.

 

index.php

 

$pageRange = new Stimulsoft\Report\StiPagesRange(Stimulsoft\Report\StiRangeType::All);

$report->print($pageRange);

 

$pageRange = new Stimulsoft\Report\StiPagesRange(Stimulsoft\Report\StiRangeType::Pages, '1,3-8');

$report->print($pageRange);

 

$pageRange = new Stimulsoft\Report\StiPagesRange(Stimulsoft\Report\StiRangeType::CurrentPage, '', 5);

$report->print($pageRange);