コード例 #1
0
        /// <summary>
        /// Writes the stream of the specified dictionary.
        /// </summary>
        public void WriteStream(PDFDictionary value, bool omitStream)
        {
            StackItem stackItem = _stack[_stack.Count - 1];

            Debug.Assert(stackItem.Object is PDFDictionary);
            Debug.Assert(stackItem.Object.IsIndirect);
            stackItem.HasStream = true;

            WriteRaw(_lastCat == CharCat.NewLine ? ">>\nstream\n" : " >>\nstream\n");

            if (omitStream)
            {
                WriteRaw("  «...stream content omitted...»\n");  // useful for debugging only
            }
            else
            {
                byte[] bytes = value.Stream.Value;
                if (bytes.Length != 0)
                {
                    if (SecurityHandler != null)
                    {
                        bytes = (byte[])bytes.Clone();
                        bytes = SecurityHandler.EncryptBytes(bytes);
                    }
                    Write(bytes);
                    if (_lastCat != CharCat.NewLine)
                    {
                        WriteRaw('\n');
                    }
                }
            }
            WriteRaw("endstream\n");
        }