Page size scaling based on printer margins / printable area

Posted by: a.beltrametti on 28 October 2025, 8:37 am EST

  • 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.

  • Posted 31 October 2025, 6:19 am EST

    Hello Alessandro,

    After running a few print tests, it looks like PageScaling = PageScaling.FitToPrintableArea is actually working as expected.

    We created a report defined in A4 size, filling the entire page area (no margins), and printed it to multiple paper sizes — A5, A3, and A2. In all those cases, the output scaled perfectly to fill the printable area without clipping, which confirms that the report content is being proportionally scaled.

    When printing the same A4 report to Letter size, we noticed small left and right margins while the top and bottom edges remained covered. That makes sense, since the Letter page is slightly wider and shorter than A4 — its aspect ratio (≈1.294) differs from the A-series ratio (≈1.414). To preserve proportions, the report scales to fit the height, which naturally leaves some horizontal margins.

    In short, this behavior confirms that PageScaling = PageScaling.FitToPrintableArea is functioning as intended.

    Please refer to the attached sample we created for testing: FlexReport_Print.zip

    If our understanding of your requirement or query is incorrect, please provide additional details about your exact need. You can also modify the attached sample accordingly or share a stripped-down version of your project so we can investigate it further.

    Regards,

    Uttkarsh.

  • Posted 3 November 2025, 4:18 am EST

    Good morning, thank you for the sample, i’ll test it immediately in my environment.

  • Posted 3 November 2025, 4:49 am EST - Updated 3 November 2025, 4:58 am EST

    Hello again, I’ve tested it. It works if i create a PDF, but when going directly on paper changing the PrinterName in PrinterSettings, the page gets cropped.

    I’ve attached a scan of the printer output.

    Thank you.

    Alessandro.

    20251103092358949.zip

  • Posted 4 November 2025, 3:45 am EST

    Hello Alessandro,

    We tried to reproduce the issue in the following two scenarios:

    1. Direct printing from the application using a physical printer:

      The report was designed in A4 size but printed on both A3 and A5 paper. In both cases, the prints came out correctly, although some margins were automatically added by the printer. We did not observe any cropped edges in these prints. Please refer to the attached images for reference. (see A3.jpg and A5.png)

    2. Printing to PDF first, then to a physical printer:

      In this case, we first printed the A4 report as a PDF and then printed that PDF using a physical printer. Here, we did notice that some edges were cropped — as shown in the attached image. (see cropped.jpg)

    As per our understanding, it seems that the printer adds margins automatically as a precautionary measure, which can vary depending on the printer model. To avoid content being cropped, we recommend adding some margins to the report layout.

    Regards,

    Uttkarsh.

    images.zip

  • Posted 4 November 2025, 3:53 am EST

    Good morning, as i stated in my original post, even with other reporting libraries i got a similar problem, i was only hoping to avoid extra coding to avoid the issue.

    I’ve made some tests too in the meanwhile, and using a library that manages pdf printing with auto-scaling (PDFium) i got everything i need.

    Thank you for your help and suggestions.

    Alessandro.

Need extra support?

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

Learn More

Forum Channels