The Docotic.Pdf library can be used to extract images from PDF files.
Here is an example that shows how to iterate over pages and extract all the images from each PDF page:
static void ExtractImagesFromPdfPages()
{
string path = "";
using (PdfDocument pdf = new PdfDocument(path))
{
for (int i = 0; i < pdf.Pages.Count; i++)
{
for (int j = 0; j < pdf.Pages[i].Images.Count; j++)
{
string imageName = string.Format("page{0}-image{1}", i, j);
string imagePath = pdf.Pages[i].Images[j].Save(imageName);
}
}
}
}
The library will not overflow images. It will save them exactly the same as in PDF.
Disclaimer: I work for Bit Miracle, a library provider.
source
share