right so I have this script that converts pdf files to jpg. Some pdf don't work and I found out that if I simply merge and split them again online that they will work afterwards. So what I am looking for is a way that lets me create a pdf document, import an exisiting pdf and then save it as a new pdf.

does anyone have any code for this?