Posted 28 October 2025, 8:37 am EST
Good afternoon, i have a question about direct printing without Viewer from a C1FlexReport.
I created a report without margins with A4 size, with the code below, i’m trying to print it adapting the size to the printer page size, I’ve made some variations (reading the page size, forcing margins) but without luck.
I’m sure i’m missing something, but i don’t know what.
With another reporting library, to obtain this result i generate metadata streams (1 per page) and using a Graphics object i resized them to fit the page PrintableArea and then using the PrintDocument class to print it.
I was hoping to something simpler to achieve the same result.
C1FlexReport report = new C1FlexReport();
report.Load(Assembly.GetExecutingAssembly().GetManifestResourceStream("myreport.flxr"), "report1");
DocumentListReport externalRecordset = new DocumentListReport();
externalRecordset.SetRecordset(documentRecords.ToArray());
report.DataSources["Main"].Recordset = externalRecordset.GetRecordset();
report.Render();
var printOptions = new C1PrintOptions
{
PrinterSettings = new PrinterSettings() { PrinterName = "Printer Name" },
PageSettings = new PageSettings
{
Landscape = false,
},
PageScaling = PageScaling.FitToPrintableArea,
OutputRange = new OutputRange("1")
};
report.Print(printOptions);
Thank you in advance.
Alessandro.
