I am building an application using Next.js and Sanity, where users can upload PDFs via Sanity. On the frontend, I want to display these PDFs as thumbnails (just the front page of the PDF is enough). Users should be able to click on the thumbnail to either view the full PDF in a viewer or download it.
I’ve successfully set up the Sanity backend for uploading and retrieving PDFs. However, I’m struggling to find a library or approach that can generate thumbnails from PDFs to display them on the frontend.
Requirements:
Generate a thumbnail (first page) of the PDF.
Display the thumbnail on the frontend.
On click, open the full PDF for viewing or downloading.
I’ve searched for libraries but can’t find a suitable one to generate thumbnails efficiently. Any suggestions or guidance would be greatly appreciated.