Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Fri Sep 13, 2024 6:41 pm

Hi all,

Is it possible to pull images out of table cells in Spire.PDF? It doesn't look like that's possible with the PdfTable, but I was curious if there was another way I didn't know about.

Thanks!

jsrcastrogiovanni
 
Posts: 6
Joined: Thu Aug 22, 2024 6:02 pm

Sat Sep 14, 2024 9:14 am

Hello,

Thanks for your inquiry. At present, such as the following code, we support extracting images based on PDF pages. We do not yet support directly extracting images from PdfTable. If there is anything else that can help you, please feel free to contact us.
Code: Select all
    // Create a PDF document
            PdfDocument doc = new PdfDocument();

            // Load a file from disk
            doc.LoadFromFile(@"ExtractImges.pdf");

            // Get the first page of the document
            PdfPageBase page = doc.Pages[0];

            // Create an instance of PdfImageHelper to work with images
            PdfImageHelper imageHelper = new PdfImageHelper();

            // Get information about the images on the page
            PdfImageInfo[] imageInfos = imageHelper.GetImagesInfo(page);

            // Extract images from the page
            int index = 0;
            foreach (PdfImageInfo info in imageInfos)
            {
                // Save each image as a PNG file with a unique name
                info.Image.Save(string.Format("Image-{0}.png", index));
                index++;
            }

            // Dispose the PDF document to release resources
            doc.Dispose();

Sincerely,
Amin
E-iceblue support team
User avatar

Amin.Gan
 
Posts: 164
Joined: Mon Jul 15, 2024 5:40 am

Return to Spire.PDF

cron