Using StartDoc/EndDoc to create a large PDF using less memory

When the StartDoc/EndDoc approach is used to create a PDF, new pages are immediately written to the output stream. This allows you to save memory when creating very large documents.