コード例 #1
0
 // Methods
 public ShadingType3(PDFDirect d) : base(d)
 {
     this.mCoords     = null;
     this.mStartCoord = null;
     this.mEndCoord   = null;
     this.mExtend     = null;
 }
コード例 #2
0
ファイル: Resources.cs プロジェクト: silvath/siscobras
        private static Resource CreateResource(PDFDirect d, Type resType)
        {
            MethodInfo info1;

            object[] objArray1;
            try
            {
                while (!resType.Equals(typeof(object)))
                {
                    if (resType.Equals(typeof(Resource)))
                    {
                        return(null);
                    }
                    if (!resType.IsSubclassOf(typeof(Resource)))
                    {
                        throw new ArgumentException("Resources should derive from Altsoft.PDFO.Resource", "resType");
                    }
                    info1 = resType.GetMethod("Factory", (BindingFlags.NonPublic | (BindingFlags.Public | BindingFlags.Static)));
                    if (info1 == null)
                    {
                        resType = resType.BaseType;
                        continue;
                    }
                    objArray1    = new object[1];
                    objArray1[0] = ((object)d);
                    return((Resource)info1.Invoke(null, objArray1));
                }
            }
            catch (TargetInvocationException exception1)
            {
                throw exception1.InnerException;
            }
            throw new ArgumentException("Resources should have static method with signature (PDFDirect)", "resType");
        }
コード例 #3
0
        public PDFIndirect New(PDFDirect dir)
        {
            PDFIndirect indirect1 = this.New();

            indirect1.Direct = dir;
            return(indirect1);
        }
コード例 #4
0
 internal static PDFObject TreatNewCollectionObject(PDFDirect collection, PDFObject o)
 {
     if (!o.IsIndirect)
     {
         if (o.Parent != null)
         {
             o = ((PDFObject)o.Clone());
         }
         if (o.PDFType == PDFObjectType.tPDFStream)
         {
             if (collection.Doc != null)
             {
                 o = collection.Doc.Indirects.New(o.Direct);
             }
             else
             {
                 o = Library.CreateIndirect(o.Direct);
             }
         }
         o.Parent = collection;
         return(o);
     }
     if (((o.Doc != collection.Doc) && (o.Doc != null)) && (collection.Doc != null))
     {
         throw new InvalidOperationException("Can not connect objects from different documents");
     }
     if ((o.Doc == null) && (collection.Doc != null))
     {
         ((CorePDFObject)o.Indirect).SetDocument(collection.Doc);
     }
     return(o.Indirect);
 }
コード例 #5
0
        public PDFDirect DetachDirect()
        {
            PDFDirect direct1 = this.Direct;

            this.mDirect = CorePDFNull.Instance;
            return(direct1);
        }
コード例 #6
0
ファイル: Shading.cs プロジェクト: silvath/siscobras
 public Shading(PDFDirect d) : base(d)
 {
     this.mColorSpace = null;
     this.mBackground = null;
     this.mBBox       = null;
     this.mFunction   = null;
 }
コード例 #7
0
ファイル: Rendition.cs プロジェクト: silvath/siscobras
        public static Resource Factory(PDFDirect direct)
        {
            if (direct == null)
            {
                return(null);
            }
            string text1 = ((direct as PDFDict)["S"] as PDFName).Value;

            if (text1 == null)
            {
                goto Label_0056;
            }
            text1 = string.IsInterned(text1);
            if (text1 != "MR")
            {
                if (text1 == "SR")
                {
                    goto Label_004F;
                }
                goto Label_0056;
            }
            return(new RenditionMedia(direct));

Label_004F:
            return(new RenditionSelector(direct));

Label_0056:
            return(null);
        }
コード例 #8
0
ファイル: ArticleBead.cs プロジェクト: silvath/siscobras
 // Methods
 public ArticleBead(PDFDirect direct) : base(direct)
 {
     this.mThread   = null;
     this.mNextBead = null;
     this.mPrevBead = null;
     this.mBeadRect = null;
 }
コード例 #9
0
        private void Create()
        {
            XRefEntry entry1 = new XRefEntry();

            entry1.dirty      = false;
            entry1.type       = 0;
            entry1.generation = 65535;
            entry1.indirect   = null;
            entry1.offset     = ((long)0);
            this.mXRef.Add(entry1);
            this.mRoot = Library.CreateDict();
            this.Indirects.New().Direct = this.mRoot;
            this.mRoot["Type"]          = Library.CreateName("Catalog");
            PDFObject obj1 = this.Indirects.New();

            this.mRoot["Pages"] = obj1;
            PDFDirect direct1 = Library.CreateDict();

            obj1.Direct = direct1;
            PDFDict dict1 = ((PDFDict)direct1);

            dict1["Type"]         = Library.CreateName("Pages");
            dict1["Count"]        = Library.CreateInteger(((long)0));
            dict1["Kids"]         = Library.CreateArray(0);
            this.mInfo            = Library.CreateDict();
            this.mTrailer         = Library.CreateDict();
            this.mTrailer["Root"] = this.Indirects.New(this.mRoot);
            this.mTrailer["Info"] = this.Indirects.New(this.mInfo);
        }
コード例 #10
0
ファイル: Library.cs プロジェクト: silvath/siscobras
        public static PDFIndirect CreateIndirect(PDFDirect direct)
        {
            PDFIndirect indirect1 = Library.Instance._CreateIndirect();

            indirect1.Direct = direct;
            return(indirect1);
        }
コード例 #11
0
        internal static Resource Factory(PDFDirect d)
        {
            PDFName name1;
            PDFDict dict1 = (d as PDFStream).Dict;
            string  text1 = (dict1["Subtype"] as PDFName).Value;

            if (text1 == "Image")
            {
                return(new XObjectImage(d));
            }
            if (text1 == "Form")
            {
                name1 = (dict1["SubType2"] as PDFName);
                if (name1 == null)
                {
                    return(new XObjectForm(d));
                }
                if (name1.Value == "PS")
                {
                    return(new XObjectPS(d));
                }
                return(new XObjectForm(d));
            }
            if (text1 == "PS")
            {
                return(new XObjectPS(d));
            }
            throw new PDFSyntaxException(d, "Invalid XObject type");
        }
コード例 #12
0
ファイル: Pattern.cs プロジェクト: silvath/siscobras
        internal static Resource Factory(PDFDirect d)
        {
            PDFObjectType type1 = d.PDFType;

            switch (type1)
            {
            case PDFObjectType.tPDFDict:
            {
                goto Label_0024;
            }

            case PDFObjectType.tPDFArray:
            {
                goto Label_002B;
            }

            case PDFObjectType.tPDFStream:
            {
                goto Label_001D;
            }
            }
            goto Label_002B;
Label_001D:
            return(new PatternTiling(d));

Label_0024:
            return(new PatternShading(d));

Label_002B:
            throw new PDFSyntaxException(d, "Invalid Pattern");
        }
コード例 #13
0
        // Methods
        public FontType3(PDFDirect d) : base(d)
        {
            int        num1;
            PDFNumeric numeric1;
            PDFArray   array1 = (this.Dict["FontMatrix"] as PDFArray);

            if (array1 == null)
            {
                throw new ArgumentException("No FontMatrix entry for the Type3 font.");
            }
            if (6 != array1.Count)
            {
                throw new ArgumentException("Incorrect FontMatrix entry for the Type3 font. Must have 6 positions.");
            }
            double[] numArray1 = new double[6];
            for (num1 = 0; (num1 < 6); num1 += 1)
            {
                numeric1 = (array1[num1] as PDFNumeric);
                if (numeric1 == null)
                {
                    throw new ArgumentException("Incorrect datatype for the entry of FontMatrix array.");
                }
                numArray1[num1] = numeric1.DoubleValue;
            }
            this.mMatrix = new CTM(numArray1);
        }
コード例 #14
0
        internal static Resource Factory(PDFDirect d)
        {
            PDFArray array1;

            if (< PrivateImplementationDetails >.$$method0x6000404 - 1 == null)
            {
                Hashtable hashtable1 = new Hashtable(24, 0.5f);
                hashtable1.Add("DeviceGray", 0);
                Hashtable hashtable2 = new Hashtable(24, 0.5f);
                hashtable2.Add("DeviceRGB", 1);
                Hashtable hashtable3 = new Hashtable(24, 0.5f);
                hashtable3.Add("DeviceCMYK", 2);
                Hashtable hashtable4 = new Hashtable(24, 0.5f);
                hashtable4.Add("CalGray", 3);
                Hashtable hashtable5 = new Hashtable(24, 0.5f);
                hashtable5.Add("CalRGB", 4);
                Hashtable hashtable6 = new Hashtable(24, 0.5f);
                hashtable6.Add("Lab", 5);
                Hashtable hashtable7 = new Hashtable(24, 0.5f);
                hashtable7.Add("Indexed", 6);
                Hashtable hashtable8 = new Hashtable(24, 0.5f);
                hashtable8.Add("Separation", 7);
                Hashtable hashtable9 = new Hashtable(24, 0.5f);
                hashtable9.Add("DeviceN", 8);
                Hashtable hashtable10 = new Hashtable(24, 0.5f);
                hashtable10.Add("Pattern", 9);
                Hashtable hashtable11 = new Hashtable(24, 0.5f);
                hashtable11.Add("ICCBased", 10);
コード例 #15
0
ファイル: MediaClipBase.cs プロジェクト: silvath/siscobras
        public static Resource Factory(PDFDirect direct)
        {
            if (direct == null)
            {
                return(null);
            }
            string text1 = ((direct as PDFDict)["S"] as PDFName).Value;

            if (text1 == null)
            {
                goto Label_0056;
            }
            text1 = string.IsInterned(text1);
            if (text1 != "MCD")
            {
                if (text1 == "MCS")
                {
                    goto Label_004F;
                }
                goto Label_0056;
            }
            return(new MediaClipData(direct));

Label_004F:
            return(new MediaClipSection(direct));

Label_0056:
            return(null);
        }
コード例 #16
0
        // Methods
        internal ComplexObjectCommonArrayBase(PDFDirect direct, int ObjSize) : base(direct)
        {
            int num1;
            int num2;

            this.mIndexSkip   = 0;
            this.mObjSize     = 1;
            this.mObjectList  = new ArrayList();
            this.mArr         = null;
            this.mInternalArr = Library.CreateArray(0);
            this.mArr         = (direct as PDFArray);
            this.mObjSize     = ObjSize;
            if (this.mArr == null)
            {
                return;
            }
            for (num1 = this.mIndexSkip; (num1 < (this.mArr.Count / this.mObjSize)); num1 += 1)
            {
                this.mInternalArr[num1] = Library.CreateArray(this.mObjSize);
                for (num2 = 0; (num2 < this.mObjSize); num2 += 1)
                {
                    (this.mInternalArr[num1] as PDFArray)[num2] = this.mArr[((num1 * this.mObjSize) + num2)];
                }
            }
        }
コード例 #17
0
 // Methods
 internal FunctionType0(PDFDirect d) : base(d)
 {
     this.mEncode = null;
     this.mDecode = null;
     this.mSize   = null;
     this.mData   = null;
 }
コード例 #18
0
ファイル: Function.cs プロジェクト: silvath/siscobras
        internal static Resource Factory(PDFDirect d)
        {
            if (d.PDFType != PDFObjectType.tPDFDict)
            {
                goto Label_0061;
            }
            PDFDict dict1 = ((PDFDict)d);
            int     num1  = ((PDFInteger)dict1["FunctionType"]).Int32Value;
            int     num3  = num1;

            switch (num3)
            {
            case 2:
            {
                goto Label_003C;
            }

            case 3:
            {
                goto Label_0043;
            }
            }
            goto Label_004A;
Label_003C:
            return(new FunctionType2(d));

Label_0043:
            return(new FunctionType3(d));

Label_004A:
            throw new PDFSyntaxException(d, string.Format("Unknown function type: {0}", num1));
Label_0061:
            if (d.PDFType != PDFObjectType.tPDFStream)
            {
                goto Label_00C0;
            }
            PDFStream stream1 = ((PDFStream)d);
            int       num2    = ((PDFInteger)stream1.Dict["FunctionType"]).Int32Value;

            num3 = num2;
            if (num3 != 0)
            {
                if (num3 == 4)
                {
                    goto Label_00A2;
                }
                goto Label_00A9;
            }
            return(new FunctionType0(d));

Label_00A2:
            return(new FunctionType4(d));

Label_00A9:
            throw new PDFSyntaxException(d, string.Format("Unknown function type: {0}", num2));
Label_00C0:
            throw new PDFSyntaxException(d, "Invalid Function");
        }
コード例 #19
0
        internal void DecryptObject(PDFDirect direct, int id, int gene)
        {
            PDFObject     obj2;
            IEnumerator   enumerator1;
            IDisposable   disposable1;
            PDFObjectType type1 = direct.PDFType;

            switch (type1)
            {
            case PDFObjectType.tPDFString:
            {
                ((CorePDFString)direct).mValue = Utils.BytesToString(this.Encryption.DecryptString(((CorePDFString)direct), id, gene));
                return;
            }

            case PDFObjectType.tPDFDict:
            {
                goto Label_008F;
            }

            case PDFObjectType.tPDFArray:
            {
                foreach (PDFObject obj1 in ((PDFArray)direct))
                {
                    if (obj1.IsIndirect)
                    {
                        continue;
                    }
                    this.DecryptObject(obj1.Direct, id, gene);
                }
                return;
            }
            }
            return;

Label_008F:
            enumerator1 = ((PDFDict)direct).Values.GetEnumerator();
            try
            {
                while (enumerator1.MoveNext())
                {
                    obj2 = ((PDFObject)enumerator1.Current);
                    if (obj2.IsIndirect)
                    {
                        continue;
                    }
                    this.DecryptObject(obj2.Direct, id, gene);
                }
            }
            finally
            {
                disposable1 = (enumerator1 as IDisposable);
                if (disposable1 != null)
                {
                    disposable1.Dispose();
                }
            }
        }
コード例 #20
0
 // Methods
 internal XObjectImage(PDFDirect d) : base(d)
 {
     this.mCS             = null;
     this.mMaskColorRange = null;
     this.mMask           = null;
     this.mSMask          = null;
     this.mDecode         = null;
     this.mAlternates     = null;
 }
コード例 #21
0
ファイル: Shading.cs プロジェクト: silvath/siscobras
        internal static Resource Factory(PDFDirect d)
        {
            int      num1;
            Resource resource1;
            int      num2;

            try
            {
                num1 = ((PDFInteger)((d.PDFType == PDFObjectType.tPDFDict) ? ((PDFDict)d) : ((PDFStream)d).Dict)["ShadingType"]).Int32Value;
                num2 = num1;
                switch (num2)
                {
                case 1:
                {
                    return(new ShadingType1(d));
                }

                case 2:
                {
                    return(new ShadingType2(d));
                }

                case 3:
                {
                    return(new ShadingType3(d));
                }

                case 4:
                {
                    return(new ShadingType4(d));
                }

                case 5:
                {
                    return(new ShadingType5(d));
                }

                case 6:
                {
                    return(new ShadingType6(d));
                }

                case 7:
                {
                    return(new ShadingType7(d));
                }
                }
                throw new PDFSyntaxException(d, "Invalid shading");
            }
            catch (InvalidCastException)
            {
                throw new PDFSyntaxException(d, "Invalid shading");
            }
            return(resource1);
        }
コード例 #22
0
ファイル: Font.cs プロジェクト: silvath/siscobras
        internal static Resource Factory(PDFDirect d)
        {
            PDFDict  dict1;
            string   text1;
            Resource resource1;

            try
            {
                dict1 = (d as PDFDict);
                if (dict1 == null)
                {
                    throw new ArgumentException("Not a font DICTIONARY");
                }
                if (((PDFName)dict1["Type"]).Value != "Font")
                {
                    throw new ArgumentException("Not a FONT dictionary");
                }
                text1 = ((PDFName)dict1["Subtype"]).Value;
                if (text1 == "Type0")
                {
                    return(new FontType0(d));
                }
                if (text1 == "Type1")
                {
                    return(new FontType1(d));
                }
                if (text1 == "Type3")
                {
                    return(new FontType3(d));
                }
                if (text1 == "TrueType")
                {
                    return(new FontTrueType(d));
                }
                if (text1 == "MMType1")
                {
                    return(new FontType1(d));
                }
                if (text1 == "CIDFontType0")
                {
                    return(new FontType0(d));
                }
                if (text1 == "CIDFontType2")
                {
                    return(new FontType0(d));
                }
                throw new PDFException("Unknown font SUBTYPE");
            }
            catch (NullReferenceException)
            {
                throw new ArgumentException("INVALID font dictionary");
            }
            return(resource1);
        }
コード例 #23
0
ファイル: Page.cs プロジェクト: silvath/siscobras
                internal override object ComplexObjectFactory(PDFDirect dir)
                {
                    PDFIndirect indirect1 = dir.Indirect;

                    foreach (Page page1 in dir.Doc.Pages)
                    {
                        if (page1.Dict.Indirect != indirect1)
                        {
                            continue;
                        }
                        return(page1);
                    }
                    return(null);
                }
コード例 #24
0
ファイル: Annotation.cs プロジェクト: silvath/siscobras
 internal static Resource Factory(PDFDirect d)
 {
     if (< PrivateImplementationDetails >.$$method0x6000121 - 1 == null)
     {
         Hashtable hashtable1 = new Hashtable(48, 0.5f);
         hashtable1.Add("Text", 0);
         Hashtable hashtable2 = new Hashtable(48, 0.5f);
         hashtable2.Add("FreeText", 1);
         Hashtable hashtable3 = new Hashtable(48, 0.5f);
         hashtable3.Add("Line", 2);
         Hashtable hashtable4 = new Hashtable(48, 0.5f);
         hashtable4.Add("Square", 3);
         Hashtable hashtable5 = new Hashtable(48, 0.5f);
         hashtable5.Add("Circle", 4);
         Hashtable hashtable6 = new Hashtable(48, 0.5f);
         hashtable6.Add("Polygon", 5);
         Hashtable hashtable7 = new Hashtable(48, 0.5f);
         hashtable7.Add("Polyline", 6);
         Hashtable hashtable8 = new Hashtable(48, 0.5f);
         hashtable8.Add("Highlight", 7);
         Hashtable hashtable9 = new Hashtable(48, 0.5f);
         hashtable9.Add("Underline", 8);
         Hashtable hashtable10 = new Hashtable(48, 0.5f);
         hashtable10.Add("Squiggly", 9);
         Hashtable hashtable11 = new Hashtable(48, 0.5f);
         hashtable11.Add("StrikeOut", 10);
         Hashtable hashtable12 = new Hashtable(48, 0.5f);
         hashtable12.Add("Stamp", 11);
         Hashtable hashtable13 = new Hashtable(48, 0.5f);
         hashtable13.Add("Caret", 12);
         Hashtable hashtable14 = new Hashtable(48, 0.5f);
         hashtable14.Add("Ink", 13);
         Hashtable hashtable15 = new Hashtable(48, 0.5f);
         hashtable15.Add("FileAttachment", 14);
         Hashtable hashtable16 = new Hashtable(48, 0.5f);
         hashtable16.Add("Sound", 15);
         Hashtable hashtable17 = new Hashtable(48, 0.5f);
         hashtable17.Add("Link", 16);
         Hashtable hashtable18 = new Hashtable(48, 0.5f);
         hashtable18.Add("Popup", 17);
         Hashtable hashtable19 = new Hashtable(48, 0.5f);
         hashtable19.Add("Movie", 18);
         Hashtable hashtable20 = new Hashtable(48, 0.5f);
         hashtable20.Add("Widget", 19);
         Hashtable hashtable21 = new Hashtable(48, 0.5f);
         hashtable21.Add("Screen", 20);
         Hashtable hashtable22 = new Hashtable(48, 0.5f);
         hashtable22.Add("PrinterMark", 21);
         Hashtable hashtable23 = new Hashtable(48, 0.5f);
         hashtable23.Add("TrapNet", 22);
コード例 #25
0
ファイル: HalftoneType5.cs プロジェクト: silvath/siscobras
 public Halftone this[string colorant]
 {
     get
     {
         PDFDirect direct1 = (this.Dict[colorant] as PDFDirect);
         if (direct1 == null)
         {
             return(null);
         }
         return(Resources.Get(direct1, typeof(Halftone)) as Halftone);
     }
     set
     {
         this.Dict[colorant] = value.Dict;
     }
 }
コード例 #26
0
 internal static Resource Factory(PDFDirect direct)
 {
     if ((direct is PDFString))
     {
         return(new LinkDestinationNamed(direct));
     }
     if ((direct is PDFArray))
     {
         return(new LinkDestinationExplicit(direct));
     }
     if ((direct is PDFName))
     {
         return(null);
     }
     return(null);
 }
コード例 #27
0
 internal ExtGState(PDFDirect d) : base(d)
 {
     this.mDashPattern = null;
     this.mFont        = null;
     this.mBG          = null;
     this.mBG2         = null;
     this.mUCR         = null;
     this.mUCR2        = null;
     this.mBlendMode   = null;
     try
     {
         this.mDict = ((PDFDict)d);
     }
     catch (InvalidCastException)
     {
         throw new ArgumentException("Constructor parameter should be a DICTIONARY");
     }
 }
コード例 #28
0
ファイル: DocResourceColl.cs プロジェクト: silvath/siscobras
        public Resource Add(Resource res)
        {
            Document document1 = this.mDoc;

            if (res.Direct.Doc == this.mDoc)
            {
                return(res);
            }
            PDFObject obj1 = document1.CloneObject((res.Direct.IsIndirect ? res.Direct.Indirect : res.Direct));

            if (obj1.IsIndirect)
            {
                return(this[obj1, res.GetType()]);
            }
            PDFDirect direct1 = ((PDFDirect)obj1);

            document1.Indirects.New().Direct = direct1;
            return(this[direct1, res.GetType()]);
        }
コード例 #29
0
ファイル: Page.cs プロジェクト: silvath/siscobras
        internal static Resource Factory(PDFDirect direct)
        {
            PDFDict dict1 = (direct as PDFDict);

            if (dict1 == null)
            {
                return(null);
            }
            PDFName name1 = (dict1["Type"] as PDFName);

            if (name1 == null)
            {
                return(null);
            }
            if (name1.Value != "Page")
            {
                return(null);
            }
            return(new Page(dict1));
        }
コード例 #30
0
ファイル: Font.cs プロジェクト: silvath/siscobras
        protected Font(PDFDirect d) : base(d)
        {
            PDFDict  dict2;
            PDFArray array1;
            PDFArray array2;

            this.isWidthRead    = false;
            this.isEncodingRead = false;
            this.mMatrix        = new CTM(0.001f, 0f, 0f, 0.001f, 0f, 0f);
            this.mBBox          = new Rect(-200f, -250f, 1050f, 1100f);
            PDFDict dict1 = null;

            if (this.SubType == EFontType.Type0)
            {
                array1 = (this.Dict["DescendantFonts"] as PDFArray);
                if (array1 != null)
                {
                    dict2 = (array1[0] as PDFDict);
                    if (dict2 != null)
                    {
                        dict1 = (dict2["FontDescriptor"] as PDFDict);
                    }
                }
            }
            else
            {
                dict1 = (this.Dict["FontDescriptor"] as PDFDict);
            }
            if (dict1 != null)
            {
                array2 = (dict1["FontBBox"] as PDFArray);
                if (array2 == null)
                {
                    throw new ArgumentException("Bad Font BBox");
                }
                this.mBBox = new PDFRect(array2);
            }
            this.mWidths   = new Hashtable();
            this.mEncoding = new string[256];
        }