admin管理员组文章数量:1431426
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.
Here is an example of the JSON object returned for each PDF:
{
"_id": "887ec5b8-0145-458d-825a-6d405f60532f",
"pdfTitle": "PDF 2024",
"pdfFile": {
"asset": {
"url": ";
}
}
}
版权声明:本文标题:javascript - How to Generate PDF Thumbnails for Frontend Display in a Next.js + Sanity Application? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745570418a2664013.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论