Validate input PDF and return resolved path.
(input_str: str)
| 166 | |
| 167 | |
| 168 | def validate_input(input_str: str) -> str: |
| 169 | """Validate input PDF and return resolved path.""" |
| 170 | path = Path(input_str) |
| 171 | if not path.exists(): |
| 172 | raise FileNotFoundError(f"Input file not found: {input_str}") |
| 173 | if path.suffix.lower() != ".pdf": |
| 174 | raise ValueError(f"Expected PDF file, got {path.suffix}") |
| 175 | return str(path.resolve()) |
| 176 | |
| 177 | |
| 178 | def create_output_dir(args) -> Path: |