<p>In ImageMagick command line, you can do that as follows. Suppose you want 8 pages from the PDF.</p>

<p>Input PDF from <a href="http://www.arxiv-sanity.com" rel="nofollow noreferrer">http://www.arxiv-sanity.com</a>:</p>

<pre><code>convert image.pdf[0-7] -thumbnail 140x140 -background white +smush 20 -bordercolor white -border 10 result.jpg
</code></pre>

<p><br>
<a href="https://i.stack.imgur.com/UfW24.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UfW24.jpg" alt="enter image description here"></a></p>

<p>This takes the first 8 pages, makes thumbnails of size 140x140 and appends them side-by-side with a 20 pixels white spacing between them and adds a 10 pixel white border around it all.</p>

<p>Sorry, I do not know Node.js. But apparently there is a module that integrates ImageMagick. See <a href="https://github.com/yourdeveloper/node-imagemagick" rel="nofollow noreferrer">https://github.com/yourdeveloper/node-imagemagick</a></p>
Want to find the way to generate the thumbnail image for a given pdf file
<p>I'm currently looking for a way to generate the thumbnail image for a given pdf file, which shows several pages in the same image. The output should like what shows in the <a href="http://www.arxiv-sanity.com" rel="nofollow noreferrer">arxiv sanity</a> website. I want to know if there is any <code>npm</code> package which supports this functionality. Thanks.</p>