In my pdf, it has many images and after every image there is a name of the image.
I want to extract the image and i want to put image name as name of the image.
Anyone have idea how to do?
I tried in google, I did nt fine good ones.
Thanks
Drama
Loading
Jony GreenPosted Oct 19, 2015, 3:37 AM
Lacy MichellePosted Aug 2, 2012, 11:17 PM
StringBuilder buffer = new StringBuilder();
IList images = new List();
foreach (PdfPageBase page in doc.Pages)
{
buffer.Append(page.ExtractText());
foreach (System.Drawing.Image image in page.ExtractImages())
{
images.Add(image);
}
}
doc.Close();
//save text
String fileName = "TextInPdf.txt";
File.WriteAllText(fileName, buffer.ToString());
//save image
int index = 0;
foreach (System.Drawing.Image image in images)
{
String imageFileName
= String.Format("Image-{0}.png", index++);
image.Save(imageFileName, ImageFormat.Png);
}