How to set papersource

When I set the property in printsettings.papersource almost nothing happens. I need to set the papersource in code. But how to do this?

Comments

  • edited 11:12PM
    try

    FastReport.Report report = new FastReport.Report();
    report.PrintSettings.PaperSource = (int)System.Drawing.Printing.PaperSourceKind.Upper;
  • edited 11:12PM
    ipong wrote: »
    try

    FastReport.Report report = new FastReport.Report();
    report.PrintSettings.PaperSource = (int)System.Drawing.Printing.PaperSourceKind.Upper;


    Doesn't work for me.

    My Code is

    FastReport.Report report = new FastReport.Report();
    Report.load(filename);
    report.PrintSettings.PaperSource = (int)System.Drawing.Printing.PaperSourceKind.Middle;
    report.PrintSettingts.ShowDialog = false;
    Report.Print();


    Even if I Change the papersource in the designer and save the new frxfile, fastreport keeps using the Default papersource. The only way to Change the source is to keep the Dialog true and let the user change the papersource. But this is in deed no Option .
  • edited September 2017
    1. Get list of paper sources that your default printer supports, important!!!
    System.Drawing.Printing.PrinterSettings printerSettings = new System.Drawing.Printing.PrinterSettings();
    int selectedSource = -1;
    foreach (System.Drawing.Printing.PaperSource item in printerSettings.PaperSources)
    {
        selectedSource = item.RawKind;
        break;
    }
    

    2. Assign to report
    FastReport.Report report = new FastReport.Report();
    if (selectedSource != -1)
        report.PrintSettings.PaperSource = selectedSource;
    
  • edited 11:12PM
    ipong wrote: »
    1. Get list of paper sources that your default printer supports, important!!!
    System.Drawing.Printing.PrinterSettings printerSettings = new System.Drawing.Printing.PrinterSettings();
    int selectedSource = -1;
    foreach (System.Drawing.Printing.PaperSource item in printerSettings.PaperSources)
    {
        selectedSource = item.RawKind;
        break;
    }
    

    2. Assign to report
    FastReport.Report report = new FastReport.Report();
    if (selectedSource != -1)
        report.PrintSettings.PaperSource = selectedSource;
    


    Answer 1 was the key. Thank you.

Leave a Comment