title: c# Printing a PDF with iTextSharp
body: <p>I have a problem with printing a pdf.
  So my Document is being created by writing some values in a pdf document and saving it</p>
  
  <pre><code>public void CreateDocument(string name)
      {
  
          string oldreport = @"..\Resources\FehlerReport.pdf";
          string newreportpath = @"..\Resources\" + name;
          using (var newFileStream = new FileStream(newreportpath, FileMode.Create))
          {
              var pdfReader = new PdfReader(oldreport);
  
              var stamper = new PdfStamper(pdfReader, newFileStream);
  
              var form = stamper.AcroFields;
  
              var fieldKeys = form.Fields.Keys;
  
              form.SetField("Auftragsnummer", Kundeninformation.Auftragsnummer.ToString());
              form.SetField("Kundensachnummer", Kundeninformation.Kundensachnummer.ToString());
              form.SetField("Kundenname", Kundeninformation.Kundenname.ToString());
              form.SetField("Kundenbestellnummer", Kundeninformation.Kundenbestellnummer.ToString());
              form.SetField("Kundenrezepturnummer", Kundeninformation.Kundenrezepturnummer.ToString());
              form.SetField("Spulennummer", Kundeninformation.Spulennummer.ToString());
  
              form.SetField("Fertigungsdatum1", System.DateTime.Today.ToString("dd.MM.yy"));
  
              int i = 1;
              foreach (var item in _MeasurementReport.MeasurementReportItems)
              {
                  form.SetField(("UhrzeitRow" + i).ToString(), item.Uhrzeit.ToString("HH:mm:ss"));
                  form.SetField(("FehlerindexRow" + i).ToString(), i.ToString());
                  form.SetField(("Position mmRow" + i).ToString(), (item.Laufmeter * pixelSize).ToString("0.00", System.Globalization.CultureInfo.InvariantCulture));
                  form.SetField(("HoeheRow" + i).ToString(), (item.DefectCountours.H * pixelSize).ToString("0.00", System.Globalization.CultureInfo.InvariantCulture));
                  form.SetField(("Breite mmRow" + i).ToString(), (item.DefectCountours.W * pixelSize).ToString("0.00", System.Globalization.CultureInfo.InvariantCulture));
                  form.SetField(("Flaeche Row" + i).ToString(), (item.DefectCountours.W * pixelSize * pixelSize).ToString("0.00", System.Globalization.CultureInfo.InvariantCulture));
                  i++;
              }
  
              form.SetField("Datum", System.DateTime.Today.ToString("dd.MM.yy"));
              form.SetField("Uhrzeit", System.DateTime.Now.ToString("HH:mm"));
  
              stamper.FormFlattening = true;
  
  
              stamper.Close();
              pdfReader.Close();
          }
  
      }
  </code></pre>
  
  <p>So now i want to print the document with this function, which also calls the CreateDocument function. It prints, but the paper is white. I checked if the created pdf is being created, and it is being created but apparently not printed.</p>
  
  <pre><code>    public void Print()
          {
  
              string name = Kundeninformation.Auftragsnummer + "_" + Kundeninformation.Spulennummer+".pdf";
              CreateDocument(name);
              List&lt;string&gt; PrinterFound = new List&lt;string&gt;();
              PrinterSettings printer = new PrinterSettings();
              foreach (var item in PrinterSettings.InstalledPrinters)
              {
                  PrinterFound.Add(item.ToString());
              }
              printer.PrinterName = PrinterFound[7];
              printer.PrintFileName = name;
  
              PrintDocument PrintDoc = new PrintDocument();
  
              PrintDoc.DocumentName = @"..\Resources\"+name;
              PrintDoc.PrinterSettings.PrinterName = PrinterFound[7];
  
              PrintDoc.Print();
  }
  </code></pre>