The /document/thumbs Robot

We can process your documents in an automated way, saving you costly resources.

The /document/thumbs Robot generates an image for each page in a PDF file or an animated gif file that loops through all pages..

Parameters

Name Type Default Description
page Integer / Null null The PDF's page that you want to convert to an image. By default the value is null which means that all pages will be converted into images.
format String "png" The format of the extracted image(s). Supported values are "jpeg", "jpg", "gif" and "png". If you specify the value "gif" then an animated gif cycling through all pages is created. Please check out this demo to learn more about this.
delay Integer / Null null If your output format is "gif" then this parameter sets the number of 100th seconds to pass before the next frame is shown in the animation. Set this to 100 for example to allow 1 second to pass between the frames of the animated gif. If your output format is not "gif", then this parameter does not have any effect.
width Integer(1-5000) Auto Width of the new image, in pixels. If not specified, will default to the width of the input image
height Integer(1-5000) Auto Height of the new image, in pixels. If not specified, will default to the height of the input image
resize_strategy String "pad" One of the available resize strategies.
background String "#FFFFFF" Either the hexadecimal code or name of the color used to fill the background (only used for the pad resize strategy). Note by default, the background of transparent images is changed to white. For details about how to preserve transparency across all image types, see this demo.
density String / Null null While in-memory quality and file format depth specifies the color resolution, the density of an image is the spatial (space) resolution of the image. That is the density (in pixels per inch) of an image and defines how far apart (or how big) the individual pixels are. It defines the size of the image in real world terms when displayed on devices or printed. You can set this value to a specific width or in the format widthxheight. If your converted image has a low resolution, please try using the density parameter to resolve that.
trim_whitespace Boolean true This determines if additional whitespace around the PDF should first be trimmed away before it is converted to an image. If you set this to true only the real PDF page contents will be shown in the image. If you need to reflect the PDF's dimensions in your image, it is generally a good idea to set this to false.
pdf_use_cropbox Boolean true Some PDF documents lie about their dimensions. For instance they'll say they are landscape, but when opened in decent Desktop readers, it's really in portrait mode. This can happen if the document has a cropbox defined. When this option is enabled (by default), the cropbox is leading in determining the dimensions of the resulting thumbnails.

Example use cases

Our /document/thumbs Robot can be used in combination with other Robots, to create powerful workflows unique to your use case.
Here are a few example scenarios, and the required the Assembly Instructions to implement them.
You can also try demos of these examples right here, live on our website.

Convert all pages of a document into an animated GIF

{
  "steps": {
    "thumb": {
      "use": ":original",
      "robot": "/document/thumbs",
      "result": true,
      "width": 100,
      "height": 250,
      "resize_strategy": "pad",
      "background": "#000000",
      "format": "gif"
    }
  }
}

Convert all pages of a document into images

{
  "steps": {
    "thumb": {
      "use": ":original",
      "robot": "/document/thumbs",
      "result": true,
      "width": 200,
      "height": 500,
      "resize_strategy": "pad",
      "background": "#000000"
    }
  }
}

Convert the first page of a document into an image

{
  "steps": {
    "thumb": {
      "use": ":original",
      "robot": "/document/thumbs",
      "result": true,
      "page": 1,
      "width": 200,
      "height": 500,
      "resize_strategy": "pad",
      "background": "#000000"
    }
  }
}

Related blog posts

Over the years we wrote the following posts about Our /document/thumbs robot on our blog:

Did you know?

You can easily combine Robots to create powerful workflows, unique to your business.
This is the power of Transloadit.