iTextSharp.text.pdf.collection.PdfCollectionField.GetValue C# (CSharp) Method

GetValue() public method

public GetValue ( String v ) : PdfObject
v String
return iTextSharp.text.pdf.PdfObject
        public PdfObject GetValue(String v)
        {
            switch (fieldType) {
            case TEXT:
                return new PdfString(v, PdfObject.TEXT_UNICODE);
            case DATE:
                return new PdfDate(PdfDate.Decode(v));
            case NUMBER:
                return new PdfNumber(v);
            }
            throw new InvalidOperationException(MessageLocalization.GetComposedMessage("1.is.not.an.acceptable.value.for.the.field.2", v, Get(PdfName.N).ToString()));
        }

Usage Example

        /**
         * Sets the value of the collection item.
         * @param value
         */
        virtual public void AddItem(String key, String value)
        {
            PdfName            fieldname = new PdfName(key);
            PdfCollectionField field     = (PdfCollectionField)schema.Get(fieldname);

            Put(fieldname, field.GetValue(value));
        }