A
A
Aljo2021-08-30 17:49:42
JavaScript
Aljo, 2021-08-30 17:49:42

Is it possible to generate a preview image for a pdf from the first page?

Hello!
Is it possible to generate a preview image from the first page of a pdf?
Are there any js libraries that can help with this task?

Thanks in advance!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Aljo, 2021-08-30
@aljo222

I managed to find a cool script pdfThumbnails.js .
You also need to include pdf.js (pdf.js and pdf.worker.js)
And that's it.
Just write something like this and the script displays the first page of the pdf file as a preview image:

<img data-pdf-thumbnail-file="/assets/news/pdf/teambuilding_210821.pdf" />

V
Vasya Bulka, 2021-08-30
@Anonymous24

If I understood correctly, then here: https://pdfkit.org/docs/images.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question