I need to change the location that the output file is saved. Currently the save location is wherever the application is located. I would like to change it to the user's desktop.
Any help would be appreciated.
filename = askopenfilename()
packet.seek(0)
new_pdf = PdfFileReader(packet)
existing_pdf = PdfFileReader(open(filename, "rb"))
output = PdfFileWriter()
page = existing_pdf.getPage(0)
page.mergePage(new_pdf.getPage(0))
output.addPage(page)
name = (os.path.basename(filename))
name = name[:-4]
outputStream = open(name "-CARB.pdf", "wb")
output.write(outputStream)
outputStream.close()
CodePudding user response:
Change the name in your code to the path you want to save
Basically in below statement you can specify where you want to save the file. For example:
outputStream = open("C:\\Users\\<<USERNAME>>\\Desktop\\" "-CARB.pdf", "wb")