ByteScout PDF Suite - C# - Extract Images by Page from PDF with PDF Extractor SDK - ByteScout

ByteScout PDF Suite – C# – Extract Images by Page from PDF with PDF Extractor SDK

  • Home
  • /
  • Articles
  • /
  • ByteScout PDF Suite – C# – Extract Images by Page from PDF with PDF Extractor SDK

How to extract images by page from PDF with PDF extractor SDK in C# using ByteScout PDF Suite

Continuous learning is a crucial part of computer science and this tutorial shows how to extract images by page from PDF with PDF extractor SDK in C#

These source code samples are assembled by their programming language and functions they apply. ByteScout PDF Suite is the set that includes 6 SDK products to work with PDF from generating rich PDF reports to extracting data from PDF documents and converting them to HTML. This bundle includes PDF (Generator) SDK, PDF Renderer SDK, PDF Extractor SDK, PDF to HTML SDK, PDF Viewer SDK and PDF Generator SDK for Javascript. It can extract images by page from PDF with PDF extractor SDK in C#.

These C# code samples for C# guide developers to speed up coding of the application when using ByteScout PDF Suite. IF you want to implement the functionality, just copy and paste this code for C# below into your code editor with your app, compile and run your application. Use of ByteScout PDF Suite in C# is also described in the documentation included along with the product.

All these programming tutorials along with source code samples and ByteScout free trial version are available for download from our website.

On-demand (REST Web API) version:
 Web API (on-demand version)

On-premise offline SDK for Windows:
 60 Day Free Trial (on-premise)

Program.cs
      
using System; using System.Drawing.Imaging; using Bytescout.PDFExtractor; using System.Diagnostics; namespace ExtractImagesByPages { class Program { static void Main(string[] args) { // Create Bytescout.PDFExtractor.ImageExtractor instance ImageExtractor extractor = new ImageExtractor(); extractor.RegistrationName = "demo"; extractor.RegistrationKey = "demo"; // Load sample PDF document extractor.LoadDocumentFromFile(@".\sample1.pdf"); // Get count of pages int pageCount = extractor.GetPageCount(); // Extract images from each page for (int i = 0; i < pageCount; i++) { int j = 0; // Initialize page images enumeration if (extractor.GetFirstPageImage(i)) { do { string outputFileName = "page" + i + "image" + j + ".png"; // Save image to file extractor.SaveCurrentImageToFile(outputFileName, ImageFormat.Png); j++; } while (extractor.GetNextImage()); // Advance image enumeration } } // Cleanup extractor.Dispose(); // Open first output file in default associated application ProcessStartInfo processStartInfo = new ProcessStartInfo("page0image0.png"); processStartInfo.UseShellExecute = true; Process.Start(processStartInfo); } } }

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout PDF Suite Home Page

Explore ByteScout PDF Suite Documentation

Explore Samples

Sign Up for ByteScout PDF Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

VIDEO

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout PDF Suite Home Page

Explore ByteScout PDF Suite Documentation

Explore Samples

Sign Up for ByteScout PDF Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next