Пример #1
0
        internal Destination(IPDFObject dest, IDocumentEssential owner)
        {
            PDFString s = dest as PDFString;

            if (s != null)
            {
                dest = owner.GetDestinationFromNames(s.GetValue());
                if (dest == null)
                {
                    dest = new PDFArray();
                }
            }

            PDFArray array = dest as PDFArray;

            if (array != null)
            {
                parsePage(array, owner);
                parseZoomMode(array);
                parseProperties(array, owner);
            }
            else
            {
                dest = new PDFArray();
            }

            _array = dest as PDFArray;
        }
Пример #2
0
        protected override bool isHitInRange(PDFArray limits, object key)
        {
            string name = key as string;

            if (name == null)
            {
                throw new ArgumentException("Key must have a string type for NameTree.");
            }

            PDFString first = limits[0] as PDFString;
            PDFString last  = limits[1] as PDFString;

            if (first != null && last != null)
            {
                int comp1 = String.Compare(first.GetValue(), name, StringComparison.Ordinal);
                int comp2 = String.Compare(last.GetValue(), name, StringComparison.Ordinal);

                if (comp1 <= 0 && comp2 >= 0)
                {
                    return(true);
                }
            }

            return(false);
        }
Пример #3
0
        /// <summary>
        /// Gets the element at the specified index.
        /// </summary>
        /// <param name="index" href="http://msdn.microsoft.com/en-us/library/system.int32.aspx">The zero-based index of the element to get.</param>
        /// <returns cref="string" href="http://msdn.microsoft.com/en-us/library/system.string.aspx">The System.String with specified index.</returns>
        public string this[int index]
        {
            get
            {
                if (index < 0 || index >= Count)
                {
                    throw new IndexOutOfRangeException();
                }

                PDFString item = _items[index] as PDFString;
                if (item == null)
                {
                    return("");
                }
                return(item.GetValue());
            }
        }
Пример #4
0
        protected override IPDFObject findItem(PDFArray array, object key)
        {
            if (array == null)
            {
                return(null);
            }

            string name = (string)key;

            for (int i = 0; i < array.Count; i += 2)
            {
                PDFString val = array[i] as PDFString;
                if (val != null && val.GetValue() == name)
                {
                    return(array[i + 1]);
                }
            }

            return(null);
        }