We're sorry AsposeCloud doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.cloud

How to create thumbnail image of PDF document using Aspose.PDF REST API

Hi

Can Aspose.PDF Cloud API create a thumbnail image of each page in a PDF document.
(Not just the first page)

Is this possible?

Thanks

@hrybko

Thanks for your inquiry. Either, you can convert PDF to multipage TIFF with desired image width and height to create thumbnail of each page in one go. Or you can convert each page of PDF document in a loop. For example for PNG thumbnail, get page count from GetPages and use PutPageConverttoPng API in a loop to create thumbnail.

.NET SDK sample code:

var apiResponse = pdfApi.GetPages(fileName, storage, folder);
int count = apiResponse.Pages.List.Count;
createThumbnail(fileName, count);

////////

static void createThumbnail(String filename, int pagecount)
{
            
    int? width = 100;
    int? height = 100;
    String folder = null;//storage root
    String storage = null;//default storage
    try
    {

        for (int i = 1; i <= pagecount; i++)
        {
            String outPath = "Temp/thumbnail_" + i + ".png";
            var response = pdfApi.PutPageConvertToPng(filename, i, outPath,width,height,folder,storage);
        }
        Console.WriteLine("Thumbnail created, Done!");
        Console.ReadKey();
    }
    catch (Exception ex)
    {
        System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);

    }
}