title: C# Print pdf file programmatically?
body: <p>My printing code given below</p>
  
  <pre><code>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();
  }
  </code></pre>
  
  <p>Then I call the function like </p>
  
  <pre><code>SaveReport(new ThermalPrint(), Server.MapPath(@"~\Report\123.pdf"));
  </code></pre>
  
  <p>The function executes without error but printer not print the pdf file.
  The printer printing dialog like 
  <a href="https://i.stack.imgur.com/K7sEM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/K7sEM.png" alt="enter image description here"></a></p>
  
  <p>I can't understand the problem.</p>