June 2003
Intermediate to advanced
800 pages
34h 20m
English
You want to print data from a file without loading it into memory first.
Use the PrintDocument.BeginPrint event to open a stream to the file and the PrintDocument.EndPrint event to close the stream.
When printing a large document, you might want to save the memory overhead by printing the data as it’s read from a stream. This way, the entire document doesn’t need to be held in memory at the same time.
The easiest way to use this approach is to adopt the design from recipe Print a Document That Has Multiple Pages and derive a custom PrintDocument class. This class would track the filename of the document and hold a reference to the underlying file stream. This class would also encapsulate the logic for opening ...
Read now
Unlock full access