import pymupdf import sys import re sys.stdout.reconfigure(encoding='utf-8') doc = pymupdf.open("resources/knowledge/original/행정규칙/임도 품셈 적용기준 (현 산림사업 표준품셈)/첨부/(산림청고시 제2025-82호) 산림사업 표준품셈.pdf") # Search by regex or partial print("=== Search for 천공기 휘발유 (F0046) ===") for pno in range(30, 60): text = doc[pno].get_text() if "천공기" in text and ("휘발유" in text or "주연료" in text or "95%" in text): print(f"Found F0046 on PDF Page {pno + 1}:") for line in text.splitlines(): if any(k in line for k in ["천공", "주연료", "휘발유", "잡품"]): print(" ", line) print("\n=== Search for 작업로 선정 (F0076) & 작업로 설치 (F0077) ===") for pno in range(45, 65): text = doc[pno].get_text() if "작업로" in text and ("선정" in text or "설치" in text or "1km" in text): print(f"Found on PDF Page {pno + 1}:") for line in text.splitlines(): if any(k in line for k in ["작업로", "선정", "설치", "km", "소요인력"]): print(" ", line)