PeachDrawing.PDF.PdfPageSource

PdfPageSource.Open Method

Overloads  
Open(byte[]) Opens a PDF held in memory.
Open(byte[], string) Opens a PDF held in memory that is protected with a password.
Open(Stream) Opens a PDF read from stream, which is read to the end and not closed.
Open(Stream, string) Opens a PDF protected with a password, read from stream, which is read to the end and not closed.

PdfPageSource.Open(byte[]) Method

Opens a PDF held in memory.

public static PeachDrawing.PDF.PdfPageSource Open(byte[] pdf);

Parameters

pdf System.Byte[]

the bytes of the PDF file

Returns

PdfPageSource
the opened file

Exceptions

System.IO.InvalidDataException
the data is not a readable PDF

System.NotSupportedException
the PDF needs a password to open, uses RC4, or uses an unknown security handler

PdfPageSource.Open(byte[], string) Method

Opens a PDF held in memory that is protected with a password.

public static PeachDrawing.PDF.PdfPageSource Open(byte[] pdf, string? password);

Parameters

pdf System.Byte[]

the bytes of the PDF file

password System.String

the user password, or for an AES-256 file the owner password too; null or empty for a file that opens without one

Returns

PdfPageSource
the opened file

Exceptions

System.IO.InvalidDataException
the data is not a readable PDF

PdfPasswordException
the PDF needs a password that was not given or is wrong

System.NotSupportedException
the PDF uses RC4 or an unknown security handler

PdfPageSource.Open(Stream) Method

Opens a PDF read from stream, which is read to the end and not closed.

public static PeachDrawing.PDF.PdfPageSource Open(System.IO.Stream stream);

Parameters

stream System.IO.Stream

a stream positioned at the start of the PDF file

Returns

PdfPageSource
the opened file

Exceptions

System.IO.InvalidDataException
the data is not a readable PDF

System.NotSupportedException
the PDF needs a password to open, uses RC4, or uses an unknown security handler

PdfPageSource.Open(Stream, string) Method

Opens a PDF protected with a password, read from stream, which is read to the end and not closed.

public static PeachDrawing.PDF.PdfPageSource Open(System.IO.Stream stream, string? password);

Parameters

stream System.IO.Stream

a stream positioned at the start of the PDF file

password System.String

the password, or null for a file that opens without one

Returns

PdfPageSource
the opened file

Exceptions

System.IO.InvalidDataException
the data is not a readable PDF

PdfPasswordException
the PDF needs a password that was not given or is wrong

System.NotSupportedException
the PDF uses RC4 or an unknown security handler