Skip to content

AnswerDotAI/fastfitz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fastfitz

fastfitz adds a small ergonomic layer over PyMuPDF: page-tagged text extraction, document-level search returning (page, rects) pairs, and search-driven visual previews (pg.preview('some clause') renders just the matched region). Pages get a _repr_png_, so a bare Page expression displays itself in any rich frontend – Jupyter, solveit, or an AI-driven kernel.

License

PyMuPDF is AGPL-3.0, and therefore fastfitz is AGPL-3.0 too. Installing it is an explicit opt-in to that license; if AGPL doesn’t work for your use, Artifex sells commercial PyMuPDF licenses, or see permissively-licensed alternatives like pypdfium2.

Install

pip install fastfitz

fastfitz also registers a pyskill, so AI kernels with pyskills discovery gain PDF viewing automatically when fastfitz is installed.

Quick start

import fitz
from fastfitz.core import *

pdf = fitz.open('some.pdf')
print(pdf.text(pages=[0]))                # cheap first: page-tagged text
hits = pdf.search_for('Delaware')         # [(page, rects)] across the document
hits[0][0].preview('Delaware')            # render just the matched region
pdf[0]                                    # bare page displays itself

About

An ergonomic, fastai-style wrapper over PyMuPDF (fitz) for reading, searching, and visually previewing PDFs

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Packages

 
 
 

Contributors