Generate Thumbnail Previews
You can preview the thumbnail image of any document uploaded to Document Engine 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