예제 #1
0
        internal static PDFDictionary Copy(PDFDictionary dict)
        {
            PDFDictionary result = new PDFDictionary();

            string[] keys = { "F", "Aspect", "Rotate" };
            for (int i = 0; i < keys.Length; ++i)
            {
                IPDFObject obj = dict[keys[i]];
                if (obj != null)
                {
                    result.AddItem(keys[i], obj.Clone());
                }
            }

            IPDFObject poster = dict["Poster"];

            if (poster != null)
            {
                result.AddItem("Poster", poster);
            }

            return(result);
        }
예제 #2
0
        internal static PDFDictionary Copy(PDFDictionary dict)
        {
            PDFDictionary newDict = new PDFDictionary();

            string[] keys = { "ExtGState", "ColorSpace", "Pattern", "Shading", "XObject", "Font", "Properties" };
            for (int i = 0; i < keys.Length; ++i)
            {
                PDFDictionary res = dict[keys[i]] as PDFDictionary;
                if (res != null)
                {
                    newDict.AddItem(keys[i], res.Clone());
                }
            }

            PDFArray procSet = dict["ProcSet"] as PDFArray;

            if (procSet != null)
            {
                newDict.AddItem("ProcSet", procSet.Clone());
            }

            return(newDict);
        }
예제 #3
0
        internal static PDFDictionary Copy(PDFDictionary dict)
        {
            PDFDictionary newDict = new PDFDictionary();

            string[] arrays = { "C", "D" };
            for (int i = 0; i < arrays.Length; ++i)
            {
                PDFArray arr = dict[arrays[i]] as PDFArray;
                if (arr != null)
                {
                    PDFArray newArr = new PDFArray();
                    for (int j = 0; j < arr.Count; ++j)
                    {
                        PDFNumber num = arr[j] as PDFNumber;
                        newArr.AddItem(num.Clone());
                    }
                    newDict.AddItem(arrays[i], newArr);
                }
            }

            PDFNumber w = dict["W"] as PDFNumber;

            if (w != null)
            {
                newDict.AddItem("W", w.Clone());
            }

            PDFName s = dict["S"] as PDFName;

            if (s != null)
            {
                newDict.AddItem("S", s.Clone());
            }

            return(newDict);
        }
예제 #4
0
        internal static void CopyTo(PDFDictionary sourceDict, PDFDictionary destinationDict)
        {
            string[] keys = { "Open", "T", "CA", "CreationDate", "Subj", "RT", "RC" };
            for (int i = 0; i < keys.Length; ++i)
            {
                IPDFObject obj = sourceDict[keys[i]];
                if (obj != null)
                {
                    destinationDict.AddItem(keys[i], obj.Clone());
                }
            }

            //Popup - need set after adding
            //IRT, ExData - TODO
        }
예제 #5
0
        internal static PDFDictionary Copy(PDFDictionary dict)
        {
            PDFDictionary newDict = new PDFDictionary();

            string[] styles = { "CropBox", "BleedBox", "TrimBox", "ArtBox" };
            for (int i = 0; i < styles.Length; ++i)
            {
                PDFDictionary style = dict[styles[i]] as PDFDictionary;
                if (style != null)
                {
                    newDict.AddItem(styles[i], BoxStyleBase.Copy(style));
                }
            }

            return(newDict);
        }
예제 #6
0
        internal static PDFDictionary Copy(PDFDictionary dict)
        {
            PDFDictionary newDict = new PDFDictionary();

            string[] keys = { "Type", "S", "D", "Dm", "M", "Di", "SS", "B" };
            for (int i = 0; i < keys.Length; ++i)
            {
                IPDFObject val = dict[keys[i]];
                if (val != null)
                {
                    newDict.AddItem(keys[i], val.Clone());
                }
            }

            return(newDict);
        }
예제 #7
0
        private void loadPages()
        {
            PDFDictionary pages = _dictionary["Pages"] as PDFDictionary;

            if (pages != null)
            {
                _pages = new PageCollection(pages, _documentEssential);
            }
            else
            {
                _pages = new PageCollection(_documentEssential);
                _dictionary.AddItem("Pages", _pages.GetDictionary());
            }
        }
예제 #8
0
        internal static PDFDictionary Copy(PDFDictionary dict)
        {
            PDFDictionary result = new PDFDictionary();

            string[] keys = { "Type", "U", "C", "F", "D", "FD", "RT", "RD", "PS", "SS", "O" };
            for (int i = 0; i < keys.Length; ++i)
            {
                IPDFObject obj = dict[keys[i]];
                if (obj != null)
                {
                    result.AddItem(keys[i], obj.Clone());
                }
            }

            return(result);
        }
예제 #9
0
        internal static PDFDictionary Copy(PDFDictionary dict)
        {
            PDFDictionary result = new PDFDictionary();

            string[] keys = { "Start", "Duration", "Rate", "Volume", "ShowControls", "Mode", "Synchronous", "FWScale", "FWPosition" };
            for (int i = 0; i < keys.Length; ++i)
            {
                IPDFObject obj = dict[keys[i]];
                if (obj != null)
                {
                    result.AddItem(keys[i], obj.Clone());
                }
            }

            return(result);
        }
예제 #10
0
        internal override Annotation Clone(IDocumentEssential owner, Page page)
        {
            PDFDictionary res = AnnotationBase.Copy(Dictionary);

            IPDFObject open = Dictionary["Open"];

            if (open != null)
            {
                res.AddItem("Open", open.Clone());
            }

            PopupAnnotation annot = new PopupAnnotation(res, owner);

            annot.SetPage(Page, false);
            annot.SetPage(page, true);
            return(annot);
        }
예제 #11
0
        private PDFDictionary createRadioButtonGroup(string name)
        {
            PDFDictionary dict = new PDFDictionary();

            dict.AddItem("FT", new PDFName("Btn"));
            dict.AddItem("Ff", new PDFNumber(49152));
            dict.AddItem("V", new PDFName("Off"));
            dict.AddItem("DV", new PDFName("Off"));
            dict.AddItem("Kids", new PDFArray());
            dict.AddItem("T", new PDFString(name));

            (_dictionary["Fields"] as PDFArray).AddItem(dict);
            return(dict);
        }
예제 #12
0
        public PDFExponentialFunction()
        {
            m_stream = new PDFDictionaryStream();
            PDFDictionary dict  = m_stream.Dictionary;
            PDFArray      array = new PDFArray();

            m_domain    = new float[2];
            m_domain[0] = 0.0f;
            m_domain[1] = 1.0f;

            m_range = new float[0];

            m_c0    = new float[1];
            m_c0[0] = 0.0f;

            m_c1    = new float[1];
            m_c1[0] = 1.0f;

            m_n = 2.0f;

            dict.AddItem("FunctionType", new PDFNumber((float)PDFFunctionType.Exponential));
            for (int i = 0; i < m_domain.Length; ++i)
            {
                array.AddItem(new PDFNumber(m_domain[i]));
            }
            dict.AddItem("Domain", array);
            array = new PDFArray();
            for (int i = 0; i < m_range.Length; ++i)
            {
                array.AddItem(new PDFNumber(m_range[i]));
            }
            if (array.Count != 0)
            {
                dict.AddItem("Range", array);
            }
            array = new PDFArray();
            for (int i = 0; i < m_c0.Length; ++i)
            {
                array.AddItem(new PDFNumber(m_c0[i]));
            }
            dict.AddItem("C0", array);
            array = new PDFArray();
            for (int i = 0; i < m_c1.Length; ++i)
            {
                array.AddItem(new PDFNumber(m_c1[i]));
            }
            dict.AddItem("C1", array);
            dict.AddItem("N", new PDFNumber(m_n));
        }
예제 #13
0
 internal FileSpecification()
 {
     _dictionary = new PDFDictionary();
     _dictionary.AddItem("Type", new PDFName("Filespec"));
 }
예제 #14
0
 internal Catalog()
 {
     _dictionary = new PDFDictionary();
     _dictionary.AddItem("Type", new PDFName("Catalog"));
     _documentEssential = new DocumentEssential(this);
 }
예제 #15
0
        internal static PDFDictionary Copy(PDFDictionary dict)
        {
            PDFDictionary newDict = new PDFDictionary();

            newDict.AddItem("Type", new PDFName("Page"));

            string[] keys = { "LastModified", "Rotate", "Dur", "Metadata", "ID", "PZ", "Tabs", "UserUnit" };
            for (int i = 0; i < keys.Length; ++i)
            {
                IPDFObject obj = dict[keys[i]];
                if (obj != null)
                {
                    newDict.AddItem(keys[i], obj.Clone());
                }
            }

            PDFDictionary resources = dict["Resources"] as PDFDictionary;

            if (resources != null)
            {
                newDict.AddItem("Resources", ResourcesBase.Copy(resources));
            }

            string[] boxes = { "MediaBox", "CropBox", "BleedBox", "TrimBox", "ArtBox" };
            for (int i = 0; i < boxes.Length; ++i)
            {
                PDFArray bbox = dict[boxes[i]] as PDFArray;
                if (bbox != null)
                {
                    PDFArray newBbox = new PDFArray();
                    for (int j = 0; j < bbox.Count; ++j)
                    {
                        PDFNumber num = bbox[j] as PDFNumber;
                        newBbox.AddItem(num.Clone());
                    }
                    newDict.AddItem(boxes[i], newBbox);
                }
            }

            PDFDictionary boxColorInfo = dict["BoxColorInfo"] as PDFDictionary;

            if (boxColorInfo != null)
            {
                newDict.AddItem("BoxColorInfo", BoxColorInfoBase.Copy(boxColorInfo));
            }

            IPDFObject contents = dict["Contents"];

            if (contents != null)
            {
                IPDFObject newContents = null;
                if (contents is PDFDictionaryStream)
                {
                    newContents = contents.Clone();
                }
                else if (contents is PDFArray)
                {
                    newContents = new PDFArray();
                    for (int i = 0; i < (contents as PDFArray).Count; ++i)
                    {
                        PDFDictionaryStream contentsItem = (contents as PDFArray)[i] as PDFDictionaryStream;
                        if (contentsItem != null)
                        {
                            (newContents as PDFArray).AddItem(contentsItem.Clone());
                        }
                    }
                }
                newDict.AddItem("Contents", newContents);
            }

            PDFDictionary group = dict["Group"] as PDFDictionary;

            if (group != null)
            {
                newDict.AddItem("Group", GroupBase.Copy(group));
            }

            PDFDictionaryStream thumb = dict["Thumb"] as PDFDictionaryStream;

            if (thumb != null)
            {
                newDict.AddItem("Thumb", thumb);
            }

            PDFDictionary trans = dict["Trans"] as PDFDictionary;

            if (trans != null)
            {
                newDict.AddItem("Trans", TransitionBase.Copy(trans));
            }

            // Parent, B, StructParents - do not
            // Annots, AA - need set after adding page
            // PieceInfo, SeparationInfo, TemplateInstantiated, PresSteps, VP - still unknown

            return(newDict);
        }
예제 #16
0
 public PDFGroup()
 {
     _dictionary = new PDFDictionary();
     _dictionary.AddItem("S", new PDFName("Transparency"));
     _dictionary.AddItem("CS", new PDFName("DeviceRGB"));
 }
예제 #17
0
 public PDF3DView()
 {
     _dictionary.AddItem("XN", new PDFString("Default"));
 }