title: WebBrowser print programmatically with PDFCreator
body: <p>I'm trying to print programmatically multiple html pages from WebBrowser in VB.Net. The program I made is a web scraper that takes info about shipment from the shipment company's website and print the html page as pdf for every shipment code.
  I selected PDFCreator as printer and I managed to print every html page, but PDFCreator shows a dialog window for every html to print. Is there a way to <strong>programmatically select</strong> the <strong><em>file name</em></strong> and the <strong><em>output path</em></strong> and print without <strong>asking anything</strong> to the user?</p>
  
  <p>This is the sub to change the default printer: </p>
  
  <pre><code>Private Sub SetPrinter(ByVal printerName As String)
      Shell(String.Format("rundll32 printui.dll,PrintUIEntry /y /n ""{0}""", printerName))
  End Sub
  </code></pre>
  
  <p>This is where the code prints the html:</p>
  
  <pre><code> Private Function FindShipment(ByVal TrackingUrl As String, ByVal indexShipmentCode As Integer, ByVal shipmentCode as DataTable) As Boolean
      Try
          WebBrowser1.Navigate(TrackingUrl)
          WaitForPageLoad()
          Dim trackingTextBox As HtmlElement = WebBrowser1.Document.All.Item("id_ldv")
          trackingTextBox.InnerText = shipmentCode.Rows(indexShipmentCode).Item(0)
          'shipment code is a DataTable filled with info took from excel file
          WebBrowser1.Document.All("button").InvokeMember("click")
          WaitForPageLoad()
          WebBrowser1.Print()
          Return True
      Catch ex As Exception
          Return False
      End Try
  End Function
  </code></pre>
  
  <p>FindShipment is called inside a cycle, and the <code>WebBrowser1.Print()</code> opens a dialog window every cycle. </p>