Example #1
0
        /// <summary>
        ///     Add an image to this container from a stream.
        /// </summary>
        /// <param name="imageStream">MemoryStream containing image.</param>
        /// <returns>Image being added.</returns>
        public RtfImage AddImage(MemoryStream imageStream)
        {
            if (!_allowImage)
            {
                throw new Exception("Image is not allowed.");
            }
            var block = new RtfImage(imageStream);

            AddBlock(block);
            return(block);
        }
Example #2
0
        /// <summary>
        ///     Add an image to this container from a file with filetype provided.
        /// </summary>
        /// <param name="imgFname">Filename of the image.</param>
        /// <param name="imgType">File type of the image.</param>
        /// <returns>Image being added.</returns>
        public RtfImage AddImage(string imgFname, ImageFileType imgType)
        {
            if (!_allowImage)
            {
                throw new Exception("Image is not allowed.");
            }
            var block = new RtfImage(imgFname, imgType);

            AddBlock(block);
            return(block);
        }