We just released a new endpoint to the ReportingCloud Web API to create image thumbnails of documents. Until now, only templates from the template storage could be used to create thumbnails. The new endpoint allows you to upload a document in the request payload in various formats to create image thumbnails of specified pages.

https://api.reporting.cloud/v1/document/thumbnails

The following settings can be passed as query parameters to specify the zoom factor, the required page numbers and the image format:

Parameter Value Type Value description
zoomFactor Integer Optional. An Integer value between 1 and 400 to set the percentage zoom factor of the created thumbnail images. Default value: 100.
fromPage Integer Optional. An Integer value that specifies the first page. By default the first page is selected.
toPage Integer Optional. An Integer value that specifies the last page. By default the last page is selected.
imageFormat String Optional. A string value that defines the image format of the returned thumbnails. Possible values are PNG, JPG, GIF and BMP. By default, the return format is PNG.

The document needs to be posted in the request payload in one of the following document formats encoded as a Base64 string:

  • DOC
  • DOCX
  • PDF
  • TX
  • XLSX
  • RTF
  • HTML

The following code uses the ReportingCloud .NET SDK to create thumbnails of an uploaded document:

ReportingCloud rc = new ReportingCloud(sUsername, sPassword, uriBasePath);
// upload 1 more document with unique file name
byte[] bDocument = File.ReadAllBytes("documents/invoice.tx");
// create thumbnails
List<System.Drawing.Image> images = rc.GetDocumentThumbnails(bDocument, 20, 1, 2, ImageFormat.PNG);
// check, if images are created
Console.WriteLine(images.Count().ToString() + " image thumbnails have been created.");

Happy coding!