import fitz

doc = fitz.open(r'c:\fuentes\proyectos delphi\RAUL_ASENCIO\GESTION\documentacion raul asencio\guion_podcast_gustavo_ernesto_horizontal.pdf')

for i, page in enumerate(doc):
    # Check text bounding boxes vs page rect
    rect = page.rect
    blocks = page.get_text('blocks')
    for b in blocks:
        # b: (x0, y0, x1, y1, text, block_no, block_type)
        if b[3] > rect.height - 5: # text within 5pt of bottom
            print(f"Warning: Page {i+1} has text near bottom: y1={b[3]:.1f} (page height {rect.height:.1f})")
        if b[2] > rect.width - 5:
            print(f"Warning: Page {i+1} has text near right: x1={b[2]:.1f} (page width {rect.width:.1f})")

print("Bounding box check completed.")
