MCPcopy Create free account

hub / github.com/pymupdf/pymupdf4llm / functions

Functions159 in github.com/pymupdf/pymupdf4llm

↓ 12 callersFunctionbbox_is_empty
(bbox)
pymupdf4llm/pymupdf4llm/helpers/utils.py:210
↓ 9 callersFunctionintersect_rects
(r1, r2, bbox_only=False)
pymupdf4llm/pymupdf4llm/helpers/utils.py:214
↓ 8 callersFunctionoutside_bbox
(bbox, cell, strict=False)
pymupdf4llm/pymupdf4llm/helpers/utils.py:246
↓ 7 callersFunctionget_styled_text
Output text with markdown style codes based on font properties. Parameter is a list of span dictionaries. The spans may come from one or more
pymupdf4llm/pymupdf4llm/helpers/document_layout.py:388
↓ 6 callersFunctionis_white
Identify white text.
pymupdf4llm/pymupdf4llm/helpers/utils.py:205
↓ 5 callersFunctionget_plain_text
Output text without any markdown or other styling. Parameter is a list of span dictionaries. The spans may come from one or more original "tex
pymupdf4llm/pymupdf4llm/helpers/document_layout.py:220
↓ 5 callersFunctionget_raw_lines
Extract the text spans from a TextPage in natural reading sequence. All spans roughly on the same line are joined to generate an improved line.
pymupdf4llm/pymupdf4llm/helpers/get_text_lines.py:27
↓ 5 callersMethodto_markdown
Serialize ParsedDocument to markdown text.
pymupdf4llm/pymupdf4llm/helpers/document_layout.py:675
↓ 4 callersFunctionProgressBar
(list: List[Any], progress_width: int = 40)
pymupdf4llm/pymupdf4llm/helpers/progress.py:87
↓ 4 callersFunctionin_bbox_using_cache
Return 1-based number if a bbox contains bb, else return 0.
pymupdf4llm/pymupdf4llm/helpers/multi_column.py:107
↓ 4 callersFunctionis_superscripted
(line)
pymupdf4llm/pymupdf4llm/helpers/document_layout.py:205
↓ 4 callersFunctionomit_if_pua_char
Check if character is in the Private Use Area (PUA) of Unicode.
pymupdf4llm/pymupdf4llm/helpers/document_layout.py:116
↓ 4 callersFunctionoutside_all_bboxes
Check if rect is outside all rects in the list.
pymupdf4llm/pymupdf4llm/helpers/pymupdf_rag.py:758
↓ 4 callersFunctionsave_image
Optionally render the rect part of a page. We will ignore images that are empty or that have an edge smaller than x% of the correspon
pymupdf4llm/pymupdf4llm/helpers/pymupdf_rag.py:476
↓ 4 callersFunctionsuppress
(mask, dy1, dx1, dy2, dx2)
pymupdf4llm/pymupdf4llm/helpers/image_quality.py:290
↓ 3 callersFunction_get_test_file_path
(file_name: str, __file__: str = __file__)
tests/pymupdf4llm/llama_index/test_pdf_markdown_reader.py:20
↓ 3 callersFunctionalmost_in_bbox
(bbox, clip, portion=0.8)
pymupdf4llm/pymupdf4llm/helpers/utils.py:230
↓ 3 callersFunctioncluster_substripe
(substripe)
pymupdf4llm/pymupdf4llm/helpers/utils.py:725
↓ 3 callersFunctionfind
(x)
pymupdf4llm/pymupdf4llm/helpers/image_quality.py:211
↓ 3 callersFunctionin_bbox
Return 1-based number if a bbox contains bb, else return 0.
pymupdf4llm/pymupdf4llm/helpers/multi_column.py:100
↓ 3 callersMethodload_data
Loads list of documents from PDF file and also accepts extra information in dict format. Args: file_path (Union[Path, str]): The
pymupdf4llm/pymupdf4llm/llama/pdf_markdown_reader.py:28
↓ 3 callersFunctionparse_document
( doc, filename="", image_dpi=150, image_format="png", image_path="",
pymupdf4llm/pymupdf4llm/__init__.py:28
↓ 3 callersFunctionwrite_text
Output the text found inside the given clip. This is an alternative for plain text in that it outputs text enriched with markdown sty
pymupdf4llm/pymupdf4llm/helpers/pymupdf_rag.py:508
↓ 2 callersFunctionadjust_width
Compute a matrix to adjust the width of the rendered text.
pymupdf4llm/pymupdf4llm/ocr/rapidocr_api.py:31
↓ 2 callersFunctionbbox_in_bbox
Check if 'inner' rectangle is contained within 'outer' rectangle.
pymupdf4llm/pymupdf4llm/helpers/utils.py:265
↓ 2 callersFunctioncan_extend
Determines whether rectangle 'temp' can be extended by 'bb' without intersecting any of the rectangles contained in 'bboxlist' or 'ver
pymupdf4llm/pymupdf4llm/helpers/multi_column.py:128
↓ 2 callersFunctioncolumn_boxes
Determine bboxes which wrap a column on the page. Args: footer_margin: ignore text if distance from bottom is less header_margin:
pymupdf4llm/pymupdf4llm/helpers/multi_column.py:74
↓ 2 callersFunctionconvolve2d
2D convolution (cross-correlation) with reflect padding. Vectorized over kernel (no pixel loops).
pymupdf4llm/pymupdf4llm/helpers/image_quality.py:56
↓ 2 callersFunctioncreate_list_item_levels
Map the layout box number of each list-item to its hierarchy level. Args: layout_info (list): the bbox list "page.layout_information"
pymupdf4llm/pymupdf4llm/helpers/document_layout.py:130
↓ 2 callersFunctionextract_cells
Extract text from a rect-like 'cell' as plain or MD styled text. This function should ultimately be used to extract text from a table cell. M
pymupdf4llm/pymupdf4llm/helpers/utils.py:1055
↓ 2 callersFunctionfootnote_to_md
Convert "footnote" bboxes to markdown. The first line is prefixed with "> ". Subsequent lines are appended without line break if they do
pymupdf4llm/pymupdf4llm/helpers/document_layout.py:509
↓ 2 callersFunctionfootnote_to_text
Convert "footnote" bboxes to text.
pymupdf4llm/pymupdf4llm/helpers/document_layout.py:280
↓ 2 callersFunctionis_monospaced
Detect text bboxes with all mono-spaced lines. Returns True if all lines are mono-spaced. This may be used to output code blocks.
pymupdf4llm/pymupdf4llm/helpers/document_layout.py:187
↓ 2 callersFunctionmake_page_chunk
Create a page chunk dictionary for output. Args: doc: the ParsedDocument object page: the PageLayout object text: the pag
pymupdf4llm/pymupdf4llm/helpers/document_layout.py:72
↓ 2 callersFunctionoutput_images
Output images and graphics above text rectangle.
pymupdf4llm/pymupdf4llm/helpers/pymupdf_rag.py:817
↓ 2 callersFunctionoutput_tables
Output tables above given text rectangle.
pymupdf4llm/pymupdf4llm/helpers/pymupdf_rag.py:768
↓ 2 callersFunctionsanitize_spans
Sort and join the spans in a re-synthesized line. The PDF may contain "broken" text with words cut into pieces. This funtion joins sp
pymupdf4llm/pymupdf4llm/helpers/get_text_lines.py:70
↓ 2 callersFunctionstartswith_bullet
(text)
pymupdf4llm/pymupdf4llm/helpers/utils.py:193
↓ 2 callersFunctionto_markdown
Process the document and return the text of the selected pages. Args: doc: pymupdf.Document or string. pages: list of page number
pymupdf4llm/pymupdf4llm/helpers/pymupdf_rag.py:322
↓ 1 callersMethod__call__
(self, file: str)
examples/GUI/browser-app.py:81
↓ 1 callersMethod_process_doc_meta
Processes metas of a PDF document.
pymupdf4llm/pymupdf4llm/llama/pdf_markdown_reader.py:93
↓ 1 callersMethod_process_doc_page
Processes a single page of a PDF document.
pymupdf4llm/pymupdf4llm/llama/pdf_markdown_reader.py:70
↓ 1 callersFunctionadjust_width
Compute matrix to adjust the width of the rendered text.
pymupdf4llm/pymupdf4llm/ocr/rapidtess_api.py:79
↓ 1 callersFunctionanalyze_image
Carry out all four checks and calculate the weighted score. img_gray: 2D uint8 array.
pymupdf4llm/pymupdf4llm/helpers/image_quality.py:387
↓ 1 callersFunctionanalyze_page
Analyze the page for the OCR decision. Args: blocks: output of page.get_text("dict") if already available Returns: A dict wit
pymupdf4llm/pymupdf4llm/helpers/utils.py:287
↓ 1 callersFunctionbbox_in_any_bbox
Check if rect is contained in a rect of the list.
pymupdf4llm/pymupdf4llm/helpers/pymupdf_rag.py:754
↓ 1 callersMethodbuild_chain
(self, file: str)
examples/GUI/browser-app.py:99
↓ 1 callersFunctioncanny_numpy
Complete Canny edge detector, NumPy-only.
pymupdf4llm/pymupdf4llm/helpers/image_quality.py:367
↓ 1 callersFunctionclean_nblocks
Do some elementary cleaning.
pymupdf4llm/pymupdf4llm/helpers/multi_column.py:149
↓ 1 callersFunctioncluster_columns_in_stripe
Within a stripe, group boxes into columns based on horizontal proximity. We use a small horizontal gap threshold to decide when a new column
pymupdf4llm/pymupdf4llm/helpers/utils.py:711
↓ 1 callersFunctioncluster_stripes
Divide page into horizontal stripes based on vertical gaps. Args: boxes (list): List of bounding boxes. joined_boxes: rectan
pymupdf4llm/pymupdf4llm/helpers/utils.py:622
↓ 1 callersFunctioncode_block_to_md
Output a code block in markdown format.
pymupdf4llm/pymupdf4llm/helpers/document_layout.py:567
↓ 1 callersFunctioncode_block_to_text
Output a code block in plain text format. Basic difference is that lines are separated by line breaks.
pymupdf4llm/pymupdf4llm/helpers/document_layout.py:306
↓ 1 callersFunctioncomponents_check
Connected Components (Union-Find) 8-connectivity Connected Components, Union-Find-based two-pass approach. binary_img: 0 background, !=0
pymupdf4llm/pymupdf4llm/helpers/image_quality.py:195
↓ 1 callersFunctioncompute_reading_order
Compute reading order of boxes delivered by PyMuPDF-Layout. Args: boxes (list): List of bounding boxes. vertical_gap (float)
pymupdf4llm/pymupdf4llm/helpers/utils.py:784
↓ 1 callersFunctiondivider
Create a rectangle of full box width. Its height equals vertical_gap and its top equals y.
pymupdf4llm/pymupdf4llm/helpers/utils.py:655
↓ 1 callersFunctionedge_density_check
Edge density: mean(edges)/255.0, expects 0/255 image.
pymupdf4llm/pymupdf4llm/helpers/image_quality.py:378
↓ 1 callersFunctionentropy_check
ENTROPY CHECK Shannon entropy via 256-bin histogram.
pymupdf4llm/pymupdf4llm/helpers/image_quality.py:128
↓ 1 callersFunctionexpanded
(b)
pymupdf4llm/pymupdf4llm/helpers/utils.py:750
↓ 1 callersFunctionextract_text_from_pdf
Read table content only of all pages in the document. Chatbots typically have limitations on the amount of data that can can be passed in (nu
examples/country-capitals/country-capitals.py:31
↓ 1 callersFunctionfallback_text_to_md
Convert text extracted from images to markdown format.
pymupdf4llm/pymupdf4llm/helpers/document_layout.py:616
↓ 1 callersFunctionfallback_text_to_text
Convert text extracted from unrecognized tables. We hope for some sort of table structure being present in the text spans: The maximum span c
pymupdf4llm/pymupdf4llm/helpers/document_layout.py:359
↓ 1 callersFunctionfft_check
FFT-Ratio Check: Low-Frequency-Ratio in FFT spectrum. Expects arbitrary size; internally rescaled to 128x128.
pymupdf4llm/pymupdf4llm/helpers/image_quality.py:141
↓ 1 callersFunctionfilter_contained
Remove boxes that are fully contained within another box.
pymupdf4llm/pymupdf4llm/helpers/utils.py:837
↓ 1 callersFunctionfilter_small_images
(page, parms, image_size_limit)
pymupdf4llm/pymupdf4llm/helpers/pymupdf_rag.py:1300
↓ 1 callersFunctionfind_virtual_lines
Return virtual lines for a given table bbox. This utility looks for: * horizontal non-stroke vectors and uses their top and bottom edges
pymupdf4llm/pymupdf4llm/helpers/utils.py:936
↓ 1 callersFunctiongaussian_blur
Separable Gaussian Blur: first horizontal, then vertical.
pymupdf4llm/pymupdf4llm/helpers/image_quality.py:90
↓ 1 callersFunctiongaussian_kernel_1d
1D Gaussian kernel, normalized.
pymupdf4llm/pymupdf4llm/helpers/image_quality.py:80
↓ 1 callersFunctiongenerate_response_with_chatgpt
(prompt)
examples/country-capitals/country-capitals.py:95
↓ 1 callersFunctionget_bg_color
Determine the background color of the page. The function returns a PDF RGB color triple or None. We check the color of 10 x 10 pixel
pymupdf4llm/pymupdf4llm/helpers/pymupdf_rag.py:878
↓ 1 callersFunctionget_metadata
(doc, pno)
pymupdf4llm/pymupdf4llm/helpers/pymupdf_rag.py:918
↓ 1 callersFunctionget_page_image
Determine whether the page contains text worthwhile to OCR. Args: page: PyMuPDF Page object dpi: DPI used for rasterization *if*
pymupdf4llm/pymupdf4llm/helpers/check_ocr.py:72
↓ 1 callersFunctionget_page_output
Process one page. Args: doc: pymupdf.Document pno: 0-based page number textflags: text extraction flag bi
pymupdf4llm/pymupdf4llm/helpers/pymupdf_rag.py:951
↓ 1 callersFunctionget_span_ocr
Return OCR'd span text using Tesseract. Args: page: pymupdf Page bbox: pymupdf Rect or its sequence dpi: resolution for O
pymupdf4llm/pymupdf4llm/helpers/check_ocr.py:17
↓ 1 callersFunctionget_text
Use Tesseract to extract text from a given bounding box of the pixmap. The irect is expected to contain one line only, so we use tessedit_pag
pymupdf4llm/pymupdf4llm/ocr/rapidtess_api.py:41
↓ 1 callersFunctionget_text_lines
Extract text by line keeping natural reading sequence. Notes: Internally uses "dict" to select lines and their spans. Returns pla
pymupdf4llm/pymupdf4llm/helpers/get_text_lines.py:197
↓ 1 callersFunctionhysteresis_thresholding
Hysteresis with iterative neighborhood activation, vectorized.
pymupdf4llm/pymupdf4llm/helpers/image_quality.py:312
↓ 1 callersFunctionintersects_bboxes
Return True if a bbox touches bb, else return False.
pymupdf4llm/pymupdf4llm/helpers/multi_column.py:124
↓ 1 callersFunctionis_contained
Check if inner box is fully contained within outer box.
pymupdf4llm/pymupdf4llm/helpers/utils.py:826
↓ 1 callersFunctionis_multi_column_layout
Check if the boxes have a clean multi-column layout. If False, the boxes represent only 1 column Used to early exit from stripe clust
pymupdf4llm/pymupdf4llm/helpers/utils.py:636
↓ 1 callersFunctionis_significant
Check whether the rectangle "box" contains 'signifiant' drawings. This means that some path is contained in the "interior" of box. To this en
pymupdf4llm/pymupdf4llm/helpers/pymupdf_rag.py:264
↓ 1 callersFunctionis_white
Check for relevant text.
pymupdf4llm/pymupdf4llm/helpers/multi_column.py:96
↓ 1 callersFunctionjoin_rects_phase2
Postprocess identified text blocks, phase 2. Increase the width of each text block so that small left or right border differences are
pymupdf4llm/pymupdf4llm/helpers/multi_column.py:213
↓ 1 callersFunctionjoin_rects_phase3
(bboxes, path_rects, cache)
pymupdf4llm/pymupdf4llm/helpers/multi_column.py:251
↓ 1 callersFunctionlist_item_to_md
Convert "list-item" bboxes to markdown. The first line is prefixed with "- ". Subsequent lines are appended without line break if their r
pymupdf4llm/pymupdf4llm/helpers/document_layout.py:452
↓ 1 callersFunctionlist_item_to_text
Convert "list-item" bboxes to text.
pymupdf4llm/pymupdf4llm/helpers/document_layout.py:243
↓ 1 callersFunctionmake_vertical
(table_bbox, line_bbox, word_boxes)
pymupdf4llm/pymupdf4llm/helpers/utils.py:946
↓ 1 callersFunctionmax_header_id
(spans, page)
pymupdf4llm/pymupdf4llm/helpers/pymupdf_rag.py:448
↓ 1 callersFunctionnonmax_suppression
Non-Maximum Suppression, mostly vectorized.
pymupdf4llm/pymupdf4llm/helpers/image_quality.py:271
↓ 1 callersFunctionotsu_threshold
Otsu Threshold Otsu thresholding, NumPy-only.
pymupdf4llm/pymupdf4llm/helpers/image_quality.py:160
↓ 1 callersFunctionpage_is_ocr
Check if page exclusivley contains OCR text. For this to be true, all text must be written as "ignore-text".
pymupdf4llm/pymupdf4llm/helpers/pymupdf_rag.py:865
↓ 1 callersFunctionparse_document
( doc, filename="", image_dpi=150, ocr_dpi=300, image_format="png", image_path="",
pymupdf4llm/pymupdf4llm/helpers/document_layout.py:900
↓ 1 callersFunctionpicture_text_to_md
Convert text extracted from images to markdown format.
pymupdf4llm/pymupdf4llm/helpers/document_layout.py:604
↓ 1 callersFunctionpicture_text_to_text
Convert text extracted from images to plain text format.
pymupdf4llm/pymupdf4llm/helpers/document_layout.py:347
↓ 1 callersMethodprocess_file
(self, file: str)
examples/GUI/browser-app.py:87
↓ 1 callersFunctionrefine_boxes
Join any rectangles with a pairwise non-empty overlap. Accepts and returns a list of Rect items. Note that rectangles that only "touch" each
pymupdf4llm/pymupdf4llm/helpers/pymupdf_rag.py:229
↓ 1 callersFunctionresize_bilinear
Bilinear resize (similar to OpenCV INTER_LINEAR), vectorized. img: 2D uint8/float32, shape (H, W)
pymupdf4llm/pymupdf4llm/helpers/image_quality.py:20
↓ 1 callersFunctionresolve_links
Accept a span and return a markdown link string. Args: links: a list as returned by page.get_links() span: a span dic
pymupdf4llm/pymupdf4llm/helpers/pymupdf_rag.py:456
↓ 1 callersFunctionsection_hdr_to_md
Convert "section-header" bboxes to markdown. This is treated as a level 2 header (##). The line text itself is handled like normal text.
pymupdf4llm/pymupdf4llm/helpers/document_layout.py:537
↓ 1 callersFunctionsimplify_vectors
Join vectors that are horizontally adjacent and vertically aligned.
pymupdf4llm/pymupdf4llm/helpers/utils.py:908
next →1–100 of 159, ranked by callers