コード例 #1
0
        public ICCBased(byte[] array)
        {
            AddItem(new PDFName("ICCBased"));
            PDFDictionaryStream dstream = new PDFDictionaryStream();

            byte[] buf = new byte[4];
            for (int i = 16; i < 20; ++i)
            {
                buf[i - 16] = array[i];
            }
            switch (Encoding.GetString(buf))
            {
            case "CMYK":
                WriteDictionary(dstream.Dictionary, 4, "DeviceCMYK");
                break;

            case "GRAY":
                WriteDictionary(dstream.Dictionary, 1, "DeviceGRAY");
                break;

            case "RGB ":
                WriteDictionary(dstream.Dictionary, 3, "DeviceRGB");
                break;

            case "Lab ":
                //TODO
                break;
            }
            dstream.GetStream().Write(array, 0, array.Length);
            AddItem(dstream);
        }
コード例 #2
0
 private void initData(Stream fs, PDFDictionaryStream stream)
 {
     stream.Dictionary.AddItem("Type", new PDFName("3D"));
     stream.Dictionary.AddItem("Subtype", new PDFName("U3D"));
     stream.GetStream().SetLength(fs.Length);
     fs.Read(stream.GetStream().GetBuffer(), 0, (int)fs.Length);
 }
コード例 #3
0
        private void initialize32BMP(Bitmap bmp)
        {
            MemoryStream        streamSMask = new MemoryStream();
            PDFDictionaryStream dictSMask   = new PDFDictionaryStream(new PDFDictionary(), streamSMask);

            dictSMask.Dictionary.AddItem("Type", new PDFName("XObject"));
            dictSMask.Dictionary.AddItem("Subtype", new PDFName("Image"));
            dictSMask.Dictionary.AddItem("Width", new PDFNumber(_width));
            dictSMask.Dictionary.AddItem("Height", new PDFNumber(_height));
            dictSMask.Dictionary.AddItem("ColorSpace", new PDFName("DeviceGray"));
            dictSMask.Dictionary.AddItem("BitsPerComponent", new PDFNumber(8));
            Dictionary.AddItem("SMask", dictSMask);
            Dictionary.AddItem("ColorSpace", new PDFName("DeviceRGB"));
            Dictionary.AddItem("BitsPerComponent", new PDFNumber(8));
            BitmapData bmpData = bmp.LockBits(new System.Drawing.Rectangle(0, 0, _width, _height), ImageLockMode.ReadWrite, PixelFormat.Format32bppRgb);
            IntPtr     ptr     = bmpData.Scan0;

            byte[] buf = new byte[bmpData.Stride * bmpData.Height];
            System.Runtime.InteropServices.Marshal.Copy(ptr, buf, 0, buf.Length);
            byte xor;

            for (int i = 0; i < buf.Length; i += 4)
            {
                xor        = buf[i];
                buf[i]     = buf[i + 2];
                buf[i + 2] = xor;
                GetStream().Write(buf, i, 3);
                streamSMask.WriteByte(buf[i + 3]);
            }

            bmp.UnlockBits(bmpData);
        }
コード例 #4
0
        private void initAU(Stream streamSound, PDFDictionaryStream streamOut)
        {
            byte[] word = new byte[4];
            streamSound.Position = 12;
            streamSound.Read(word, 0, word.Length);
            int compression = BitConverter.ToInt32(word, 0);

            if (compression == 0)
            {
                streamOut.Dictionary.AddItem("E", new PDFName("Signed"));
            }
            else if (compression == 1)
            {
                streamOut.Dictionary.AddItem("E", new PDFName("muLaw"));
            }
            else if (compression == 27)
            {
                streamOut.Dictionary.AddItem("E", new PDFName("ALaw"));
            }
            streamSound.Read(word, 0, word.Length);
            streamOut.Dictionary.AddItem("R", new PDFNumber(BitConverter.ToInt32(word, 0)));
            streamSound.Read(word, 0, word.Length);
            int channel = BitConverter.ToInt32(word, 0);

            streamOut.Dictionary.AddItem("B", new PDFNumber(channel));
            streamOut.GetStream().SetLength(streamSound.Length);
            streamSound.Read(streamOut.GetStream().GetBuffer(), 0, streamOut.GetStream().GetBuffer().Length);
        }
コード例 #5
0
        private void init(float[] matrix)
        {
            _dict = new PDFDictionaryStream(new PDFDictionary(), Stream);
            _dict.Dictionary.AddItem("Type", new PDFName("XObject"));
            _dict.Dictionary.AddItem("Subtype", new PDFName("Form"));
            PDFArray array = new PDFArray();

            array.AddItem(new PDFNumber(0));
            array.AddItem(new PDFNumber(0));
            array.AddItem(new PDFNumber(Width));
            array.AddItem(new PDFNumber(Height));
            _dict.Dictionary.AddItem("BBox", array);
            _dict.Dictionary.AddItem("Resources", Resources.Dictionary);
            array = new PDFArray();

            if (matrix != null)
            {
                array.AddItem(new PDFNumber(matrix[0]));
                array.AddItem(new PDFNumber(matrix[1]));
                array.AddItem(new PDFNumber(matrix[2]));
                array.AddItem(new PDFNumber(matrix[3]));
                array.AddItem(new PDFNumber(matrix[4]));
                array.AddItem(new PDFNumber(matrix[5]));
                _dict.Dictionary.AddItem("Matrix", array);
            }
        }
コード例 #6
0
        public ICCBased(string filename)
        {
            FileStream fstream = new FileStream(filename, FileMode.Open);

            AddItem(new PDFName("ICCBased"));
            PDFDictionaryStream dstream = new PDFDictionaryStream();

            byte[] buf = new byte[4];
            fstream.Position = 16;
            fstream.Read(buf, 0, buf.Length);
            switch (Encoding.GetString(buf))
            {
            case "CMYK":
                WriteDictionary(dstream.Dictionary, 4, "DeviceCMYK");
                break;

            case "GRAY":
                WriteDictionary(dstream.Dictionary, 1, "DeviceGRAY");
                break;

            case "RGB ":
                WriteDictionary(dstream.Dictionary, 3, "DeviceRGB");
                break;

            case "Lab ":
                //TODO
                break;
            }
            buf = new byte[fstream.Length];
            fstream.Read(buf, 0, buf.Length);
            dstream.GetStream().Write(buf, 0, buf.Length);
            AddItem(dstream);
        }
コード例 #7
0
        private void initFormat32bppArgb(Bitmap bmp)
        {
            int        f       = bmp.Flags;
            BitmapData bmpData = bmp.LockBits(new System.Drawing.Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, bmp.PixelFormat);

            byte[] buf = new byte[bmpData.Stride * bmpData.Height];
            System.Runtime.InteropServices.Marshal.Copy(bmpData.Scan0, buf, 0, buf.Length);
            _dict.Dictionary.AddItem("BitsPerComponent", new PDFNumber(8));
            _dict.Dictionary.AddItem("ColorSpace", new PDFName("DeviceRGB"));
            PDFDictionaryStream dictSMask = new PDFDictionaryStream(new PDFDictionary(), new MemoryStream());

            initSMask(dictSMask);
            _dict.Dictionary.AddItem("SMask", dictSMask);
            _isSMask = true;
            MemoryStream stream = _dict.GetStream();

            stream.SetLength(buf.Length);
            MemoryStream maskStream = dictSMask.GetStream();

            for (int i = 0; i < buf.Length; i += 4)
            {
                stream.WriteByte(buf[i + 2]);
                stream.WriteByte(buf[i + 1]);
                stream.WriteByte(buf[i]);
                maskStream.WriteByte(buf[i + 3]);
            }
            bmp.UnlockBits(bmpData);
        }
コード例 #8
0
        private void initAlphaIDAT(FileStream fs, string colorspace, int n)
        {
            if (Dictionary["ColorSpace"] == null)
            {
                Dictionary.AddItem("ColorSpace", new PDFName(colorspace));
            }
            MemoryStream        streamSMask = new MemoryStream();
            PDFDictionaryStream dictSMask   = new PDFDictionaryStream(new PDFDictionary(), streamSMask);

            initSMask(dictSMask);
            Dictionary.AddItem("SMask", dictSMask);
            MemoryStream compressionStream = new MemoryStream();

            compressionStream.Position = 0;
            writeIDAT(compressionStream, fs);
            MemoryStream decodeStream = FlateDecoder.Decode(compressionStream, null);

            byte[] pdfData = toPDFData(decodeStream, (n + 1) * (_bitdepth / 8));
            for (int i = 0; i < pdfData.Length; i += (n + 1) * (_bitdepth / 8))
            {
                GetStream().Write(pdfData, i, n * (_bitdepth / 8));
                byte b = pdfData[i + n * (_bitdepth / 8)];
                if (_bitdepth == 16)
                {
                    b = (byte)((((int)b << 8) | (int)pdfData[i + n * (_bitdepth / 8) + 1]) / 256);
                }
                streamSMask.WriteByte(b);
            }
        }
コード例 #9
0
        private void loadCanvas()
        {
            IPDFObject contents = _dictionary["Contents"];

            if (contents is PDFArray)
            {
                addFirstq(contents as PDFArray);
                addLast(contents as PDFArray);
            }
            else if (contents is PDFDictionaryStream)
            {
                PDFArray arr = new PDFArray();
                addFirstq(arr);
                arr.AddItem(contents);
                addLast(arr);
                _dictionary.AddItem("Contents", arr);
            }
            else
            {
                PDFArray            arr = new PDFArray();
                PDFDictionaryStream ds  = new PDFDictionaryStream();
                MemoryStream        s   = ds.GetStream();
                s.WriteByte((byte)'q');
                s.WriteByte((byte)'\r');
                s.WriteByte((byte)'Q');
                arr.AddItem(ds);
                _dictionary.AddItem("Contents", arr);
                _canvas              = new Canvas(s, Resources, PageRect);
                _canvas.ChangeGroup += new ChangeGroupEventHandler(m_canvas_ChangeGroup);
            }
        }
コード例 #10
0
        public string AddResources(ResourceType type, IPDFObject obj)
        {
            string key = resourceTypeToString(type);

            addDictionaryType(key);

            PDFDictionary res = _dictionary[key] as PDFDictionary;
            string        name;

            if (res.Contains(obj, out name))
            {
                return(name);
            }

            name = getVacantResourseName(res, type);
            res.AddItem(name, obj);
            if (type == ResourceType.XObject)
            {
                PDFDictionaryStream stream = obj as PDFDictionaryStream;
                if (stream != null)
                {
                    PDFName imagename = stream.Dictionary["Subtype"] as PDFName;
                    if (imagename != null)
                    {
                        if (imagename.GetValue() == "Image")
                        {
                            _images.AddItem(new Image(stream));
                        }
                    }
                }
            }
            return(name);
        }
コード例 #11
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));
                            }
                        }
                    }
                }
            }
        }
コード例 #12
0
        //TODO:
        //private PDF3DViews m_views;

        /// <summary>
        /// Creates a new 3D data initialized from the specified existing file.
        /// </summary>
        /// <param name="filename" href="http://msdn.microsoft.com/en-us/library/system.string.aspx">The path to the data.</param>
        public ThreeDData(string filename)
        {
            FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read);

            _stream = new PDFDictionaryStream();
            initData(fs, _stream);
            fs.Close();
        }
コード例 #13
0
        internal static PDFDictionaryStream Copy(PDFDictionaryStream dictStream)
        {
            Stream stream = dictStream.GetStream();

            byte[] buf = new byte[stream.Length];
            stream.Position = 0;
            stream.Read(buf, 0, buf.Length);

            MemoryStream newStream = new MemoryStream();

            newStream.Write(buf, 0, buf.Length);

            PDFDictionary dict    = dictStream.Dictionary;
            PDFDictionary newDict = new PDFDictionary();

            string[] keys = { "Type", "Subtype", "FormType", "BBox", "Matrix", "Ref", "Metadata", "LastModified", "Name" };
            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));
            }

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

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

            // PieceInfo, OPI, OC - still unknown
            // StructParent, StructParents - do not

            IPDFObject filter = dict["Filter"];

            if (filter != null)
            {
                newDict.AddItem("Filter", filter.Clone());
            }

            IPDFObject decodeParms = dict["DecodeParms"];

            if (decodeParms != null)
            {
                newDict.AddItem("DecodeParms", decodeParms.Clone());
            }

            return(new PDFDictionaryStream(newDict, newStream));
        }
コード例 #14
0
        private void init(Stream stream)
        {
            _stream = new MemoryStream();
            _dict   = new PDFDictionaryStream(new PDFDictionary(), _stream);

            _alternate = new string[1];
            byte[] buf = new byte[4];
            stream.Position = 12;
            stream.Read(buf, 0, 4);
            GetDeviceClass(Encoding.GetString(buf));
            stream.Position = 16;
            stream.Read(buf, 0, 4);
            _n = 0;
            switch (GetColorSpaceICC(Encoding.GetString(buf)))
            {
            case ColorSpaceICC.icSigRgbData:
                _alternate[0] = "DeviceRGB";
                _n            = 3;

                break;

            case ColorSpaceICC.icSigCmykData:
                _alternate[0] = "DeviceCMYK";
                _n            = 4;
                break;

            case ColorSpaceICC.icSigGrayData:
                _alternate[0] = "DeviceGray";
                _n            = 1;
                break;
            }

            _range = new float[_n * 2];
            for (int i = 0; i < _n; ++i)
            {
                _range[i * 2]     = 0.0f;
                _range[i * 2 + 1] = 1.0f;
            }

            _dict.Dictionary.AddItem("N", new PDFNumber(_n));
            PDFArray array = new PDFArray();

            array.AddItem(new PDFName(_alternate[0]));
            _dict.Dictionary.AddItem("Alternate", array);
            array = new PDFArray();
            for (int i = 0; i < _n; ++i)
            {
                array.AddItem(new PDFNumber(_range[i * 2]));
                array.AddItem(new PDFNumber(_range[i * 2 + 1]));
            }
            _dict.Dictionary.AddItem("Range", array);
            buf             = new byte[stream.Length];
            stream.Position = 0;
            stream.Read(buf, 0, (int)stream.Length);
            _stream.Write(buf, 0, buf.Length);

            _name = "";
        }
コード例 #15
0
        private void loadSound()
        {
            PDFDictionaryStream sound = _dictionary["Sound"] as PDFDictionaryStream;

            if (sound != null)
            {
                _sound = new Sound(sound);
            }
        }
コード例 #16
0
 private void initSMask(PDFDictionaryStream dictSMask)
 {
     dictSMask.Dictionary.AddItem("Type", new PDFName("XObject"));
     dictSMask.Dictionary.AddItem("Subtype", new PDFName("Image"));
     dictSMask.Dictionary.AddItem("Width", new PDFNumber(_width));
     dictSMask.Dictionary.AddItem("Height", new PDFNumber(_height));
     dictSMask.Dictionary.AddItem("BitsPerComponent", new PDFNumber(8));
     dictSMask.Dictionary.AddItem("ColorSpace", new PDFName("DeviceGray"));
 }
コード例 #17
0
        private void loadThumbnail()
        {
            PDFDictionaryStream ds = _dictionary["Thumb"] as PDFDictionaryStream;

            if (ds != null)
            {
                _thumbnail = new Image(ds);
            }
        }
コード例 #18
0
        private void readCrossReferencesEntries(PDFDictionaryStream xrefStream)
        {
            int[] W     = getW(xrefStream.Dictionary);
            int[] Index = getIndex(xrefStream.Dictionary);

            xrefStream.Decode();
            Stream stream = xrefStream.GetStream();

            stream.Position = 0;

            byte[] bType       = new byte[W[0]];
            byte[] bOffset     = new byte[W[1]];
            byte[] bGeneration = new byte[W[2]];

            int prevCount, count, type, offset, generation;

            for (int i = 0; i < Index.Length / 2; ++i)
            {
                prevCount = Index[2 * i];
                count     = Index[2 * i + 1];
                addEntries(prevCount + count);

                for (int j = 0; j < count; ++j)
                {
                    if (stream.Read(bType, 0, bType.Length) < 0)
                    {
                        return;
                    }
                    type = bytesToInt(bType);

                    if (stream.Read(bOffset, 0, bOffset.Length) < 0)
                    {
                        return;
                    }
                    offset = bytesToInt(bOffset);

                    if (stream.Read(bGeneration, 0, bGeneration.Length) < 0)
                    {
                        return;
                    }
                    if (W[2] == 0)
                    {
                        generation = 0;
                    }
                    else
                    {
                        generation = bytesToInt(bGeneration);
                    }

                    if (_xref.Entries[prevCount + j] == null)
                    {
                        _xref.Entries[prevCount + j] = new Entry((byte)type, offset, generation);
                    }
                }
            }
        }
コード例 #19
0
        private void addFirstq(PDFArray contents)
        {
            MemoryStream ms = new MemoryStream(2);

            ms.WriteByte((byte)'q');
            ms.WriteByte((byte)'\r');
            PDFDictionaryStream q = new PDFDictionaryStream(new PDFDictionary(), ms);

            contents.Insert(0, q);
        }
コード例 #20
0
 private void init(Bitmap bmp)
 {
     _width  = bmp.Width;
     _height = bmp.Height;
     _dict   = new PDFDictionaryStream(new PDFDictionary(), new MemoryStream());
     _dict.Dictionary.AddItem("Type", new PDFName("XObject"));
     _dict.Dictionary.AddItem("Subtype", new PDFName("Image"));
     _dict.Dictionary.AddItem("Width", new PDFNumber(bmp.Width));
     _dict.Dictionary.AddItem("Height", new PDFNumber(bmp.Height));
     switchFormat(bmp);
 }
コード例 #21
0
        public FullFileSpecification(Stream stream, string name)
        {
            FileName = UF = name;
            PDFDictionary       embeddedFS = new PDFDictionary();
            PDFDictionaryStream dictF      = new PDFDictionaryStream();

            byte[] data = new byte[stream.Length];
            stream.Read(data, 0, data.Length);
            dictF.GetStream().Write(data, 0, data.Length);
            embeddedFS.AddItem("F", dictF);
            EF = embeddedFS;
        }
コード例 #22
0
        internal ToUnicode(PDFDictionaryStream toUnicode)
        {
            if (toUnicode != null)
            {
                toUnicode.Decode();
                toUnicode.GetStream().Position = 0;
                m_chars  = new List <BfChar>();
                m_ranges = new List <BfRange>();

                Lexer lexer = new Lexer(toUnicode.GetStream(), null, null, 256);
                parse(lexer);
            }
        }
コード例 #23
0
 private void writeContents(PDFDictionaryStream dictStream, byte[] buf, Stream output)
 {
     if (dictStream != null)
     {
         dictStream.Decode();
         Stream str = dictStream.GetStream();
         str.Position = 0;
         int numread;
         while ((numread = str.Read(buf, 0, buf.Length)) > 0)
         {
             output.Write(buf, 0, numread);
         }
     }
 }
コード例 #24
0
        public FullFileSpecification(string filename)
        {
            FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read);

            FileName = UF = System.IO.Path.GetFileName(filename);
            PDFDictionary       embeddedFS = new PDFDictionary();
            PDFDictionaryStream dictF      = new PDFDictionaryStream();

            byte[] data = new byte[fs.Length];
            fs.Read(data, 0, data.Length);
            dictF.GetStream().Write(data, 0, data.Length);
            embeddedFS.AddItem("F", dictF);
            EF = embeddedFS;
            fs.Close();
        }
コード例 #25
0
 private void saveEmbedded(Stream stream)
 {
     try
     {
         FileSpecification   fs         = FileSpecification;
         PDFDictionaryStream dictStream = (PDFDictionaryStream)fs.EF["F"];
         dictStream.Decode();
         MemoryStream s = dictStream.GetStream();
         s.Position = 0;
         s.WriteTo(stream);
     }
     catch
     {
         // ignored
     }
 }
コード例 #26
0
        private void addLast(PDFArray contents)
        {
            System.IO.MemoryStream ms = new System.IO.MemoryStream();
            ms.WriteByte((byte)'Q');
            ms.WriteByte((byte)'\r');
            ms.WriteByte((byte)'q');
            ms.WriteByte((byte)'\r');
            ms.WriteByte((byte)'Q');

            PDFDictionary       dict = new PDFDictionary();
            PDFDictionaryStream ds   = new PDFDictionaryStream(dict, ms);

            contents.AddItem(ds);
            _canvas              = new Canvas(ms, Resources, PageRect);
            _canvas.ChangeGroup += new ChangeGroupEventHandler(m_canvas_ChangeGroup);
        }
コード例 #27
0
 private void initAIFF(Stream streamSound, PDFDictionaryStream streamOut)
 {
     byte[] word = new byte[4];
     streamOut.Dictionary.AddItem("E", new PDFName("Signed"));
     streamSound.Read(word, 0, word.Length);
     if (PDF.Encoding.GetString(word) == "COMM")
     {
         streamSound.Position += 4;
         byte[] buf = new byte[2];
         streamSound.Read(buf, 0, buf.Length);
         invert(buf);
         streamOut.Dictionary.AddItem("C", new PDFNumber(BitConverter.ToInt16(buf, 0)));
         streamSound.Position += 4;
         streamSound.Read(buf, 0, buf.Length);
         invert(buf);
         int bitPerDepth = BitConverter.ToInt16(buf, 0);
         streamOut.Dictionary.AddItem("B", new PDFNumber(bitPerDepth));
         buf = new byte[10];
         streamSound.Read(buf, 0, buf.Length);
         streamOut.Dictionary.AddItem("R", new PDFNumber((float)BinaryUtility.ConvertFromIeeeExtended(buf)));
         streamSound.Read(word, 0, word.Length);
         if (PDF.Encoding.GetString(word) == "SSND")
         {
             streamSound.Read(word, 0, word.Length);
             invert(word);
             int size = BitConverter.ToInt32(word, 0);
             streamSound.Read(word, 0, word.Length);
             invert(word);
             int offset = BitConverter.ToInt32(word, 0);
             streamSound.Read(word, 0, word.Length);
             invert(word);
             int blockSize = BitConverter.ToInt32(word, 0);
             streamSound.Position += offset;
             byte[] data = new byte[size];
             streamSound.Read(data, 0, data.Length);
             streamOut.GetStream().Write(data, 0, data.Length);
         }
         else
         {
             throw new PDFUnsupportedSoundFormatException();
         }
     }
     else
     {
         throw new PDFUnsupportedSoundFormatException();
     }
 }
コード例 #28
0
        public UncoloredTilingPatternColorspace(float width, float height)
        {
            _stream     = new MemoryStream();
            _resources  = new Resources();
            _canvas     = new Canvas(_stream, _resources, width, height);
            _streamDict = new PDFDictionaryStream(new PDFDictionary(), _stream);
            _paintType  = PDFTilingPaintType.UncoloredTilingPattern;
            _tilingType = PDF.TilingType.ConstantSpacing;
            _height     = height;
            _width      = width;
            _matrix     = new float[6];
            _matrix[0]  = 1;
            _matrix[1]  = 0;
            _matrix[2]  = 0;
            _matrix[3]  = 1;
            _matrix[4]  = 0;
            _matrix[5]  = 0;
            _xstep      = width;
            _ystep      = height;
            _color      = new ColorRGB(0, 0, 0);

            PDFDictionary dict = _streamDict.Dictionary;

            dict.AddItem("Type", new PDFName(Name));
            dict.AddItem("PatternType", new PDFNumber((float)PDFPatternType.TilingPattern));
            dict.AddItem("PaintType", new PDFNumber((float)_paintType));
            dict.AddItem("TilingType", new PDFNumber((float)_tilingType));
            PDFArray rect = new PDFArray();

            rect.AddItem(new PDFNumber(0));
            rect.AddItem(new PDFNumber(0));
            rect.AddItem(new PDFNumber(_width));
            rect.AddItem(new PDFNumber(_height));
            dict.AddItem("BBox", rect);
            dict.AddItem("XStep", new PDFNumber(_xstep));
            dict.AddItem("YStep", new PDFNumber(_ystep));
            dict.AddItem("Resources", _resources.Dictionary);
            PDFArray array = new PDFArray();

            for (int i = 0; i < 6; ++i)
            {
                array.AddItem(new PDFNumber((_matrix[i])));
            }
            dict.AddItem("Matrix", array);
            _name = "";
        }
コード例 #29
0
        public JBIG2Parameters(PDFDictionary dict)
        {
            m_stream = null;
            if (dict == null)
            {
                return;
            }

            PDFDictionaryStream dictStream = dict["JBIG2Globals"] as PDFDictionaryStream;

            if (dictStream == null)
            {
                return;
            }

            dictStream.Decode();
            m_stream = dictStream.GetStream();
        }
コード例 #30
0
        internal Image(PDFDictionaryStream stream)
        {
            if (stream == null)
            {
                throw new PDFUnsupportImageFormat();
            }
            _dict   = stream;
            _width  = (int)(stream.Dictionary["Width"] as PDFNumber).GetValue();
            _height = (int)(stream.Dictionary["Height"] as PDFNumber).GetValue();

            if (stream.Dictionary["SMask"] != null)
            {
                _isSMask = true;
            }
            else
            {
                _isSMask = false;
            }
        }