/**
         * <summary>Gets the object equivalent to the given value.</summary>
         */
        public static PdfDirectObject Get(object value)
        {
            if (value == null)
            {
                return(null);
            }

            if (value is Int32)
            {
                return(PdfInteger.Get((int)value));
            }
            else if (value is Double || value is Single)
            {
                return(PdfReal.Get(value));
            }
            else if (value is string)
            {
                return(PdfTextString.Get((string)value));
            }
            else if (value is DateTime)
            {
                return(PdfDate.Get((DateTime)value));
            }
            else if (value is Boolean)
            {
                return(PdfBoolean.Get((Boolean)value));
            }
            else
            {
                throw new NotImplementedException();
            }
        }
Exemple #2
0
        /**
         * <summary>Gets the object equivalent to the given value.</summary>
         */
        public static PdfDirectObject Get(object value)
        {
            if (value == null)
            {
                return(null);
            }

            if (value is int intValue)
            {
                return(PdfInteger.Get(intValue));
            }
            else if (value is double doubleValue)
            {
                return(PdfReal.Get(doubleValue));
            }
            else if (value is float singleValue)
            {
                return(PdfReal.Get(singleValue));
            }
            else if (value is string stringValue)
            {
                return(PdfTextString.Get(stringValue));
            }
            else if (value is DateTime dateTimeValue)
            {
                return(PdfDate.Get(dateTimeValue));
            }
            else if (value is bool booleanValue)
            {
                return(PdfBoolean.Get(booleanValue));
            }
            else if (value is long longValue)
            {
                return(PdfInteger.Get((int)longValue));
            }
            else
            {
                throw new NotImplementedException();
            }
        }
Exemple #3
0
 public void SetInt(int index, int?value)
 {
     this[index] = PdfInteger.Get(value);
 }