/** * <summary>Creates a new reference to an embedded file.</summary> * <param name="embeddedFile">Embedded file corresponding to the reference.</param> * <param name="filename">Name corresponding to the reference.</param> */ public static FullFileSpecification Get( EmbeddedFile embeddedFile, string filename ) { return(new FullFileSpecification(embeddedFile, filename)); }
internal FullFileSpecification( EmbeddedFile embeddedFile, string filename ) : this(embeddedFile.Document, filename) { EmbeddedFile = embeddedFile; }
public void Add( string key, EmbeddedFile value ) { PdfArray itemPairs = BaseDataObject; // New entry. itemPairs.Add(new PdfTextString(key)); itemPairs.Add(value.BaseObject); }
/** * <summary>Gets the embedded file associated to the given key.</summary> */ private EmbeddedFile GetEmbeddedFile( PdfName key ) { PdfDictionary embeddedFilesObject = (PdfDictionary)BaseDictionary[PdfName.EF]; if (embeddedFilesObject == null) { return(null); } return(EmbeddedFile.Wrap(embeddedFilesObject[key])); }
/** * <see cref="GetEmbeddedFile(PdfName)"/> */ private void SetEmbeddedFile( PdfName key, EmbeddedFile value ) { PdfDictionary embeddedFilesObject = (PdfDictionary)BaseDictionary[PdfName.EF]; if (embeddedFilesObject == null) { BaseDictionary[PdfName.EF] = embeddedFilesObject = new PdfDictionary(); } embeddedFilesObject[key] = value.BaseObject; }
public bool TryGetValue( string key, out EmbeddedFile value ) { value = this[key]; if (value == null) { return(ContainsKey(key)); } else { return(true); } }
IEnumerator <KeyValuePair <string, EmbeddedFile> > IEnumerable <KeyValuePair <string, EmbeddedFile> > .GetEnumerator( ) { PdfArray itemPairs = BaseDataObject; for ( int index = 0, length = itemPairs.Count; index < length; index += 2 ) { yield return(new KeyValuePair <string, EmbeddedFile>( (string)((PdfTextString)itemPairs[index]).Value, EmbeddedFile.Wrap(itemPairs[index + 1]) )); } }
public EmbeddedFile this[ string key ] { get { PdfArray itemPairs = BaseDataObject; for ( int index = 0, length = itemPairs.Count; index < length; index += 2 ) { if (((PdfTextString)itemPairs[index]).Value.Equals(key)) { return(EmbeddedFile.Wrap(itemPairs[index + 1])); } } return(null); } set { PdfArray itemPairs = BaseDataObject; for ( int index = 0, length = itemPairs.Count; index < length; index += 2 ) { // Already existing entry? if (((PdfTextString)itemPairs[index]).Value.Equals(key)) { itemPairs[index + 1] = value.BaseObject; return; } } // New entry. itemPairs.Add(new PdfTextString(key)); itemPairs.Add(value.BaseObject); } }