2

Using itextsharp, How can I get the thumbnails of Pages and display in a picturebox. there are hundreds of samples on net using iTextsharp but 99% of them are how to create and manipulate PDF not just read PDF.

// pdfFileName is the file Name
PdfReader reader = new PdfReader(pdfFileName);
for (int i = 1; i <= reader.NumberOfPages; i++)
{  
// I need something like PdfPage here
}

Can someone suggest how to do this? I've had a look at the itext docs and can't figure out where to get started and get a PDF Page , I assumed I need PdfImageObject but how to get there...

Thanks in advance..

Pankaj
  • 2,618
  • 3
  • 25
  • 47

2 Answers2

1

iText and iTextSharp are PDF generators only unfortunately, and what you are looking for is actually PDF renderer. According to Bruno Lowagie the creator of iText in a recent blog post they have no plan on doing so any time soon, either.

PDF Clown, which is still only in a very early alpha, has a blog post (see point #3) stating that they've got a partial renderer working so I'd recommend looking at that.

Otherwise take a look at these SO posts about converting PDFs to JPGs:

The PdfImageObject object that you were looking at is used to create an "image-like" object that represents a piece of raw PDF content that can be embedded within a PDF but has no methods for creating a raster image such as JPG or BMP so it wouldn't help you. But if you're curious about it see this post.

Community
  • 1
  • 1
Chris Haas
  • 53,986
  • 12
  • 141
  • 274
  • can you give me the sample code for converting pdf pages into images using PDF Clown. Actually i downloaded the pdf clown lib project.How to add an exeutable solution which references the lib project... – Saravanan May 23 '13 at 05:39
  • Sorry @Saravanan, I've never actually used PDF Clown, I've only heard other people talking about it – Chris Haas May 23 '13 at 13:17
1

Check this link to extract an image...Extract images using iTextSharp I have modified this code to extract a form(Table an is data) so i guess you can extract what you want with a little of work :)

Community
  • 1
  • 1
Tyjeans
  • 101
  • 5