Class PdfDocumentSource
The source for a pdf document.
Implements
Namespace: Sartorius.SAF.Pdf
Assembly: Sartorius.SAF.Pdf.dll
Syntax
public class PdfDocumentSource : IDisposable
Constructors
View SourcePdfDocumentSource()
Initializes a new instance of the PdfDocumentSource class.
Declaration
protected PdfDocumentSource()
PdfDocumentSource(Byte[])
Initializes a new instance of the PdfDocumentSource class from a memory source.
Declaration
public PdfDocumentSource(byte[] content)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Byte[] | content | The content. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException |
|
PdfDocumentSource(Stream)
Initializes a new instance of the PdfDocumentSource class for a System.IO.Stream source.
Declaration
public PdfDocumentSource(Stream stream)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.Stream | stream | The stream. The PdfDocumentSource becomes the owner of the stream. |
Remarks
Do not dispose the stream. When loading a PdfDocument with LoadDocument() the loaded PdfDocument
takes ownership of the stream and it will be disposed when the PdfDocument is disposed. When LoadDocument() is not called the
PdfDocumentSource will dispose the stream.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException |
|
PdfDocumentSource(String)
Initializes a new instance of the PdfDocumentSource class for a file source.
Declaration
public PdfDocumentSource(string path)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | path | The path. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException |
|
Methods
View SourceDispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
Dispose(Boolean)
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | disposing |
|
Equals(PdfDocumentSource)
Determines if another instance of PdfDocumentSource is equal to this instance.
Declaration
protected virtual bool Equals(PdfDocumentSource other)
Parameters
| Type | Name | Description |
|---|---|---|
| PdfDocumentSource | other | The other. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
Equals(Object)
Determines whether the specified object is equal to the current object.
Declaration
public override bool Equals(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | obj | The object to compare with the current object. |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if the specified object is equal to the current object; otherwise, false. |
Overrides
GetHashCode()
Serves as a hash function for a particular type.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| System.Int32 | A hash code for the current object. |
Overrides
LoadDocument()
Loads the document.
Declaration
public virtual PdfDocument LoadDocument()
Returns
| Type | Description |
|---|---|
| PdfDocument | The PdfDocument loaded from the source. |
Remarks
When using a System.IO.Stream the returned PdfDocument becomes the owner of the stream. This method can only be called once when using a stream.
Exceptions
| Type | Condition |
|---|---|
| System.InvalidOperationException | The document source was not specified ORThe source is a System.IO.Stream and LoadDocument() has already been called once. |
Operators
View SourceEquality(PdfDocumentSource, PdfDocumentSource)
Implements the operator ==.
Declaration
public static bool operator ==(PdfDocumentSource left, PdfDocumentSource right)
Parameters
| Type | Name | Description |
|---|---|---|
| PdfDocumentSource | left | The left. |
| PdfDocumentSource | right | The right. |
Returns
| Type | Description |
|---|---|
| System.Boolean | The result of the operator. |
Inequality(PdfDocumentSource, PdfDocumentSource)
Implements the operator !=.
Declaration
public static bool operator !=(PdfDocumentSource left, PdfDocumentSource right)
Parameters
| Type | Name | Description |
|---|---|---|
| PdfDocumentSource | left | The left. |
| PdfDocumentSource | right | The right. |
Returns
| Type | Description |
|---|---|
| System.Boolean | The result of the operator. |