Exemple #1
0
 private void setAdditionalAction(Action action, string key)
 {
     if (action == null)
     {
         setActionValue(null, key);
         if (_dictionary["AA"] as PDFDictionary != null)
         {
             (_dictionary["AA"] as PDFDictionary).RemoveItem(key);
             if ((_dictionary["AA"] as PDFDictionary).Count == 0)
             {
                 _dictionary.RemoveItem("AA");
             }
         }
     }
     else
     {
         Action a = action.Clone(_owner);
         setActionValue(a, key);
         if ((_dictionary["AA"] as PDFDictionary) == null)
         {
             _dictionary.AddItem("AA", new PDFDictionary());
         }
         (_dictionary["AA"] as PDFDictionary).AddItem(key, a.GetDictionary());
     }
 }
        /// <summary>
        /// Removes the action with the specified index from the collection.
        /// </summary>
        /// <param name="index" href="http://msdn.microsoft.com/en-us/library/system.int32.aspx">The zero-based index of the action to be removed.</param>
        public void Remove(int index)
        {
            if (index < 0 || index >= Count)
            {
                throw new IndexOutOfRangeException();
            }

            _actions.RemoveAt(index);
            if (_actions.Count == 0)
            {
                _parent.RemoveItem(_key);
            }
            else
            {
                PDFArray arr = _parent[_key] as PDFArray;
                arr.RemoveItem(index);
            }
        }
Exemple #3
0
        private void parseKids(PDFDictionary dict)
        {
            IPDFObject resources = dict["Resources"];
            IPDFObject mediaBox  = dict["MediaBox"];
            IPDFObject cropBox   = dict["CropBox"];
            IPDFObject rotate    = dict["Rotate"];

            PDFArray kids    = _dictionary["Kids"] as PDFArray;
            PDFArray newKids = new PDFArray();

            readPages(kids, newKids, resources, mediaBox, cropBox, rotate);

            dict.RemoveItem("Resources");
            dict.RemoveItem("MediaBox");
            dict.RemoveItem("CropBox");
            dict.RemoveItem("Rotate");

            dict.AddItem("Kids", newKids);
        }
Exemple #4
0
        private void parsePrevAndXrefStm()
        {
            if (_xrefPositions.Count == 0)
            {
                PDFNumber Prev    = _trailer["Prev"] as PDFNumber;
                PDFNumber XRefStm = _trailer["XRefStm"] as PDFNumber;

                if (XRefStm != null)
                {
                    int val = (int)XRefStm.GetValue();
                    _trailer.RemoveItem("XRefStm");
                    _parsedXrefTables.Add(val);
                    parseXref(val);
                }
                if (Prev != null)
                {
                    int val = (int)Prev.GetValue();
                    _trailer.RemoveItem("Prev");
                    _parsedXrefTables.Add(val);
                    parseXref(val);
                }
            }
        }
Exemple #5
0
        public void Decode()
        {
            Filter[] filters = getFilters();
            if (filters.Length == 0)
            {
                return;
            }

            _stream.Position = 0;
            try
            {
                for (int i = 0; i < filters.Length; ++i)
                {
                    switch (filters[i])
                    {
                    case Filter.ASCII85:
                        _stream = ASCII85Decoder.Decode(_stream);
                        break;

                    case Filter.ASCIIHex:
                        _stream = ASCIIHexDecoder.Decode(_stream);
                        break;

                    case Filter.RunLength:
                        _stream = RunLengthDecoder.Decode(_stream);
                        break;

                    case Filter.JPX:
                        _stream = JPXDecoder.Decode(_stream);
                        break;

                    case Filter.CCITTFax:
                        _stream = CCITTFaxDecoder.Decode(_stream, getDecodeParameters(i));
                        break;

                    case Filter.DCT:
                        _stream = DCTDecoder.Decode(_stream, getDecodeParameters(i));
                        break;

                    case Filter.Flate:
                        _stream = FlateDecoder.Decode(_stream, getDecodeParameters(i));
                        break;

                    case Filter.JBIG2:
                        _stream = JBIG2Decoder.Decode(_stream, getDecodeParameters(i));
                        break;

                    case Filter.LZW:
                        _stream = LZWDecoder.Decode(_stream, getDecodeParameters(i));
                        break;
                    }
                    _stream.Position = 0;
                }
            }
            catch
            {
                return;
            }

            _dictionary.RemoveItem("Filter");
            _dictionary.RemoveItem("DecodeParms");
        }