Of course, since it's known the file name ends with the four characters ".pdf" and that it's the last four characters that are to be removed, it's hardly necessary to go looking for them. Just remove the last four characters. substr($name,0,-4).
Actually, that's not known: the filter only makes sure the filename contains ".pdf" and the only place it can't appear is right at the start. It will, for example, allow "foo.pdf.tgz", and that's how it would be displayed.
The following three lines do the work of reading all the filenames listed in $Folder and retaining those that end with ".pdf". Basically, the stuff from "// Open the folder" down to "sort".
if(!is_readable($Folder)) die($Folder." could not be opened.");
$narray = array_map('basename',glob("$Folder/*.pdf"));
sort($narray);
I see there's also a check to ensure that "foo.pdf" isn't a directory named "foo.pdf". Annoyingly, there is a flag to ensure glob() only returns directories, but no flag to ensure that glob() only returns nondirectories.
$narray = array_map('basename',glob("$Folder/*.pdf"));
$narray = array_diff($narray, array_map('basename',glob("$Folder/*.pdf", GLOB_ONLYDIR)));
Incidentally, the call to sort() may be unnecessary and perhaps undesirable: glob has a flag to turn off sorting.