title: Does PrintDocument sends whole document to printer or line by line?
body: <p>A little context: I'm developing a Windows Form app that contains a feature where the user prints some info.</p>
  
  <p>The thing is that the size of that information can change from time to time: sometimes it can fit on a single page or sometimes it can be 20+ pages.</p>
  
  <p>For the printings, I'm using .Net's <code>PrintDocument</code></p>
  
  <p>So I'm using <code>e.HasMorePages</code> to handle the possible multiple pages. Here's a simplified version of my code:</p>
  
  <pre><code>int printIndex = 0;
  
  private void startPrinting(){
      PrintDocument printDoc = new PrintDocument();
      printDoc.PrinterSettings.PrinterName = "Ticket printer1"
  
      printDoc.PrintPage += new PrintPageEventHandler(printPage);
      printDoc.Print();
  }
  </code></pre>
  
  <p>And the <code>printPage</code> method:</p>
  
  <pre><code>private void printPage(object sender, PrintPageEventArgs e)
  {
      Graphics graphics = e.Graphics;
      int yPos = 0;
      Font regular = new Font(FontFamily.GenericSansSerif, 10.0f, FontStyle.Regular);
  
      for(int i = printIndex; i &lt; data.Length; i++)
      {
          if (yPos + 30 &gt;= e.PageBounds.Height)
          {
              e.HasMorePages = true;
              return;
          }
          else
          {
              e.HasMorePages = false;
          }
          graphics.DrawString(data[i], regular, Brushes.Black, yPos, 110);
          yPos += 20;
          printIndex++;
      }
      regular.Dispose();
      graphics.Dispose();
  }
  </code></pre>
  
  <p>And this works just fine on virtual printers and even some physical printers here at the office. But when the user runs the app on his actual computer (with his actual printer) it prints no more than 3 pages.</p>
  
  <p>I asked a peer and he suggested that Windows is sending the whole document to the printer and maybe some printers can't handle large documents due to low memory issues.</p>
  
  <p>Is it how it works? and if it is: how can I fix it to print more than 3 pages?</p>