Document Constructor (BinaryReader, String)

Note: This API is now obsolete.

Opens an existing password-protected document.

Namespace:  TallComponents.PDF
Assembly:  TallComponents.PDF.Kit (in TallComponents.PDF.Kit.dll) Version:
[ObsoleteAttribute("Please use the Document constructor that takes a Stream as its main argument.  This method will no longer be available in the next major version.")]
public Document(
	BinaryReader reader,
	string password
The password that is required to open this document.

This method gives you full control how the document is read. It requires that the binary reader remains open during the lifetime of the document.

Provided that the argument binary reader is seekable, information will be read from the PDF file on demand. E.g. if one hits page 10 , we seek to the correct position, skipping all other pages, and we return page 10. When after that one request say page 5 we seek back and read that page. This means that one should not close/dispose the binary reader during the hole session one needs the document, or pages, bookmarks, info extracted from it.

If the binary reader is not seekable, we will read information eagerly, i.e. the entire document will first be read into memory before we access it.

Sample code:
FileStream fileStream = new FileStream( @"in.pdf", FileMode.Open, FileAccess.Read );
BinaryReader reader = new BinaryReader( fileStream );
Document source = new Document( reader, "MyPassword" );
See Also