Issues while generating previews/thumbnails for Sheets #8392
Unanswered
ShrayanshBaunthiyal
asked this question in
General
Replies: 1 comment 6 replies
-
What does "the debugger just goes away" mean? What happens when you're not running inside a debugger? |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
We are trying to generate previews/thumbnails dynamically(without saving the PNGs in the local machine) for Sheets in our project. We are using ThumbnailProps and saving it against the viewDefinationId of the Sheet using the saveThumbnail method. We are then trying to get the thumbnails using the getThumbnail method. We are creating an OffScreenViewport and trying to read it as an ImageBuffer using the viewport.readImageBuffer() method. We have tried two approaches for creating thumbnail props:
Approach 1:
in the Thumbnail props we directly pass the imageBuffer.data to the image parameter of ThumbnailProps as argument:
The issue that we face in this approach is while creating the imageElement using the imageElementFromImageSource() method. We have made sure that we are passing the ImageSource object to it. But it neither returns an error or crashes the app. The debugger just goes away after it executes this line. To check if we are able to get an image from the thumbnail props we have added the code to create an image buffer and download the image locally. We are able to download the image although the image seems to overlap with itself in the output, probably because I am not passing in the correct sheet dimensions. But we do get a png file downloaded in my local disk. Its just that the imageElementFromImageSource() method doesn't seem to work.
The image that we get from the working part of the code(where we are checking if the thumbnail was generated or not)
Approach 2:
Before creating the thumbnail props we first convert the ImageBuffer to BinaryImageSource using the imageSourceFromImageBuffer() method and then pass the imageSource.data to the image parameter of ThumbnailProps as argument:
In this case the imageSourceFromImageBuffer() is throwing this error. I have attached the image of the argument that we are passing to the function.


Arguements that we are passing
Error that we are getting
Is there something that I am missing or doing wrong?
Beta Was this translation helpful? Give feedback.
All reactions