Note that there are some explanatory texts on larger screens.

plurals
  1. POMSDN's multi-page printing example doesn't appear to work correctly
    primarykey
    data
    text
    <p>I'm following MSDN's "how to" document on printing multiple pages: <a href="http://msdn.microsoft.com/en-us/library/cwbe712d%28v=vs.100%29.aspx" rel="nofollow">How to: Print a Multi-Page Text File in Windows Forms</a></p> <p>I've turned the example on that page into a project (tried Visual Studio 2010 and 2012) and found that it works as expected when printing a small amount of pages, but when printing a large amount (9 or so pages) it starts rendering the beginning pages as blank (page one and two are blank, the next 15 are correct, etc.).</p> <p>Can anyone confirm this behaviour? I don't see what could be causing this and there are no exceptions thrown.</p> <p>Edit: I've received 2 downvotes but I'm not sure why. I will attempt to be more clear. Here is the section of code that I believe contains the issue:</p> <pre><code>private void printDocument1_PrintPage(object sender, PrintPageEventArgs e) { int charactersOnPage = 0; int linesPerPage = 0; // Sets the value of charactersOnPage to the number of characters // of stringToPrint that will fit within the bounds of the page. e.Graphics.MeasureString(stringToPrint, this.Font, e.MarginBounds.Size, StringFormat.GenericTypographic, out charactersOnPage, out linesPerPage); // Draws the string within the bounds of the page e.Graphics.DrawString(stringToPrint, this.Font, Brushes.Black, e.MarginBounds, StringFormat.GenericTypographic); // Remove the portion of the string that has been printed. stringToPrint = stringToPrint.Substring(charactersOnPage); // Check to see if more pages are to be printed. e.HasMorePages = (stringToPrint.Length &gt; 0); } </code></pre> <p>I don't believe any of the datatypes are being overflowed. I've tried this with different printers but each have the same result. Please leave a comment if you downvote to let me know why the question has issues. Note: I've tried .NET Framework 4 and 4.5 with the same result. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload