/// <summary>
        /// Returns the encoder for the specified <paramref name="filename"/>.
        /// </summary>
        /// <param name="filename">The filename.</param>
        /// <param name="encoder">The encoder.</param>
        /// <returns>
        /// <b>True</b> if the encoder is created and initialized; otherwise, <b>false</b>.
        /// </returns>
        /// <exception cref="NotSupportedException">Thrown if encoder is not created.</exception>
        public bool GetEncoder(string filename, out EncoderBase encoder)
        {
            // create encoder
            encoder = AvailableEncoders.CreateEncoder(filename);

            // indicates whether the encoder can add images to the existing multipage image file
            bool canAddImagesToExistingFile = false;

            // if encoder can add images to the existing multipage image file
            if (CanAddImagesToExistingFile)
            {
                // if file exists
                if (File.Exists(filename))
                {
                    // specify that encoder can add images to the existing multipage image file
                    canAddImagesToExistingFile = true;
                }
            }

            // if encoder is not found
            if (encoder == null)
            {
                throw new NotSupportedException(string.Format("Can not find encoder for '{0}'.", filename));
            }

            // set encoder settings
            return(ShowEncoderSettingsDialogAndCheckOverwrite(
                       filename,
                       ref encoder,
                       canAddImagesToExistingFile,
                       true));
        }
        /// <summary>
        /// Returns the multipage encoder for the specified <paramref name="filename"/>.
        /// </summary>
        /// <param name="filename">The filename.</param>
        /// <param name="multipageEncoder">The multipage encoder.</param>
        /// <returns>
        /// <b>True</b> if the multipage encoder is created and initialized; otherwise, <b>false</b>.
        /// </returns>
        public bool GetMultipageEncoder(string filename, out MultipageEncoderBase multipageEncoder)
        {
            // create encoder
            EncoderBase encoder = AvailableEncoders.CreateEncoder(filename);

            // indicates whether the encoder can add images to the existing multipage image file
            bool canAddImagesToExistingFile = false;

            // if encoder can add images to the existing multipage image file
            if (CanAddImagesToExistingFile)
            {
                // if file exists
                if (File.Exists(filename))
                {
                    // specify that encoder can add images to the existing multipage image file
                    canAddImagesToExistingFile = true;
                }
            }

            // get the multipage encoder
            multipageEncoder = encoder as MultipageEncoderBase;

            // if encoder is not multipage
            if (multipageEncoder == null)
            {
                return(false);
            }

            // set encoder settings
            bool result = ShowEncoderSettingsDialogAndCheckOverwrite(
                filename,
                ref encoder,
                canAddImagesToExistingFile,
                multipageEncoder.CreateNewFile);

            multipageEncoder = encoder as MultipageEncoderBase;

            return(result);
        }