PdfAssociatedFileCollection Class
Represents a collection of associated files that provide a means to associate content in other formats with selected objects of a PDF file and to identify the relationship between them.
For associated files their associated PdfFileSpecification shall include the AssociatedRelationshipType property indicating one of several possible relationships that the file has to the associated PDF object.
public sealed class PdfAssociatedFileCollection : PdfOptionalCollection<PdfFileSpecification>, IList, ICollection, IList<PdfFileSpecification>, ICollection<PdfFileSpecification>, IEnumerable<PdfFileSpecification>, IEnumerable
Public NotInheritable Class PdfAssociatedFileCollection
Inherits PdfOptionalCollection(Of PdfFileSpecification)
Implements IList, ICollection, IList(Of PdfFileSpecification), ICollection(Of PdfFileSpecification), IEnumerable(Of PdfFileSpecification), IEnumerable
- Inheritance:
- System.ObjectPdfAssociatedFileCollection
Implements
Methods
Add(PdfAssociatedFileRelationshipType, String, String, PdfEmbeddedFileSpecificationTree)
Adds a new PdfFileSpecification with the specified relationship and the EmbeddedFile copied from the resource specified by the filePath
.
public PdfFileSpecification Add(PdfAssociatedFileRelationshipType associatedRelationshipType, string filePath, string mediaType = null, PdfEmbeddedFileSpecificationTree embeddedFiles = null)
Public Function Add(associatedRelationshipType As PdfAssociatedFileRelationshipType, filePath As String, mediaType As String = Nothing, embeddedFiles As PdfEmbeddedFileSpecificationTree = Nothing) As PdfFileSpecification
Parameters
associatedRelationshipType
- PdfAssociatedFileRelationshipType
The relationship between the component of a PDF document that refers to this PdfAssociatedFileCollection and the newly added PdfFileSpecification.
filePath
- System.String
The location of the resource copied to the EmbeddedFile of a newly added PdfFileSpecification. This value is also used to resolve the Name and a key in the PdfEmbeddedFileSpecificationTree (if embeddedFiles
is not null) of a newly added PdfFileSpecification.
mediaType
- System.String
The media type of the embedded file.
embeddedFiles
- PdfEmbeddedFileSpecificationTree
The EmbeddedFiles to which the newly created PdfFileSpecification should be added or null.
Returns
A newly created PdfFileSpecification with the specified relationship and the EmbeddedFile copied from the resource specified by the filePath
added to the PdfAssociatedFileCollection.
Remarks
The EmbeddedFile's Size, CreationDate, ModificationDate, and MediaType properties are automatically set, if they can be resolved from the resource specified by the filePath
.
Exceptions
- System.ArgumentNullException
filePath
is null or System.String.Empty.
AddEmpty(PdfAssociatedFileRelationshipType, String, String, PdfEmbeddedFileSpecificationTree)
Adds a new PdfFileSpecification with the specified relationship and an empty EmbeddedFile.
Use the OpenWrite(Boolean) method of the EmbeddedFile of a returned PdfFileSpecification to fill the empty EmbeddedFile.
public PdfFileSpecification AddEmpty(PdfAssociatedFileRelationshipType associatedRelationshipType, string fileSpecificationName, string mediaType = null, PdfEmbeddedFileSpecificationTree embeddedFiles = null)
Public Function AddEmpty(associatedRelationshipType As PdfAssociatedFileRelationshipType, fileSpecificationName As String, mediaType As String = Nothing, embeddedFiles As PdfEmbeddedFileSpecificationTree = Nothing) As PdfFileSpecification
Parameters
associatedRelationshipType
- PdfAssociatedFileRelationshipType
The relationship between the component of a PDF document that refers to this PdfAssociatedFileCollection and the newly added PdfFileSpecification.
fileSpecificationName
- System.String
The name of a newly added PdfFileSpecification. This value is also used to resolve a key in the PdfEmbeddedFileSpecificationTree (if embeddedFiles
is not null) of a newly added PdfFileSpecification.
mediaType
- System.String
The media type of the embedded file.
embeddedFiles
- PdfEmbeddedFileSpecificationTree
The EmbeddedFiles to which the newly created PdfFileSpecification should be added or null.
Returns
A newly created PdfFileSpecification with the specified relationship and an empty EmbeddedFile added to the PdfAssociatedFileCollection.
Exceptions
- System.ArgumentNullException
fileSpecificationName
is null or System.String.Empty.
Inherited Properties
Count | Gets the number of elements contained in the PdfCollection. (Inherited from PdfCollection) |
Metadata | (Optional; PDF 1.4) A metadata stream containing metadata for the component. (Inherited from PdfObject) |
Inherited Methods
Clear() | Removes all elements from the PdfCollection. (Inherited from PdfCollection) |
RemoveAt(System.Int32) | Removes the element at the specified index of the PdfCollection. (Inherited from PdfCollection) |