שאלה בהדפסה C#

מ ו ת

New member
שאלה בהדפסה C#

אני צריכה להדפיס עמוד FROM שכתוב בשפת C# ,
כרגע זה נראה שהוא מדפיס הוא נותן אפשרות לבחירת תקיה ויוצר לי קובץ PDF אבל כשאני פותחת את הקובץ הוא ריק ...
אני דבגתי ואני רואה שהבעיה היא שהוא בכלל לא נכנס להדפיס את השורות כנראה יש לי בעיה בתנאי
צרפתי את הפונקציה הוא עובר את התנאי שבשורות המודגשות ומדפיס עמוד ריק :

ublic void pd_PrintPage(object sender, PrintPageEventArgs ev)
{
float linesPerPage = 0;
float yPos = 0;
int count = 0;
float leftMargin = ev.MarginBounds.Left;
float topMargin = ev.MarginBounds.Top;
string line = null;


linesPerPage = ev.MarginBounds.Height /
printFont.GetHeight(ev.Graphics);


// Print each line of the file.
while (count < linesPerPage &&
((line = streamToPrint.ReadLine()) != null))
{
yPos = topMargin + (count *
printFont.GetHeight(ev.Graphics));
ev.Graphics.DrawString(line, printFont, Brushes.Black,
leftMargin, yPos, new StringFormat());
count++;
}

// If more lines exist, print another page.
if (line != null)
ev.HasMorePages = true;
else
{ ev.HasMorePages = false;
 
למעלה