sort files and generate pdf with correct sequence