VB.NET: Extract Thumbnails From A PDF File

In my last tip, I posted the code for Extracting the Text Content from a PDF File.
Well, I promised  to post the code for Generating Graphical Thumbnail from PDF File in that post very soon.
However, some viral infection made me inefficient enough to delay this post :-).
Here is the code snippet to generate the graphical thumbnail from the pdf file.
You can extend this thing for generating the thumbnails of all the pages, last page etc.
Currently this code generates the thumbnail of first page only.
Also you can play around with the thumbnail size part, I have not added the sizing section which takes care of the size and the aspect ratio.
Will post the snippet for Getting the Size According to Aspect Ratio in next post.


A sample call for this function is like below:

Dim strThumbFile As String
Dim strPDFPath As String, strTargetPath As String, strTargetFileName As String
strPDFPath = "YourDrive:\YourPath\SomePDFFile.pdf"
strTargetPath = "YourDrive:\YourPath"
strTargetFileName = "YourFileName.jpg"
If fn02_GenerateThumbFromPDF(strPDFPath, strTargetPath, strTargetFileName, System.Drawing.Imaging.ImageFormat.Jpeg, strThumbFile) = True Then
    MsgBox("Error in generating thumbnail.")
End If

For this code to run, you need Adobe Acrobat installed on your machine.
I have tested this code on Adobe Acrobat Professional 6.0 and it works perfectly on that.
Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.