Exemplo n.º 1
0
        public static PdfFile Create(Stream stream)
        {
            if (stream == null)
            {
                throw new ArgumentNullException("stream");
            }

            if (stream is MemoryStream)
            {
                return(new PdfMemoryStreamFile((MemoryStream)stream));
            }
            if (stream is FileStream)
            {
                return(new PdfFileStreamFile((FileStream)stream));
            }
            return(new PdfBufferFile(StreamExtensions.ToByteArray(stream)));
        }
Exemplo n.º 2
0
        public override void Save(Stream stream)
        {
            if (stream == null)
            {
                throw new ArgumentNullException("stream");
            }

            long offset = _stream.Position;

            try
            {
                StreamExtensions.CopyStream(_stream, stream);
            }
            finally
            {
                _stream.Position = offset;
            }
        }