Aspose.Pdf.Examples.CSharp.AsposePDF.Images.PagesToImages.SinglePageToImage C# (CSharp) Метод

SinglePageToImage() публичный статический Метод

public static SinglePageToImage ( ) : void
Результат void
        public static void SinglePageToImage()
        {
           
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdf_Images();

            // Open document
            Document pdfDocument = new Document(dataDir + "PagesToImages.pdf");
           
            using (FileStream imageStream = new FileStream(dataDir + "image" + 1 + ".jpg", FileMode.Create))
            {
                // Create JPEG device with specified attributes
                // Width, Height, Resolution, Quality
                // Quality [0-100], 100 is Maximum
                // Create Resolution object
                Resolution resolution = new Resolution(300);

                // JpegDevice jpegDevice = new JpegDevice(500, 700, resolution, 100);
                JpegDevice jpegDevice = new JpegDevice(resolution, 100);
                // ExStart:ConvertParticularPage
                // Convert a particular page and save the image to stream
                jpegDevice.Process(pdfDocument.Pages[1], imageStream);
                // ExEnd:ConvertParticularPage
                // Close stream
                imageStream.Close();
            }            
          
        }
    }