示例#1
0
 /* ----------------------------------------------------------------- */
 ///
 /// GetImagePage
 ///
 /// <summary>
 /// Gets a Page collection from the specified file.
 /// </summary>
 ///
 /// <param name="io">I/O object.</param>
 /// <param name="src">File path of the Image.</param>
 ///
 /// <returns>Page collection.</returns>
 ///
 /* ----------------------------------------------------------------- */
 public static IEnumerable <Page> GetImagePages(this FileSystem.IO io, string src)
 {
     using (var ss = io.OpenRead(src))
         using (var image = Image.FromStream(ss))
         {
             return(io.GetImagePages(src, image));
         }
 }
示例#2
0
 /* ----------------------------------------------------------------- */
 ///
 /// GetImagePage
 ///
 /// <summary>
 /// Gets a Page object from the specified file.
 /// </summary>
 ///
 /// <param name="io">I/O object.</param>
 /// <param name="src">File path of the Image.</param>
 /// <param name="index">Index of the Image.</param>
 ///
 /// <returns>Page object.</returns>
 ///
 /* ----------------------------------------------------------------- */
 public static Page GetImagePage(this FileSystem.IO io, string src, int index)
 {
     using (var ss = io.OpenRead(src))
         using (var image = Image.FromStream(ss))
         {
             return(io.GetImagePage(src, image, index));
         }
 }
示例#3
0
        /* ----------------------------------------------------------------- */
        ///
        /// GetImagePage
        ///
        /// <summary>
        /// Gets a Page object from the specified image.
        /// </summary>
        ///
        /// <param name="io">I/O object.</param>
        /// <param name="src">File path of the Image.</param>
        /// <param name="image">Image object.</param>
        /// <param name="index">Index of the Image.</param>
        ///
        /// <returns>Page object.</returns>
        ///
        /* ----------------------------------------------------------------- */
        public static Page GetImagePage(this FileSystem.IO io, string src, Image image, int index)
        {
            Debug.Assert(image != null);
            Debug.Assert(image.FrameDimensionsList != null);
            Debug.Assert(image.FrameDimensionsList.Length > 0);

            return(io.GetImagePage(src, image, index,
                                   new FrameDimension(image.FrameDimensionsList[0])));
        }
示例#4
0
文件: Page.cs 项目: yas/Cube.Pdf
        /* ----------------------------------------------------------------- */
        ///
        /// GetImagePage
        ///
        /// <summary>
        /// Gets a Page collection from the specified Image.
        /// </summary>
        ///
        /// <param name="io">I/O object.</param>
        /// <param name="src">File path of the Image.</param>
        /// <param name="image">Image object.</param>
        ///
        /// <returns>Page collection.</returns>
        ///
        /* ----------------------------------------------------------------- */
        public static IEnumerable <Page> GetImagePages(this FileSystem.IO io, string src, Image image)
        {
            var dest = new List <Page>();
            var dim  = new FrameDimension(image.FrameDimensionsList[0]);

            for (var i = 0; i < image.GetFrameCount(dim); ++i)
            {
                dest.Add(io.GetImagePage(src, image, i, dim));
            }

            return(dest);
        }
示例#5
0
文件: File.cs 项目: yas/Cube.Pdf
        /* ----------------------------------------------------------------- */
        ///
        /// GetImageFile
        ///
        /// <summary>
        /// Gets the File object that represents the specified image.
        /// </summary>
        ///
        /// <param name="io">I/O handler.</param>
        /// <param name="src">Path of the image file.</param>
        /// <param name="image">Image object.</param>
        ///
        /// <returns>ImageFile object.</returns>
        ///
        /* ----------------------------------------------------------------- */
        public static ImageFile GetImageFile(this FileSystem.IO io, string src, Image image)
        {
            var guid = image.FrameDimensionsList[0];
            var dim  = new FrameDimension(guid);
            var x    = image.HorizontalResolution;
            var y    = image.VerticalResolution;

            return(new ImageFile(src, io)
            {
                Count = image.GetFrameCount(dim),
                Resolution = new PointF(x, y),
            });
        }
示例#6
0
        /* ----------------------------------------------------------------- */
        ///
        /// GetImagePage
        ///
        /// <summary>
        /// Gets a Page object from the specified values.
        /// </summary>
        ///
        /* ----------------------------------------------------------------- */
        private static Page GetImagePage(this FileSystem.IO io, string src, Image image, int index, FrameDimension dim)
        {
            image.SelectActiveFrame(dim, index);

            var x = image.HorizontalResolution;
            var y = image.VerticalResolution;

            return(new Page(
                       io.GetImageFile(src, image), // File
                       index + 1,                   // Number
                       image.Size,                  // Size
                       new Angle(),                 // Rotation
                       new PointF(x, y)             // Resolution
                       ));
        }
示例#7
0
 /* ----------------------------------------------------------------- */
 ///
 /// GetPdfFile
 ///
 /// <summary>
 /// Gets the File object that represents the specified PDF document.
 /// </summary>
 ///
 /// <param name="io">I/O handler.</param>
 /// <param name="src">Path of the PDF file.</param>
 /// <param name="password">Password to open the PDF file.</param>
 ///
 /// <returns>PdfFile object.</returns>
 ///
 /* ----------------------------------------------------------------- */
 public static PdfFile GetPdfFile(this FileSystem.IO io, string src, string password) =>
 new PdfFile(src, password, io);
示例#8
0
文件: Page.cs 项目: yas/Cube.Pdf
 /* ----------------------------------------------------------------- */
 ///
 /// GetImagePage
 ///
 /// <summary>
 /// Gets a Page object from the specified image.
 /// </summary>
 ///
 /// <param name="io">I/O object.</param>
 /// <param name="src">File path of the Image.</param>
 /// <param name="image">Image object.</param>
 /// <param name="index">Index of the Image.</param>
 ///
 /// <returns>Page object.</returns>
 ///
 /* ----------------------------------------------------------------- */
 public static Page GetImagePage(this FileSystem.IO io, string src, Image image, int index) =>
 io.GetImagePage(src, image, index, new FrameDimension(image.FrameDimensionsList[0]));