-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path01_inspect.py
More file actions
46 lines (34 loc) · 1.41 KB
/
Copy path01_inspect.py
File metadata and controls
46 lines (34 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
"""
01 - Inspect a PDF (license-free).
Reads metadata, fonts, page dimensions, encryption status, and form field counts
without requiring a license. Useful for diagnostics, file triage, or anywhere you
need to know what's inside a PDF before deciding what to do with it.
Run:
python examples/01_inspect.py
"""
from _common import header, info, success, get_sample_pdf, init_license
import exis_pdfeditor
def main() -> None:
init_license()
header("Demo 01 - Inspect a PDF (license-free)")
sample = get_sample_pdf()
info(f"Inspecting: {sample}")
result = exis_pdfeditor.inspect(str(sample))
success(f"PDF version: {result.version}")
success(f"Page count: {result.pageCount}")
success(f"Title: {result.title or '(none)'}")
success(f"Producer: {result.producer or '(none)'}")
success(f"Encrypted: {result.isEncrypted}")
success(f"Has forms: {result.hasFormFields} ({result.formFieldCount} fields)")
success(f"Signed: {result.hasDigitalSignatures}")
success(f"Fonts used: {', '.join(result.fontsUsed) if result.fontsUsed else '(none)'}")
print()
info("First 5 pages:")
for page in result.pages[:5]:
print(
f" Page {page.pageNumber}: "
f"{page.widthInPoints:.0f}x{page.heightInPoints:.0f} pt, "
f"{page.characterCount} chars"
)
if __name__ == "__main__":
main()