Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to get the customer picture alone extracted from a pdf using itextsharp in c#. The issue is that in my PDF there would be bar code also be present if data entered fully fine.

What I have tried:

if (type != null && type.ToString().Equals(PdfName.IMAGE.ToString()))
                    {
                        if (flag == 0)//restrtict to take only one image
                        {
                            pio = new PdfImageObject(pst); //get the image
                            CustomerImage = ExtractedImagePath + DateTime.Now.ToString("ddMMyyyyHHmmss") + "image" + ".jpg";
                            fs = new FileStream(CustomerImage, FileMode.Create);
                            //read bytes of image in to an array
                            byte[] imgdata = pio.GetImageAsBytes();
                            //write the bytes array to file
                            fs.Write(imgdata, 0, imgdata.Length);
                            fs.Flush();
                            fs.Close();
                            CustomerImage = Path.GetFileName(CustomerImage);
                            flag = 1;
                        }
Posted
Updated 28-Jul-17 2:08am
Comments
Graeme_Grant 28-Jul-17 7:54am    

1 solution

You posted this yesterday, and I already gave you a suggestion: How to extract images from PDF in C#?[^]. Please do not repost the same question.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900