Click here to Skip to main content
15,899,314 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
the code is given below

C#
static void Main(string[] args)
       {
           // Extract all images with width and height more than 200px
           SautinSoft.PdfFocus f = new SautinSoft.PdfFocus();

           string pdfFile = @"c:\simple text.pdf";
           string imageDir = Path.GetDirectoryName(pdfFile);

           List<PdfFocus.PdfImage> pdfImages = null;

           f.OpenPdf(pdfFile);

           if (f.PageCount > 0)
           {
               // Specify to extract only images which have width and height
               // more than 200px
               f.ImageExtractionOptions.MinSize = new System.Drawing.Size(200, 200);

               pdfImages = f.ExtractImages();

               // Show all extracted images.
               if (pdfImages != null && pdfImages.Count > 0)
               {

                   for (int i = 0; i < pdfImages.Count; i++)
                   {
                       string imageFile = Path.Combine(imageDir, String.Format("img{0}.png", i + 1));
                       pdfImages[i].Picture.Save(imageFile);
                       System.Diagnostics.Process.Start(imageFile);
                   }
               }
           }
       }
Posted
Comments
CHill60 21-Dec-15 10:11am    
So you "need .. code" but then "give the code" ... what is your actual question?

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