Generate Thumbnail Previews

Information

PSPDFKit Server has been deprecated and replaced by PSPDFKit Document Engine. All PSPDFKit Server and PSPDFKit for Web Server-Backed licenses will work as before and be supported until 15 May 2024 (we will contact you about license migration). To start using Document Engine, refer to the migration guide. With Document Engine, you’ll have access to robust new capabilities (read the blog for more information).

You can preview the thumbnail image of any document uploaded to PSPDFKit Server by sending the request specifying the page index of the page you want to preview and either the width or height of the thumbnail:

curl "http://localhost:5000/api/documents/7KPS35QPZA65Z0DKSDJBTD5DFS/pages/0/image?width=100" \
  -H Authorization: Token token=secret" \
  -o thumbnail.png

After you run the above command, the thumbnail.png file will contain the rendered thumbnail.

To get a thumbnail of a specific height instead of width, replace the width parameter with height, e.g.:

curl "http://localhost:5000/api/documents/7KPS35QPZA65Z0DKSDJBTD5DFS/pages/0/image?height=100" \
  -H Authorization: Token token=secret" \
  -o thumbnail.png

To preview a thumbnail of another page, replace the 0 in the URL with the page index of the page you’d like to render:

curl "http://localhost:5000/api/documents/7KPS35QPZA65Z0DKSDJBTD5DFS/pages/1/image?width=100" \
  -H Authorization: Token token=secret" \
  -o thumbnail.png

And finally, if you want the annotation appearance streams to be rendered in the preview, provide the render_ap_streams parameter:

curl "http://localhost:5000/api/documents/7KPS35QPZA65Z0DKSDJBTD5DFS/pages/1/image?width=100&render_ap_streams=true" \
  -H Authorization: Token token=secret" \
  -o thumbnail.png