Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Extract a thumbnail from PDF files

Go to End

3 Posts   1452 Views


Community Member, 82 Posts

20 July 2013 at 7:14am

Edited: 20/07/2013 7:15am


I have a downloads page with only pdf files, and the client wants to see thumbnails of the files in addition to download links. I'd like to know if it's possible to extract a thumbnail from the first page of a pdf file. I tried something like this but it returns the pdf icon link:

  class Resource extends DataObject { 
  public static $db = array(
  public static $has_one = array(
    'PDF' => 'File',
    'ResourcesPage' => 'ResourcesPage'

  // Summary fields 
   public static $summary_fields = array( 
      'Thumbnail' => 'Thumbnail',
      'Title' => 'Title'
   public function getThumbnail() {
     return $this->PDF()->CMSThumbnail();

any idea if I'm missing something here or anyway to accomplish this?



Community Member, 16 Posts

15 November 2013 at 8:43am

sajok, I'm running up against the same issue - did you ever figure this out?


Community Member, 133 Posts

22 November 2013 at 11:36am

I posted about this one a while back. You will have to have ImageMagick installed but it also requires a change to the way the filesystem handles PDFs. I have not managed to kludge it yet.