PyMuPdf
, and ask the user if he wants to iterate through more 5 pages.reversed
method of PyMuPdf
, but that doesn't take the parameter of limiting it to only 5 pages.20-19-18-17-16
and if the user enters Yes to process another 5 pages then process 15-14-13-12-11
and so on.doc.pages(start, stop, step)
this method can be used for iterating through particular number of pages, but then I have to manually calculate the start and end, and do which is not a good practice.Look at the Document.pages()
iterator.
Simply iterate over Document.pages(-5)
which will yield the last 5 pages.