Call the view method of the Viewer object. Specify the new page order in the last parameters.
The following code snippet shows how to reorder pages:
fromgroupdocs.viewerimportViewerfromgroupdocs.viewer.optionsimportPdfViewOptionsdefreorder_pages():# Load documentwithViewer("sample.docx")asviewer:# Create view options.viewOptions=PdfViewOptions("reorder_pages/reordered_pages.pdf")# Pass page numbers in the order you want to render them.viewer.view(viewOptions,[2,1])if__name__=="__main__":reorder_pages()
sample.docx is the sample file used in this example. Click here to download it.