Exporting Many Files to Single PDF
Our sample projects and report templates can help you learn the basics of working with our products.This sample project demonstrates how to export many different reports to one big PDF file and create a PDF file with a lot of report copies. For example, create one rendered report and add it 30 times in the output PDF file. Create the new report object and enable the necessary options:
Then, add the rendered report 30 times:
In the end, export the report:
In the screenshot below you can see the result of the sample code:

private void buttonExportClick(object sender, EventArgs e)
{
var report = new StiReport();
report.ReportCacheMode = StiReportCacheMode.On;
report.RenderedPages.CanUseCacheMode = true;
report.RenderedPages.CacheMode = true;
report.RenderedPages.Clear();
report.ReportUnit = StiReportUnitType.HundredthsOfInch;
...
Then, add the rendered report 30 times:
...
var tempReport = new StiReport();
for (int index = 0; index < 30; index++)
{
using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(
"ExportManyFilesToOneBigPDF.MasterDetail.mdc"))
{
tempReport.LoadDocument(stream);
}
tempReport.ReportUnit = report.ReportUnit;
foreach (StiPage page in tempReport.RenderedPages)
{
page.Report = tempReport;
page.Guid = System.Guid.NewGuid().ToString().Replace("-", "");
report.RenderedPages.Add(page);
}
}
...
In the end, export the report:
...
report.ExportDocument(StiExportFormat.Pdf, "d:\\1.pdf");
}In the screenshot below you can see the result of the sample code:
