Cut performa ansexure 1 and 2 and also kannada apges from this and make it new doc

I'll read the PDF skill first, then examine the PDF to identify the pages to remove.
Reading File
Now let me examine the PDF to understand its structure and find the pages to remove.
Running Command

cd /home/daytona/workspace/attachments/f2d2667d-9eb6-4b80-ba17-d53072a7db0c/ && python3 -c " from pypdf import PdfReader reader = PdfReader('Important IEC -1-28.pdf') print(f'Total pages: {len(reader.pages)}') for i, page in enumerate(reader.pages): text = page.extract_text() # Print first 200 chars of each page snippet = text[:300].replace('\n', ' ') if text else '[no text]' print(f'Page {i+1}: {snippet}') print('---') "

I can see the structure clearly:
  • Annexure 1 (English): Pages 21–23
  • Annexure 2 (English): Pages 24
  • Kannada pages: Pages 25–28 (Annexure 1 & 2 in Kannada script)
I'll remove pages 21–28 and save the remaining pages (1–20) as a new document.
Running Command

python3 -c " from pypdf import PdfReader, PdfWriter src = '/home/daytona/workspace/attachments/f2d2667d-9eb6-4b80-ba17-d53072a7db0c/Important IEC -1-28.pdf' out = '/home/daytona/workspace/Important_IEC_trimmed.pdf' reader = PdfReader(src) writer = PdfWriter() # Keep pages 1-20 (index 0-19), remove pages 21-28 (Annexure 1, 2 + Kannada pages) for i in range(20): writer.add_page(reader.pages[i]) with open(out, 'wb') as f: writer.write(f) print(f'Done. Output has {len(writer.pages)} pages.') "

Done. The new PDF has been created with only pages 1–20, removing:
  • Annexure 1 (English) — pages 21–23
  • Annexure 2 (English) — page 24
  • Kannada pages (Annexure 1 & 2 in Kannada) — pages 25–28
Download your trimmed document here:

Important IEC trimmed

PDF Document · PDF

Those I. want into single doc not this pdf trimmwed one into new doc

You want the cut pages (Annexure 1, Annexure 2, and Kannada pages) extracted into a new separate PDF. Let me do that.
Running Command

python3 -c " from pypdf import PdfReader, PdfWriter src = '/home/daytona/workspace/attachments/f2d2667d-9eb6-4b80-ba17-d53072a7db0c/Important IEC -1-28.pdf' out = '/home/daytona/workspace/Annexure_1_2_Kannada.pdf' reader = PdfReader(src) writer = PdfWriter() # Extract pages 21-28 (index 20-27): Annexure 1, 2 (English) + Kannada pages for i in range(20, 28): writer.add_page(reader.pages[i]) with open(out, 'wb') as f: writer.write(f) print(f'Done. Output has {len(writer.pages)} pages.') "

Done! The 8 pages (Annexure 1, Annexure 2 in English + both in Kannada) are now in a single new document:

Annexure 1 2 Kannada

PDF Document · PDF

Add proforma also and even one page with kananda line add up to before page

Let me first check which pages are the "proforma" and the Kannada page with just one line, so I include the right ones.
Running Command

python3 -c " from pypdf import PdfReader reader = PdfReader('/home/daytona/workspace/attachments/f2d2667d-9eb6-4b80-ba17-d53072a7db0c/Important IEC -1-28.pdf') print(f'Total pages: {len(reader.pages)}') for i in range(len(reader.pages)): text = reader.pages[i].extract_text() snippet = text[:200].replace('\n', ' ') if text else '[no text]' print(f'Page {i+1}: {snippet}') print('---') "

Now I can see:
  • Proforma pages: 18 & 19 (page 18 mentions "Proforma/questionnaires", page 19 has the data recording form)
  • Page 27 = single-line Kannada page ("ಈ ಅಧ್ಯಯನದಲ್ಲಿ ಭಾಗವಹಿಸಲು ಪರಿಗಣಿಸಿದ್ದಕ್ಕಾಗಿ ಧನ್ಯವಾದಗಳು") — this needs to go before page 28
So the new doc should be: Pages 18, 19, 21–28 with page 27 already in correct order before 28.
Running Command

python3 -c " from pypdf import PdfReader, PdfWriter src = '/home/daytona/workspace/attachments/f2d2667d-9eb6-4b80-ba17-d53072a7db0c/Important IEC -1-28.pdf' out = '/home/daytona/workspace/Annexure_Proforma_Kannada.pdf' reader = PdfReader(src) writer = PdfWriter() # Pages to include (0-indexed): # Proforma: pages 18, 19 (index 17, 18) # Annexure 1 English: pages 21-23 (index 20, 21, 22) # Annexure 2 English: page 24 (index 23) # Kannada pages: 25, 26, 27, 28 (index 24, 25, 26, 27) # Page 27 (index 26) is already before page 28 (index 27) — correct order pages_to_include = [17, 18, 20, 21, 22, 23, 24, 25, 26, 27] for i in pages_to_include: writer.add_page(reader.pages[i]) print(f'Added page {i+1}') with open(out, 'wb') as f: writer.write(f) print(f'Done. Output has {len(writer.pages)} pages.') "

Done! The new 10-page document contains:
New PageOriginalContent
118Proforma / questionnaires intro
219Proforma data recording form
321Annexure 1 – Participant Info Sheet
422Annexure 1 (cont.)
523Annexure 1 (cont.)
624Annexure 2 – Informed Consent
725Kannada Annexure 1
826Kannada Annexure 1 (cont.)
927Kannada single-line page (before last)
1028Kannada Annexure 2

Annexure Proforma Kannada

PDF Document · PDF

This is a shared conversation. Sign in to Orris to start your own chat.