| FileReferenceCreate Method |
Create a new file reference object
The newly created file reference object belongs to the document but is not
(yet) used as an embedded file.
The object can be added to the list of embedded files or to the list of
associated files.
Namespace: PdfTools.Toolbox.PdfAssembly: PdfTools.Toolbox (in PdfTools.Toolbox.dll) Version: 1.2.0+708f7116d933787a0712d56133e4c2c9bf21e5e3
Syntax public static FileReference Create(
Document targetDocument,
Stream data,
string name,
string mediaType,
string description,
DateTimeOffset? modificationDate
)
Parameters
- targetDocument Document
-
the output document with which the returned object is associated
- data Stream
-
A stream of the file to be added.
Read access is required.
- name String
-
The name to be used for the embedded file.
This name is presented to the user when viewing the list of embedded files.
- mediaType String
-
The mime type of the embedded file.
Default: "application/octet-stream".
Common values other than the default are "application/pdf", "application/xml", or "application/msword".
- description String
-
The description of the embedded file.
This is presented to the user when viewing the list of embedded files.
- modificationDate NullableDateTimeOffset
-
The modify date of the file.
Default: current time.
Return Value
FileReference
the newly created file reference object
Exceptions Exception | Condition |
---|
ArgumentException | if the targetDocument argument has already been closed |
ArgumentException | if the targetDocument argument is read-only |
ArgumentException | if the name argument is an empty string |
ConformanceException | if the document's conformance is PDF/A-1 |
ConformanceException | if the document's conformance is PDF/A-2 and the given data
contains a file other than PDF/A-1 or PDF/A-2 |
IOException | Error reading from the stream. |
ArgumentNullException | if targetDocument is . |
ArgumentNullException | if data is . |
ArgumentNullException | if name is . |
See Also