Exemplo n.º 1
0
        // Methods
        internal PDFInt64Array(PDFArray arr) : base(arr.Count)
        {
            int num2;
            int num3;

            this.mPDFArr  = null;
            this.mPDFFix  = null;
            this.mParent  = null;
            this.mKeyName = null;
            this.mAsFixed = false;
            this.mPDFArr  = arr;
            int num1 = arr.Count;

            if (arr.Count != num1)
            {
                arr.Clear();
                for (num2 = 0; (num2 < num1); num2 += 1)
                {
                    arr.Add(Library.CreateFixed(0f));
                }
            }
            for (num3 = 0; (num3 < num1); num3 += 1)
            {
                this.mArr[num3] = ((PDFInteger)arr[num3]).Value;
            }
        }
Exemplo n.º 2
0
        public static Sound Create(string filename, int sampling_rate)
        {
            PDFStream stream1 = Library.CreateStream(new FileStream(filename, FileMode.Open));

            stream1.Dict["R"] = Library.CreateFixed(((double)sampling_rate));
            return(new Sound(stream1));
        }
Exemplo n.º 3
0
 public BorderCharact(double h_r, double v_r, double width)
 {
     this.mArr    = Library.CreateArray(3);
     this.mArr[0] = Library.CreateFixed(h_r);
     this.mArr[1] = Library.CreateFixed(v_r);
     this.mArr[2] = Library.CreateFixed(width);
 }
Exemplo n.º 4
0
        private PDFIndirect BuildEGSDict(Document doc, double opacity)
        {
            PDFDict dict1 = Library.CreateDict();

            dict1["Type"] = Library.CreateName("ExtGState");
            dict1["ca"]   = Library.CreateFixed(opacity);
            dict1["CA"]   = Library.CreateFixed(opacity);
            return(doc.Indirects.New(dict1));
        }
Exemplo n.º 5
0
        public static FunctionType2 Create(double[] domain, double[] c0, double[] c1, double n)
        {
            PDFDict dict1 = Library.CreateDict();

            dict1["FunctionType"] = Library.CreateInteger(((long)2));
            dict1["Domain"]       = Library.CreateArray(false, domain);
            dict1["C0"]           = Library.CreateArray(false, c0);
            dict1["C1"]           = Library.CreateArray(false, c1);
            dict1["N"]            = Library.CreateFixed(n);
            return(new FunctionType2(dict1));
        }
Exemplo n.º 6
0
        public static ColorSpaceIntensity Create(double[] arr)
        {
            int      num1;
            PDFArray array1 = Library.CreateArray(arr.Length);

            for (num1 = 0; (num1 < arr.Length); num1 += 1)
            {
                array1[num1] = Library.CreateFixed(arr[num1]);
            }
            return(new ColorSpaceIntensity(array1));
        }
Exemplo n.º 7
0
        public static quadrilateralList Create(double[] arr)
        {
            int      num1;
            PDFArray array1 = Library.CreateArray(arr.Length);

            for (num1 = 0; (num1 < arr.Length); num1 += 1)
            {
                array1[num1] = Library.CreateFixed(arr[num1]);
            }
            return(new quadrilateralList(array1));
        }
Exemplo n.º 8
0
        public static StrokedPathList Create(double[] arr)
        {
            int      num1;
            PDFArray array1 = Library.CreateArray(1);

            array1[0] = Library.CreateArray(arr.Length);
            for (num1 = 0; (num1 < arr.Length); num1 += 1)
            {
                (array1[0] as PDFArray)[num1] = Library.CreateFixed(arr[num1]);
            }
            return(new StrokedPathList(array1));
        }
Exemplo n.º 9
0
        public static MediaTimeSpan Create(bool indirect, double secNum)
        {
            PDFDict dict1 = Library.CreateDict();

            dict1["S"] = Library.CreateName("S");
            dict1["V"] = Library.CreateFixed(secNum);
            if (indirect)
            {
                Library.CreateIndirect(dict1);
            }
            return(new MediaTimeSpan(dict1));
        }
Exemplo n.º 10
0
        public static PDFObject CreateObject(bool treatStringAsName, object o)
        {
            if (o == null)
            {
                return(Library.CreateNull());
            }
            Type type1 = o.GetType();

            if (type1.Equals(typeof(double)))
            {
                return(Library.CreateFixed(((double)o)));
            }
            if (type1.Equals(typeof(float)))
            {
                return(Library.CreateFixed(((double)((float)o))));
            }
            if (type1.Equals(typeof(int)))
            {
                return(Library.CreateInteger(((long)((int)o))));
            }
            if (type1.Equals(typeof(uint)))
            {
                return(Library.CreateInteger(((ulong)((uint)o))));
            }
            if (type1.Equals(typeof(string)))
            {
                if (treatStringAsName)
                {
                    return(Library.CreateName(((string)o)));
                }
                return(Library.CreateString(((string)o)));
            }
            if (type1.Equals(typeof(bool)))
            {
                return(Library.CreateBoolean(((bool)o)));
            }
            if (type1.IsArray)
            {
                return(Library.CreateArray(treatStringAsName, o));
            }
            if (type1.GetInterface("System.Collections.IDictionary", false) != null)
            {
                return(Library.CreateDict(treatStringAsName, ((IDictionary)o)));
            }
            if (type1.GetInterface("System.Collections.ICollection", false) != null)
            {
                return(Library.CreateArray(treatStringAsName, o));
            }
            throw new ArgumentException("Invalid item", "o");
        }
Exemplo n.º 11
0
        public void AddLinkAnnotation(double left, double bottom, double right, double top, PDFObject uri_action)
        {
            PDFDict dict1 = Library.CreateDict();

            dict1["Type"]    = Library.CreateName("Annot");
            dict1["Subtype"] = Library.CreateName("Link");
            PDFDict dict2 = Library.CreateDict();

            dict2["W"]  = Library.CreateInteger(((long)0));
            dict1["BS"] = dict2;
            PDFArray array1 = Library.CreateArray(0);

            array1.Add(Library.CreateFixed(0f));
            array1.Add(Library.CreateFixed(0f));
            array1.Add(Library.CreateFixed(0f));
            dict1["Border"] = array1;
            PDFArray array2 = Library.CreateArray(0);

            array2.Add(Library.CreateFixed(left));
            array2.Add(Library.CreateFixed(bottom));
            array2.Add(Library.CreateFixed(right));
            array2.Add(Library.CreateFixed(top));
            dict1["Rect"] = array2;
            if (uri_action != null)
            {
                dict1["A"] = uri_action;
            }
            Document    document1 = this.mPage.Dict.Doc;
            PDFIndirect indirect1 = document1.Indirects.New(dict1);
            PDFArray    array3    = null;
            PDFObject   obj1      = this.mPage.Dict["Annots"];

            if ((obj1 != null) && (obj1.PDFType == PDFObjectType.tPDFArray))
            {
                array3 = ((PDFArray)obj1.Direct);
            }
            else
            {
                array3 = Library.CreateArray(0);
                this.mPage.Dict["Annots"] = array3;
            }
            array3.Add(indirect1);
        }
Exemplo n.º 12
0
 // Properties
 public override long this[int index]
 {
     get
     {
         return(this.mArr[index]);
     }
     set
     {
         int        num1;
         PDFArray   array1;
         PDFInteger integer1;
         base[index] = value;
         if (this.mAsFixed)
         {
             if (this.mPDFArr == null)
             {
                 array1       = Library.CreateArray(this.mArr.Length);
                 this.mPDFArr = array1;
                 this.mParent[this.mKeyName] = array1;
                 for (num1 = 0; (num1 < this.mArr.Length); num1 += 1)
                 {
                     this.mPDFArr[num1] = Library.CreateFixed(((double)this.mArr[num1]));
                 }
                 return;
             }
             ((PDFInteger)this.mPDFArr[index]).Value = value;
             return;
         }
         if (index > 0)
         {
             throw new IndexOutOfRangeException();
         }
         if (this.mPDFFix == null)
         {
             integer1     = Library.CreateInteger(value);
             this.mPDFFix = integer1;
             this.mParent[this.mKeyName] = integer1;
             return;
         }
         this.mPDFFix.Value = value;
     }
 }
Exemplo n.º 13
0
        protected internal virtual PDFDirect CopyHandlerDirect(PDFDirect src, CopyHandlerDelegate ch)
        {
            PDFObject obj1;
            PDFArray  array1;
            PDFArray  array2;
            int       num1;
            PDFDict   dict1;
            PDFDict   dict2;
            PDFStream stream1;
            PDFStream stream2;

            if (ch != null)
            {
                obj1 = ch.Invoke(this.dstDoc, src);
                if ((obj1 is PDFDirect))
                {
                    src = ((PDFDirect)obj1);
                }
                else
                {
                    throw new PDFException("Can\'t convert direct into indirect");
                }
            }
            PDFObjectType type1 = src.PDFType;

            switch (type1)
            {
            case PDFObjectType.tPDFNull:
            {
                goto Label_0155;
            }

            case PDFObjectType.tPDFInteger:
            {
                goto Label_0133;
            }

            case PDFObjectType.tPDFFixed:
            {
                goto Label_0122;
            }

            case PDFObjectType.tPDFBoolean:
            {
                goto Label_00A2;
            }

            case PDFObjectType.tPDFName:
            {
                goto Label_0144;
            }

            case PDFObjectType.tPDFString:
            {
                goto Label_01E7;
            }

            case PDFObjectType.tPDFDict:
            {
                dict1 = (src as PDFDict);
                dict2 = Library.CreateDict();
                foreach (PDFName name1 in dict1.Keys)
                {
                    dict2[name1.Value] = this.CopyHandler(dict1[name1, 0], ch);
                }
                return(dict2);
            }

            case PDFObjectType.tPDFArray:
            {
                array1 = (src as PDFArray);
                array2 = Library.CreateArray(array1.Count);
                num1   = 0;
                goto Label_0097;
            }

            case PDFObjectType.tPDFStream:
            {
                stream1 = (src as PDFStream);
                stream2 = Library.CreateStream();
                foreach (PDFName name2 in stream1.Dict.Keys)
                {
                    stream2.Dict[name2.Value] = this.CopyHandler(stream1.Dict[name2, 0], ch);
                }
                stream2.SetRawStream(stream1.Decrypt());
                return(stream2);
            }
            }
            goto Label_01F8;
Label_007D:
            array2[num1] = this.CopyHandler(array1[num1, 0], ch);
            num1        += 1;
Label_0097:
            if (num1 < array1.Count)
            {
                goto Label_007D;
            }
            return(array2);

Label_00A2:
            return(Library.CreateBoolean((src as PDFBoolean).Value));

Label_0122:
            return(Library.CreateFixed((src as PDFFixed).Value));

Label_0133:
            return(Library.CreateInteger((src as PDFInteger).Value));

Label_0144:
            return(Library.CreateName((src as PDFName).Value));

Label_0155:
            return(Library.CreateNull());

Label_01E7:
            return(Library.CreateString((src as PDFString).Value));

Label_01F8:
            throw new Exception("Invalid object type");
        }
Exemplo n.º 14
0
        public static PDFDirect CreateDirect(PDFObjectType type)
        {
            PDFObjectType type1 = type;

            switch (type1)
            {
            case PDFObjectType.tPDFNull:
            {
                goto Label_0060;
            }

            case PDFObjectType.tPDFInteger:
            {
                goto Label_004D;
            }

            case PDFObjectType.tPDFFixed:
            {
                goto Label_003E;
            }

            case PDFObjectType.tPDFBoolean:
            {
                goto Label_0031;
            }

            case PDFObjectType.tPDFName:
            {
                goto Label_0055;
            }

            case PDFObjectType.tPDFString:
            {
                goto Label_0066;
            }

            case PDFObjectType.tPDFDict:
            {
                goto Label_0038;
            }

            case PDFObjectType.tPDFArray:
            {
                goto Label_002A;
            }
            }
            goto Label_0071;
Label_002A:
            return(Library.CreateArray(0));

Label_0031:
            return(Library.CreateBoolean(false));

Label_0038:
            return(Library.CreateDict());

Label_003E:
            return(Library.CreateFixed(0f));

Label_004D:
            return(Library.CreateInteger(((long)0)));

Label_0055:
            return(Library.CreateName(""));

Label_0060:
            return(Library.CreateNull());

Label_0066:
            return(Library.CreateString(""));

Label_0071:
            throw new ArgumentOutOfRangeException("type", type, "Invalid direct type");
        }
Exemplo n.º 15
0
        public static PDFObject DefaultCopyHandler(Document dstDoc, PDFObject src)
        {
            PDFIndirect indirect1;
            PDFStream   stream1;

            if (src == null)
            {
                return(Library.CreateNull());
            }
            if ((src is PDFIndirect))
            {
                indirect1        = dstDoc.Indirects.New();
                indirect1.Direct = ((PDFDirect)Document.DefaultCopyHandler(dstDoc, src.Direct));
                return(indirect1);
            }
            PDFDirect     direct1 = null;
            PDFDirect     direct2 = ((PDFDirect)src);
            PDFObjectType type1   = src.PDFType;

            switch (type1)
            {
            case PDFObjectType.tPDFNull:
            {
                return(Library.CreateNull());
            }

            case PDFObjectType.tPDFInteger:
            {
                return(Library.CreateInteger(((PDFInteger)direct2).Value));
            }

            case PDFObjectType.tPDFFixed:
            {
                return(Library.CreateFixed(((PDFFixed)direct2).Value));
            }

            case PDFObjectType.tPDFBoolean:
            {
                return(Library.CreateBoolean(((PDFBoolean)direct2).Value));
            }

            case PDFObjectType.tPDFName:
            {
                return(Library.CreateName(((PDFName)direct2).Value));
            }

            case PDFObjectType.tPDFString:
            {
                return(Library.CreateString(((PDFString)direct2).Value));
            }

            case PDFObjectType.tPDFDict:
            case PDFObjectType.tPDFArray:
            {
                goto Label_0108;
            }

            case PDFObjectType.tPDFStream:
            {
                stream1 = ((PDFStream)direct2);
                return(Library.CreateStream(stream1.Decrypt(), ((PDFDict)dstDoc.CloneObject(stream1.Dict)), false));
            }
            }
Label_0108:
            return(Library.CreateDirect(src.PDFType));
        }
Exemplo n.º 16
0
        public PDFObject ReadNextObject()
        {
            int       num1;
            PDFArray  array1;
            PDFObject obj1;
            bool      flag1;
            int       num2;
            int       num3;
            int       num4;
            PDFObject obj3;
            PDFObject obj4;
            PDFObject obj5;
            TokenType type1 = base.GetNextToken();

            switch (type1)
            {
            case ((TokenType)0):
            {
                goto Label_00DC;
            }

            case ((TokenType)1):
            {
                if (this.m_sName == "null")
                {
                    return(Library.CreateNull());
                }
                goto Label_009E;
            }

            case ((TokenType)2):
            case ((TokenType)11):
            {
                goto Label_006E;
            }

            case ((TokenType)3):
            {
                goto Label_0230;
            }

            case ((TokenType)4):
            {
                if (this.m_iDictCounter == 0)
                {
                    throw new PDFParserException("Invalid end of dict found!");
                }
                this.m_iDictCounter -= 1;
                return(Library.CreateDict());
            }

            case ((TokenType)5):
            {
                this.m_iArrCounter += 1;
                num1   = this.m_iArrCounter;
                array1 = Library.CreateArray(0);
                flag1  = true;
                do
                {
                    obj1 = this.ReadNextObject();
                    if (num1 != this.m_iArrCounter)
                    {
                        flag1 = false;
                    }
                    else if (obj1.PDFType == PDFObjectType.tPDFName)
                    {
                        num2 = array1.Count;
                        if (((((PDFName)obj1).Value == "R") || (((PDFName)obj1).Value == "r")) && (((num2 >= 2) && (array1[(num2 - 1)].PDFType == PDFObjectType.tPDFInteger)) && (array1[(num2 - 2)].PDFType == PDFObjectType.tPDFInteger)))
                        {
                            num3 = ((PDFInteger)array1[(num2 - 2)]).Int32Value;
                            num4 = ((PDFInteger)array1[(num2 - 1)]).Int32Value;
                            array1.Add(this.m_doc.CreateIndirectObject(num3, num4));
                            array1.RemoveAt((num2 - 1));
                            array1.RemoveAt((num2 - 2));
                        }
                        else
                        {
                            array1.Add(obj1);
                        }
                    }
                    else
                    {
                        array1.Add(obj1);
                    }
                }while (flag1);
                return(array1);
            }

            case ((TokenType)6):
            {
                if (this.m_iArrCounter == 0)
                {
                    throw new PDFParserException("Invalid end of array found!");
                }
                this.m_iArrCounter -= 1;
                return(Library.CreateArray(0));
            }

            case ((TokenType)7):
            {
                goto Label_00E8;
            }

            case ((TokenType)8):
            {
                goto Label_007A;
            }

            case ((TokenType)9):
            {
                goto Label_036E;
            }

            case ((TokenType)10):
            {
                goto Label_0053;
            }

            case ((TokenType)12):
            {
                goto Label_0048;
            }
            }
            goto Label_0379;
Label_0048:
            throw new PDFParserException("Invalid token encountered");
Label_0053:
            if (this.SkipComments)
            {
                return(this.ReadNextObject());
            }
            return(Library.CreateString(this.m_sName));

Label_006E:
            return(Library.CreateString(this.m_sName));

Label_007A:
            return(Library.CreateFixed(this.m_dReal));

Label_009E:
            if (this.m_sName == "false")
            {
                return(Library.CreateBoolean(false));
            }
            if (this.m_sName == "true")
            {
                return(Library.CreateBoolean(true));
            }
            return(Library.CreateName(this.m_sName));

Label_00DC:
            return(Library.CreateName(this.m_sName));

Label_00E8:
            return(Library.CreateInteger(this.m_iInteger));

Label_0230:
            this.m_iDictCounter += 1;
            PDFDict   dict1 = Library.CreateDict();
            bool      flag2 = true;
            PDFObject obj2  = this.ReadNextObject();

Label_0250:
            if (obj2.PDFType == PDFObjectType.tPDFDict)
            {
                flag2 = false;
            }
            else
            {
                if (obj2.PDFType != PDFObjectType.tPDFName)
                {
                    throw new PDFParserException("Invalid key entry found!");
                }
                obj3 = this.ReadNextObject();
                obj4 = this.ReadNextObject();
                if ((obj4.PDFType == PDFObjectType.tPDFInteger) && (obj3.PDFType == PDFObjectType.tPDFInteger))
                {
                    obj5 = this.ReadNextObject();
                    if ((obj5.PDFType == PDFObjectType.tPDFName) && ((((PDFName)obj5).Value == "R") || (((PDFName)obj5).Value == "r")))
                    {
                        dict1[((PDFName)obj2)] = this.m_doc.CreateIndirectObject(((PDFInteger)obj3).Int32Value, ((PDFInteger)obj4).Int32Value);
                        obj2 = this.ReadNextObject();
                        goto Label_033D;
                    }
                    throw new PDFParserException("Invalid dict entry!");
                }
                dict1[((PDFName)obj2)] = obj3;
                obj2 = obj4;
            }
Label_033D:
            if (flag2)
            {
                goto Label_0250;
            }
            return(dict1);

Label_036E:
            throw new PDFParserException("Unexpected end of file found!");
Label_0379:
            throw new PDFParserException("Fatal ERROR!");
        }
Exemplo n.º 17
0
        public static Altsoft.PDFO.Font EmbedFont(Document doc, Stream fontstream, string encoding, bool embedFontFile, bool isVertical)
        {
            int      num2;
            PDFArray array2;
            int      num10;

            Altsoft.FTMB.Font font1 = Altsoft.FTMB.Font.OpenFont(fontstream);
            if ((font1.FontType != FontType.TrueTypeFontT) || (encoding != "Unicode"))
            {
                return(null);
            }
            TrueTypeFont font2 = (font1 as TrueTypeFont);
            double       num1  = ((double)font2.UnitsPerEm);
            PDFDict      dict1 = Library.CreateDict();

            dict1["Type"]     = Library.CreateName("Font");
            dict1["Subtype"]  = Library.CreateName("CIDFontType2");
            dict1["BaseFont"] = Library.CreateName(font2.FontName);
            PDFDict dict2 = Library.CreateDict();

            dict2["Registry"]      = Library.CreateString("Adobe");
            dict2["Ordering"]      = Library.CreateString("Identity");
            dict2["Supplement"]    = Library.CreateInteger(((long)0));
            dict1["CIDSystemInfo"] = dict2;
            TTEncoding encoding1 = null;

            for (num2 = 0; ((num2 < font2.Encodings.Count) && (encoding1 == null)); num2 += 1)
            {
                encoding1 = ((TTEncoding)font2.Encodings[num2]);
                if ((encoding1.platformID != 3) || ((encoding1.specificID != 1) && (encoding1.specificID != 0)))
                {
                    encoding1 = null;
                }
            }
            if (encoding1 == null)
            {
                return(null);
            }
            dict1["DW"] = Library.CreateInteger(((long)((((double)font2.GetWidth(encoding1.GetGID(0))) * 1000f) / num1)));
            int      num3   = 0;
            int      num4   = encoding1.GetLastCharCode(ref num3);
            int      num5   = encoding1.GetFirstCharCode(ref num3);
            PDFArray array1 = Library.CreateArray(0);

            if (num5 != 0)
            {
                array1.Add(Library.CreateInteger(((long)0)));
                array2 = Library.CreateArray(0);
                array2.Add(Library.CreateInteger(((long)((((double)font2.GetWidth(0, 3, 1)) * 1000f) / num1))));
                array1.Add(array2);
            }
            array1.Add(Library.CreateInteger(((long)num5)));
            array2 = Library.CreateArray(0);
            array2.Add(Library.CreateInteger(((long)((((double)font2.GetWidth(num3)) * 1000f) / num1))));
            int num6 = num5;

            while ((num5 != num4))
            {
                num5 = encoding1.GetNextCharCode(num5, ref num3);
                if (num5 != (num6 + 1))
                {
                    array1.Add(array2);
                    array1.Add(Library.CreateInteger(((long)num5)));
                    array2 = Library.CreateArray(0);
                }
                num6 = num5;
                array2.Add(Library.CreateInteger(((long)((((double)font2.GetWidth(num3)) * 1000f) / num1))));
            }
            array1.Add(array2);
            dict1["W"] = array1;
            Stream stream1 = new MemoryStream();
            int    num7    = encoding1.GetFirstCharCode(ref num3);
            int    num8    = 0;

            while ((num8 < num7))
            {
                stream1.WriteByte(0);
                stream1.WriteByte(0);
                num8 += 1;
            }
            stream1.WriteByte(((byte)(num3 / 256)));
            stream1.WriteByte(((byte)(num3 % 256)));
            num8 += 1;
            int num9 = encoding1.GetLastCharCode(ref num3);

            do
            {
                num7 = encoding1.GetNextCharCode(num7, ref num3);
                while ((num8 < num7))
                {
                    stream1.WriteByte(0);
                    stream1.WriteByte(0);
                    num8 += 1;
                }
                stream1.WriteByte(((byte)(num3 / 256)));
                stream1.WriteByte(((byte)(num3 % 256)));
                num8 += 1;
            }while ((num7 != num9));
            stream1.Position = ((long)0);
            PDFDict dict3 = Library.CreateDict();

            dict3["Filter"] = Library.CreateName("FlateDecode");
            PDFStream stream2 = Library.CreateStream(stream1, dict3);

            dict1["CIDToGIDMap"] = doc.Indirects.New(stream2);
            PDFDict dict4 = Library.CreateDict();

            dict4["Type"]     = Library.CreateName("FontDescriptor");
            dict4["FontName"] = Library.CreateName(font2.FontName);
            dict4["Flags"]    = Library.CreateInteger(((long)4));
            PDFArray array3 = Library.CreateArray(4);

            for (num10 = 0; (num10 < 4); num10 += 1)
            {
                array3[num10] = Library.CreateInteger(((long)font2.FontBBox[num10]));
            }
            dict4["FontBBox"]    = array3;
            dict4["ItalicAngle"] = Library.CreateFixed(font2.ItalicAngle);
            dict4["Ascent"]      = Library.CreateInteger(((long)font2.FontBBox[3]));
            dict4["Descent"]     = Library.CreateInteger(((long)font2.FontBBox[1]));
            dict4["CapHeight"]   = Library.CreateInteger(((long)font2.FontBBox[3]));
            dict4["StemV"]       = Library.CreateInteger(((long)0));
            if (((font2.EmbeddingRights == 0) || ((font2.EmbeddingRights & 8) != 0)) && embedFontFile)
            {
                font2.FontStream.Position = ((long)0);
                dict3              = Library.CreateDict();
                dict3["Filter"]    = Library.CreateName("FlateDecode");
                dict3["Length1"]   = Library.CreateInteger(font2.FontStream.Length);
                dict4["FontFile2"] = doc.Indirects.New(Library.CreateStream(font2.FontStream, dict3));
            }
            dict1["FontDescriptor"] = doc.Indirects.New(dict4);
            PDFDict dict5 = Library.CreateDict();

            dict5["Type"]     = Library.CreateName("Font");
            dict5["Subtype"]  = Library.CreateName("Type0");
            dict5["BaseFont"] = Library.CreateName(font2.FontName);
            if (!isVertical)
            {
                dict5["Encoding"] = Library.CreateName("Identity-H");
            }
            else
            {
                dict5["Encoding"] = Library.CreateName("Identity-V");
            }
            PDFArray array4 = Library.CreateArray(1);

            array4[0] = doc.Indirects.New(dict1);
            dict5["DescendantFonts"] = array4;
            return(new FontType0(dict5));
        }