If you are driving the print output as a report, you must be prepared to start the report over.
For example, A text file being printed must be reset to the beginning of the file at the end of the preview.
My language is avr so I hope this makes sense.
The sr, stream reader, is closed at the end of the preview.
e.HasMorePages = *false
sr.Close()
The preview print button calls the Printpage event again. The text file
is reopened to the beginning.
BegSr printDocument1_PrintPage Access(*Private) Event(*this.printDocument1.PrintPage)
DclSrParm sender *Object
DclSrParm e System.Drawing.Printing.PrintPageEventArgs
dclfld pinx *integer2
if currentindex = 0
sr = *New System.IO.StreamReader(BarCd_FileName)
endif
pinx = 0
do fromval(0) toval(50-1) index(pinx)
if sr.Peek() < 0
leave
endif
OsFileLine = sr.ReadLine()
if OsFileLine = *nothing
iterate
endif
TextPaint(pinx, e.Graphics )
enddo
if sr.Peek() >= 0
Current_Page = Current_Page + 1
e.HasMorePages = *true
else
e.HasMorePages = *false
sr.Close()
currentindex = 0
endif
EndSr