
Hi @Tanzim Shaikh ,
You could use sharepoint jsom to get all files, then loop through the files and add the file url to the img element, for example:
var clientContext = new SP.ClientContext();
//get the library
var library = clientContext.get_web().getFolderByServerRelativeUrl('/sites/test/DocumentLibrary');
//get all files in the library
var files = library.get_files();
clientContext.load(files);
clientContext.executeQueryAsync(onSuccess,onFailed);
var images=""
function onSuccess(){
files.get_data().forEach(file=>{
var fileName=file.get_name();
//get pdf files only
if(/\.pdf$/.test(fileName)){
var fileUrl=file.get_serverRelativeUrl();
console.log(fileUrl)
images+= "<img data-pdf-thumbnail-file='" + fileUrl + "' data-pdf-thumbnail-width='100' data-pdf-thumbnail-height='150' />"
}
})
console.log(images);
$('#test').html(images);
createPDFThumbnails();
}
function onFailed(sender, args) {
console.log('Failed' + args.get_message() + '\n' + args.get_stackTrace());
}
If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.