I want to print data in text file out to the paper
If my data in text file is
110011110
I want to change 1 in the above data to solid black (which have 2 pixel width and 4 pixel height) and 0 in the above data to solid white (which have 2 pixel width and 4 pixel height)
This below is code but it does not work. The printer print the blank page. What wrong with my code?

code:
------------------------------------------------------------------------------

void CTestprint::OnPrintButton()
{
DOCINFO di ;
CPrintInfo printInfo ;
CDC dc ;
CRect draw_area ;
CPrintDialog dlg(FALSE) ;
if (dlg.DoModal() == IDCANCEL)
return ;
HDC hDC = dlg.GetPrinterDC() ;
if (hDC == NULL)
return ;
di.cbSize = sizeof(DOCINFO) ;
di.lpszDocName = "Document name";
di.lpszOutput = NULL ;
// prepare the print information structure
dc.Attach(hDC) ;
printInfo.m_bDirect = TRUE ;
printInfo.m_rectDraw.left = 0 ;
printInfo.m_rectDraw.right = dc.GetDeviceCaps(HORZRES) ;
printInfo.m_rectDraw.top = 0 ;
printInfo.m_rectDraw.bottom = dc.GetDeviceCaps(VERTRES) ;
draw_area = printInfo.m_rectDraw ;
dc.StartDoc(&di) ;
CString testline = "101101001" ;
int x = 0 ;
int y = 0 ;
int pos = 0 ;
// start printing the document
dc.StartPage() ;
while (pos < testline.GetLength())
{
if ((testline.GetAt(pos)) == '1')
{
CBrush brush;
// Creation of the brush with a black color
brush.CreateSolidBrush(RGB(0, 0, 0));
// Create a rectangle with coordinates x,y,x+2,y+4 corresponding with top, left, bottom, right
CRect Rectangle(x, y, x + 2, y + 4) ;
// Fill a rectangle in the current device context or DC
dc.FillRect(&Rectangle , &brush);
x += 2;
}

else if ((testline.GetAt(pos)) == '0'){
x += 2 ;
}
pos++ ;
}
y += 4 ;
x = 0 ;
pos = 0 ;
dc.EndPage() ;
printInfo.m_rectDraw = draw_area ;
dc.EndDoc() ;
VERIFY(dc.DeleteDC()) ;
}
------------------------------------------------------------------------------