Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// Extract images
IEnumerable<PageImageArea> images = parser.GetImages();
// Check if images extraction is supported
if (images == null)
{
Console.WriteLine("Images extraction isn't supported");
return;
}
// Create an instance of Parser class
using (Parser parser = new Parser("C:\\candy.pdf"))
{
// Extract images
IEnumerable<PageImageArea> images = parser.GetImages();
// Check if image extraction is supported
if (images == null)
{
Console.WriteLine("Images extraction isn't supported");
return;
}
int counter = 1;
// Iterate over images
foreach (PageImageArea image in images)
{
// Save each image
Image.FromStream(image.GetImageStream()).Save(string.Format("{0}.Jpeg", counter++), ImageFormat.Jpeg);
}
}
// Create an instance of Parser class
using (Parser parser = new Parser("sample.pdf"))
{
// you code goes here.
}
using GroupDocs.Parser;
using GroupDocs.Parser.Data;
using System.Drawing;
using System.Drawing.Imaging;
// Iterate over images
foreach (PageImageArea image in images)
{
// Save images
Image.FromStream(image.GetImageStream()).Save(string.Format("{0}.Jpeg", counter++), ImageFormat.Jpeg);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.