Make pages line like1 3 5 7 9 11 13 15 17 6 4 2 12 10 8 18 16 14 19 21 23 25 27 29 31 33 35 24 22 20 30 28 26 36 34 32 37 39 41 43 45 47 49 51 53 42 40 38 48 46 44 54 52 50 55 57 59 61 63 65 67 69 71 60 58 56 66 64 62 72 70 68 73 75 77 79 81 83 85 87 89 78 76 74 84 82 80 90 88 86

Reading File
Running Command

cd /tmp/workspace && python3 -c " from pypdf import PdfReader reader = PdfReader('/tmp/workspace/attachments/fd5f4510-4f6c-4717-bddf-e5fb0dbb184b/anat ii paper final print.pdf') print(f'Pages: {len(reader.pages)}') " 2>&1 || python3 -c " from pypdf import PdfReader import os path = '/tmp/workspace/attachments/fd5f4510-4f6c-4717-bddf-e5fb0dbb164b/anat ii paper final print.pdf' reader = PdfReader(path) print(f'Pages: {len(reader.pages)}') "

Running Command

python3 -c " # The full sequence from the user's pattern rows = [ [1,3,5,7,9,11,13,15,17], [6,4,2,12,10,8,18,16,14], [19,21,23,25,27,29,31,33,35], [24,22,20,30,28,26,36,34,32], [37,39,41,43,45,47,49,51,53], [42,40,38,48,46,44,54,52,50], [55,57,59,61,63,65,67,69,71], [60,58,56,66,64,62,72,70,68], [73,75,77,79,81,83,85,87,89], [78,76,74,84,82,80,90,88,86], ] order = [] for row in rows: order.extend(row) print(f'Total pages in order: {len(order)}') print(f'All unique: {len(set(order)) == len(order)}') print(f'Min: {min(order)}, Max: {max(order)}') print('Order:', order) "

Running Command

python3 << 'EOF' from pypdf import PdfReader, PdfWriter import os src = '/tmp/workspace/attachments/fd5f4510-4f6c-4717-bddf-e5fb0dbb164b/anat ii paper final print.pdf' out_dir = '/tmp/workspace/anat-imposition' os.makedirs(out_dir, exist_ok=True) out_path = os.path.join(out_dir, 'anat_ii_imposition.pdf') rows = [ [1,3,5,7,9,11,13,15,17], [6,4,2,12,10,8,18,16,14], [19,21,23,25,27,29,31,33,35], [24,22,20,30,28,26,36,34,32], [37,39,41,43,45,47,49,51,53], [42,40,38,48,46,44,54,52,50], [55,57,59,61,63,65,67,69,71], [60,58,56,66,64,62,72,70,68], [73,75,77,79,81,83,85,87,89], [78,76,74,84,82,80,90,88,86], ] order = [] for row in rows: order.extend(row) reader = PdfReader(src) writer = PdfWriter() for page_num in order: writer.add_page(reader.pages[page_num - 1]) # 1-indexed to 0-indexed with open(out_path, 'wb') as f: writer.write(f) size = os.path.getsize(out_path) print(f"Done! Output: {out_path}") print(f"File size: {size/1024/1024:.2f} MB") print(f"Pages written: {len(writer.pages)}") EOF

Done! The PDF has been reordered according to your booklet imposition pattern.

anat ii imposition

PDF Document · PDF

What was done:
  • Source PDF: 90 pages
  • Pages reordered to match your exact imposition layout:
    • Each group of 18 pages forms a print sheet set (front row + back row)
    • The output PDF pages now flow in the sequence: 1, 3, 5, 7, 9, 11, 13, 15, 17, 6, 4, 2, 12, 10, 8, 18, 16, 14, 19, 21... and so on through all 90 pages
  • All 90 pages are included, no duplicates, nothing missing
This is a shared conversation. Sign in to Orris to start your own chat.