3

My printing code given below

void SaveReport(Telerik.Reporting.Report report, string fileName)
{
    ReportProcessor reportProcessor = new ReportProcessor();
    Telerik.Reporting.InstanceReportSource instanceReportSource = new Telerik.Reporting.InstanceReportSource();
    instanceReportSource.ReportDocument = report;
    RenderingResult result = reportProcessor.RenderReport("PDF", instanceReportSource, null);

    using (FileStream fs = new FileStream(fileName, FileMode.Create))
    {
        fs.Write(result.DocumentBytes, 0, result.DocumentBytes.Length);
    }

    // initialize PrintDocument object
    PrintDocument doc = new PrintDocument()
    {
        PrinterSettings = new PrinterSettings()
        {
            // set the printer to 'Microsoft Print to PDF'
            PrinterName = "Canon LBP3000",

            // tell the object this document will print to file
            // PrintToFile = true,

            // set the filename to whatever you like (full path)
            PrintFileName = fileName,
        }
    };
    doc.DocumentName = "My";
    doc.Print();
}

Then I call the function like

SaveReport(new ThermalPrint(), Server.MapPath(@"~\Report\123.pdf"));

The function executes without error but printer not print the pdf file. The printer printing dialog like enter image description here

I can't understand the problem.

0

1 Answer 1

1

If you want to print the report, call reportProcessor.PrintReport(typeReportSource, printerSettings) but make sure you provide a valid PrinterSettings instance.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.