Sort files before creating the PDF