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.
Use doc.page_count
last_pages=list(range(doc.page_count-5,doc.page_count))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.