title: “Microsoft Print to PDF” printer for webBrowser control
body: <p>I wont print in pdf file current page on webBrowser control,? its code: </p>
  
  <pre><code> // generate a file name as the current date/time in unix timestamp format
      string file = (string)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds.ToString();
   // the directory to store the output.
      string directory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
  
   // initialize PrintDocument object
      PrintDocument doc = new PrintDocument();
  
      doc.PrintPage += new PrintPageEventHandler(this.pd_PrintPage);
      doc.PrinterSettings.PrinterName = "Microsoft Print to PDF";
   // tell the object this document will print to file
      doc.PrinterSettings.PrintToFile = true;
      doc.PrinterSettings.PrintFileName = Path.Combine(directory, file + ".pdf");
      doc.Print();
  
       private void pd_PrintPage(object o, PrintPageEventArgs e)
       {   
         webBrowser1.Navigate("https://stackoverflow.com/questions/40812996/
         programmatically-provide-a-filepath-as-input-file-for-microsoft-print-to-pdf-p");
       }
  </code></pre>
  
  <p>File genereted, but its empty....</p>