I have created a function for a PDF page Splitter. I can choose a PDF file, save the path to pdfOne and after that I can choose what pages I want to split. The problem is that split pages goes in the same path as the original PDF. I don't want that, I want to send the split pages to a different folder-path.
def onFindPage(self, event):
pdfOne = self.pdfOne.GetValue()
spgcf=int(self.spgcfrom.GetValue())
spgcu=int(self.spgcuntil.GetValue())
inputpdfpdfOne = pyPdf.PdfFileReader(file(pdfOne, "rb"))
for i in xrange((spgcf-1),spgcu):
output = PdfFileWriter()
output.addPage(inputpdfpdfOne.getPage(i))
with open("page%s.pdf" % i,"wb") as outputStream:
output.write(outputStream)