AddRichMediaAnnotationFromEmbeddedFile

Rich media, annotations, associated files, payload reuse

Description

Creates a RichMedia annotation whose asset and instance dictionaries reference an existing embedded-file specification instead of writing a duplicate media stream

Syntax

Delphi

Function TPDFlib.AddRichMediaAnnotationFromEmbeddedFile(Left, Top, Width, Height: Double; EmbeddedFileIndex: Integer; Const AssetName, Title, Description: WideString; MediaType: TPDFlibRichMediaType; Activation: TPDFlibRichMediaActivation; Deactivation: TPDFlibRichMediaDeactivation; PosterImageID: Integer= 0): Integer;

ActiveX

Function PDFlib::AddRichMediaAnnotationFromEmbeddedFile(Left As Double, Top As Double, Width As Double, Height As Double, EmbeddedFileIndex As Long, AssetName As String, Title As String, Description As String, MediaType As Long, Activation As Long, Deactivation As Long, PosterImageID As Long) As Long

DLL

int DLAddRichMediaAnnotationFromEmbeddedFile(int InstanceID, double Left, double Top, double Width, double Height, int EmbeddedFileIndex, const wchar_t* AssetName, const wchar_t* Title, const wchar_t* Description, int MediaType, int Activation, int Deactivation, int PosterImageID);
int DLAddRichMediaAnnotationFromEmbeddedFileA(int InstanceID, double Left, double Top, double Width, double Height, int EmbeddedFileIndex, const char* AssetName, const char* Title, const char* Description, int MediaType, int Activation, int Deactivation, int PosterImageID);

Parameters

Left, TopPosition of the upper-left corner of the annotation rectangle in current output units, converted with the document scale and origin
Width, HeightPositive dimensions of the annotation rectangle in current output units
EmbeddedFileIndexOne-based embedded-file index that must resolve to an existing file specification, for example from GetAssociatedFileEmbeddedIndex
AssetNameNon-empty name of the asset inside the RichMedia annotation
TitlePresentation title; it may be empty
DescriptionDescription of the media; it must be nonempty in PDF/UA mode
MediaTypermtVideo 0, rmtSound 1, rmtFlash 2, or rmt3D 3
ActivationrmaExplicit 0, rmaPageOpened 1, or rmaPageVisible 2
DeactivationrmdExplicit 0, rmdPageClosed 1, or rmdPageInvisible 2
PosterImageIDOptional poster image ID; 0, the default, omits the poster, and any other value must identify an image in the selected document

Return values

1The annotation was created against the existing embedded-file specification and the document was raised to Adobe Extension Level 3
0No document is loaded, AssetName is empty, a dimension is not positive, PDF/A mode is active, PDF/UA mode has no description, the embedded-file index or poster image is invalid, or Extension Level 3 is unavailable; LastErrorCode 602 reports the missing extension level

Remarks

EmbeddedFileIndex is one-based and may come from GetAssociatedFileEmbeddedIndex

The method requires Adobe Extension Level 3, rejects PDF/A, and requires a nonempty description in PDF/UA mode

MediaType is 0 through 3, while activation and deactivation values are 0 through 2