I have a PHP program that fetches alot of individual PDFs from backend and save into a folder.
Currently I am using pdfk to merge the pdfs. Below is the sample code used:
exec("pdftk.exe *.pdf cat output merged.pdf");
How do I merge them according to a particular order, 1st fetched as first page to last fetched as the last page?
You can read directory and check the creation timestamp of the file with filemtime()
Maybe iterate trough files and put the times and filenames in array and then sort the array and then create binding pdf