You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is currently the following script but it would be nice to integrate this into the software
fromPyPDF2importPdfFileReader, PdfFileWriterimportsysimportsubprocessimportrefromshleximportquotereg=re.compile(r'(?:Gruppe:\s*)(\d*)')
inputfilename=sys.argv[1]
inputfilename_safe=quote(inputfilename)
input=PdfFileReader(open(inputfilename, 'rb'))
pages=input.getNumPages()
gruppe=1output=PdfFileWriter()
outfilename_prefix=inputfilename.split('.pdf',1)[0]
# We do not know the group number yet so we do a dumy replaceoutfilename='{}-Gruppe-{}.pdf'.format(outfilename_prefix, '{}')
foriinrange(1, pages+1):
ret=subprocess.getoutput('pdftotext -f {0} -l {0} {1} -'.format(i, inputfilename_safe))
if'für Frage'inretandi!=1:
outfile=open(outfilename.format(gruppe), 'wb')
output.write(outfile)
outfile.close()
output=PdfFileWriter()
gruppe=int(reg.search(ret).group(1))
output.addPage(input.getPage(i-1))
outfile=open(outfilename.format(gruppe), 'wb')
gruppe+=1output.write(outfile)
outfile.close()
The text was updated successfully, but these errors were encountered:
There is currently the following script but it would be nice to integrate this into the software
The text was updated successfully, but these errors were encountered: