/// <summary>
        /// Add fonts from source to new XPS.
        /// </summary>
        /// <param name="fixedPageReader"></param>
        /// <param name="pageWriter"></param>
        private void AddFonts(
            IXpsFixedPageReader fixedPageReader,
            IXpsFixedPageWriter pageWriter)
        {
            // Adding font from source to resources.
            foreach (XpsFont font in fixedPageReader.Fonts)
            {
                if (!CheckIfFontAddedAlready(font.Uri.ToString()))
                {
                    XpsFont newFont = pageWriter.AddFont(false);

                    using (Stream dstFontStream = newFont.GetStream())
                    {
                        using (Stream srcFontStream = font.GetStream())
                        {
                            if (font.IsObfuscated)
                            {
                                WriteObfuscatedStream(font.Uri.ToString(),
                                                      dstFontStream, srcFontStream);
                            }
                            else
                            {
                                WriteToStream(dstFontStream, srcFontStream);
                            }
                            newFont.Commit();
                            XpsDetails xpsFont = new XpsDetails();
                            xpsFont.resource  = newFont;
                            xpsFont.sourceURI = font.Uri;
                            xpsFont.destURI   = newFont.Uri;
                            xpsFonts.Add(xpsFont);
                        }
                    }
                }
            }
        }
        /// <summary>
        /// Add images from source to new XPS.
        /// </summary>
        /// <param name="fixedPageReader"></param>
        /// <param name="pageWriter"></param>
        private void AddImages(
            IXpsFixedPageReader fixedPageReader,
            IXpsFixedPageWriter pageWriter)
        {
            // Adding images to resources.
            foreach (XpsImage image in fixedPageReader.Images)
            {
                XpsImage newImage = null;

                // Getting the URI to check the image extension.
                string sourceExt = image.Uri.ToString().ToLower();


                if (sourceExt.Contains(ImageType.PNG))
                {
                    newImage = pageWriter.AddImage(XpsImageType.PngImageType);
                }
                else if (sourceExt.Contains(ImageType.JPG) ||
                         sourceExt.Contains(ImageType.JPEG))
                {
                    newImage = pageWriter.AddImage(XpsImageType.JpegImageType);
                }
                else if (sourceExt.Contains(ImageType.TIF) ||
                         sourceExt.Contains(ImageType.TIFF))
                {
                    newImage = pageWriter.AddImage(XpsImageType.TiffImageType);
                }
                else if (sourceExt.Contains(ImageType.WDP))
                {
                    newImage = pageWriter.AddImage(XpsImageType.WdpImageType);
                }
                else
                {
                    newImage = null;
                }

                if (null != newImage)
                {
                    using (Stream dstImageStream = newImage.GetStream())
                    {
                        using (Stream srcImageStream = image.GetStream())
                        {
                            CopyStream(srcImageStream, dstImageStream);
                            newImage.Commit();
                            XpsDetails xpsImage = new XpsDetails();
                            xpsImage.resource  = newImage;
                            xpsImage.sourceURI = image.Uri;
                            xpsImage.destURI   = newImage.Uri;
                            xpsImages.Add(xpsImage);
                        }
                    }
                }
            }
        }