This code will iterate through all the files and look only for pdfs. It will take a photo of the first page and save it as a png.
You need to install these two python libraries.
# Installing the libraries
!pip install PyMuPDF
!pip install glob
#import glob and save all the pdf files into pdfs
pdfs= glob.glob("*.pdf")
# Loop through all the pdf and print them out.
j=1
for i in pdfs:
print(repr(j)+"-"+repr(i))
j+=1
# This library is the one we installed called PyMuPDF
import fitz
j=1
for i in pdfs:
pdffile = i
doc = fitz.open(pdffile)
page = doc.load_page(0)# the page number you want to convert
pix = page.get_pixmap()
output = str(j)+".png"
pix.save(output)
j+=1