Spaces:
Sleeping
Sleeping
File size: 656 Bytes
72fbd66 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
import pdfplumber
def extract_text_from_pdf(pdf_path):
text = ""
with pdfplumber.open(pdf_path) as pdf:
for page in pdf.pages:
page_text = page.extract_text()
if page_text:
text += page_text + "\n"
return text
def save_text_to_file(text, output_path):
with open(output_path, "w", encoding="utf-8") as f:
f.write(text)
# === Usage ===
pdf_path = "resume.pdf" # Your input PDF
output_path = "resume.txt" # Output text file
resume_text = extract_text_from_pdf(pdf_path)
save_text_to_file(resume_text, output_path)
print(f"✅ Extracted text saved to {output_path}") |