Exemplo n.º 1
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 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();
            }
        }
Exemplo n.º 2
0
 public Rectangle(double left, double top, double width, double height)
     : this(new PdfArray(new PdfDirectObject[]
 {
     PdfReal.Get(left),         // Left (X).
     PdfReal.Get(top - height), // Bottom (Y).
     PdfReal.Get(left + width), // Right.
     PdfReal.Get(top)           // Top.
 }
                         )
            )
 {
 }
Exemplo n.º 3
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();
            }
        }
Exemplo n.º 4
0
 public void SetDouble(int index, double?value)
 {
     this[index] = PdfReal.Get(value);
 }
Exemplo n.º 5
0
 public void SetFloat(int index, float?value)
 {
     this[index] = PdfReal.Get(value);
 }