Example #1
0
        internal RadioButton(PDFDictionary dict, IDocumentEssential owner)
            : base(dict, owner)
        {
            PDFDictionary ap = dict["AP"] as PDFDictionary;

            if (ap != null)
            {
                PDFDictionary n = ap["N"] as PDFDictionary;
                if (n != null)
                {
                    string[] keys = n.GetKeys();
                    if (keys.Length == 0)
                    {
                        _exportValue = "value1";
                    }
                    else if (keys.Length == 1)
                    {
                        _exportValue = keys[0];
                    }
                    else
                    {
                        _exportValue = keys[0] == "Off" ? keys[1] : keys[0];
                    }
                }
                else
                {
                    _exportValue = "value1";
                }
            }
            else
            {
                _exportValue = "value1";
            }
        }
Example #2
0
        private void initImages()
        {
            _images = new ReadOnlyCollection <Image>();
            PDFDictionary dictionary = _dictionary["XObject"] as PDFDictionary;

            if (dictionary != null)
            {
                string[] keys = dictionary.GetKeys();

                for (int i = 0; i < keys.Length; ++i)
                {
                    PDFDictionaryStream dict = dictionary[keys[i]] as PDFDictionaryStream;
                    if (dict != null)
                    {
                        PDFName name = dict.Dictionary["Subtype"] as PDFName;
                        if (name != null)
                        {
                            if (name.GetValue() == "Image")
                            {
                                _images.AddItem(new Image(dict));
                            }
                        }
                    }
                }
            }
        }
Example #3
0
        public void Collect(XRef xref)
        {
            if (ObjNo != -1)
            {
                return;
            }

            Entry entry = new Entry(0, 0);

            entry.Object = this;
            xref.Entries.Add(entry);

            ObjNo = xref.Entries.Count - 1;

            string[] keys = _dictionary.GetKeys();
            for (int i = 0; i < keys.Length; ++i)
            {
                IPDFObject item = _dictionary[keys[i]];
                item.Collect(xref);
            }
        }
Example #4
0
        //internal ByteRange
        //internal Contents

        static internal int Write(SaveParameters param, PDFDictionary dict, out int[] byteRange)
        {
            int byteRangeOffset = -1;

            byteRange    = new int[4];
            byteRange[0] = 0;

            Stream stream = param.Stream;

            stream.WriteByte((byte)'<');
            stream.WriteByte((byte)'<');

            string[] keys  = dict.GetKeys();
            int      count = keys.Length;

            for (int i = 0; i < count; ++i)
            {
                string key = keys[i];
                PDFName.Write(stream, key);

                stream.WriteByte((byte)' ');

                IPDFObject val = dict[key];

                if (key == "ByteRange")
                {
                    byteRangeOffset = (int)stream.Position;
                }
                else if (key == "Contents")
                {
                    byteRange[1] = (int)stream.Position;
                }

                if (val is PDFDictionary || val is PDFDictionaryStream)
                {
                    if (!param.WriteInheritableObjects)
                    {
                        StringUtility.WriteToStream(val.ObjNo, stream);
                        stream.WriteByte((byte)' ');
                        stream.WriteByte((byte)'0');
                        stream.WriteByte((byte)' ');
                        stream.WriteByte((byte)'R');
                    }
                    else
                    {
                        val.Write(param);
                    }
                }
                else
                {
                    val.Write(param);
                }

                if (key == "ByteRange")
                {
                    for (int j = 0; j < 30; j++)
                    {
                        stream.WriteByte((byte)' ');
                    }
                }
                else if (key == "Contents")
                {
                    byteRange[2] = (int)stream.Position;
                }

                if (i != count - 1)
                {
                    stream.WriteByte((byte)'\n');
                }
            }

            stream.WriteByte((byte)'>');
            stream.WriteByte((byte)'>');

            return(byteRangeOffset);
        }