sdkagent

pymupdf API reference

121 public APIs from pymupdf (pymupdf/pymupdf) — 4 classes, 105 functions, 12 methods. Signatures extracted by static analysis of the actual source.

Repository: pymupdf/pymupdf

KindCount
Classes4
Functions105
Methods12

API list

funcsrc.__main__.doc_join(args)
Join pages from several PDF documents.
funcsrc.__main__.embedded_add(args)
Insert a new embedded file.
funcsrc.__main__.embedded_copy(args)
Copy embedded files between PDFs.
funcsrc.__main__.embedded_del(args)
Delete an embedded file entry.
funcsrc.__main__.embedded_get(args)
Retrieve contents of an embedded file.
funcsrc.__main__.embedded_list(args)
List embedded files.
funcsrc.__main__.extract_objects(args)
Extract images and / or fonts from a PDF.
funcsrc.__main__.find_line_index(values:List[int], value:int) -> int
Find the right row coordinate.
funcsrc.__main__.joinligature(lig:str) -> str
Return ligature character for a given pair / triple of characters.
funcsrc.__main__.main()
Define command configurations.
funcsrc.__main__.make_textline(left, slot, minslot, lchars)
Produce the text of one output line.
funcsrc.__main__.open_file(filename, password, show=False, pdf=True)
Open and authenticate a document.
funcsrc.__main__.print_dict(item)
Print a Python dictionary.
funcsrc.__main__.print_xref(doc, xref)
Print an object given by XREF number.
funcsrc.__main__.recoverpix(doc, item)
Return image for a given XREF.
funcsrc.table.Table.row_has_bold(bbox)
Check if a row contains some bold text.
classsrc.table.TableFinder
Given a PDF page, find plausible table structures.
classsrc.table.TableHeader
PyMuPDF extension containing the identified table header.
classsrc.table.WordMap
A WordMap maps words->chars.
funcsrc.table.are_neighbors(r1, r2)
Detect whether r1, r2 are neighbors.
funcsrc.table.is_parallel(p1, p2)
Check if line is roughly axis-parallel.
funcsrc.table.make_chars(page, clip=None)
Extract text as "rawdict" to fill CHARS.
funcsrc.table.obj_to_bbox(obj)
Return the bounding box for an object.
funcsrc.table.page_rotation_set0(page)
Nullify page rotation.
funcsrc.utils.construct_label(style, prefix, pno) -> str
Construct a label based on style, prefix and page number.
funcsrc.utils.full_ocr(page, dpi, language, flags)
Perform OCR for the full page image.
funcsrc.utils.getColor(name:str) -> tuple
Retrieve RGB color in PDF format by name.
funcsrc.utils.getColorHSV(name:str) -> tuple
Retrieve the hue, saturation, value triple of a color name.
funcsrc.utils.getColorList() -> list
Returns a list of upper-case colour names.
funcsrc.utils.getDestStr(xref:int, ddict:dict) -> str
Calculate the PDF action string.
funcsrc.utils.get_label_pno(pgNo, labels)
Return the label for this page number.
funcsrc.utils.get_sorted_text(page:pymupdf.Page, clip:rect_like=None, flags:OptInt=None, textpage:pymupdf.TextPage=None, tolerance=3) -> str
Extract plain text avoiding unacceptable line breaks.
funcsrc.utils.get_text_blocks(page:pymupdf.Page, clip:rect_like=None, flags:OptInt=None, textpage:pymupdf.TextPage=None, sort:bool=False) -> list
Return the text blocks on a page.
funcsrc.utils.get_textpage_ocr(page:pymupdf.Page, flags:int=0, language:str='eng', dpi:int=72, full:bool=False, tessdata:str=None) -> pymupdf.TextPage
Create a Textpage from the OCR version of the page.
funcsrc.utils.integerToLetter(i) -> str
Returns letter sequence string for integer i.
funcsrc.utils.integerToRoman(num:int) -> str
Return roman numeral for an integer.
funcsrc.utils.line_text(clip, line)
Create the string of one text line.
funcsrc.utils.recover_bbox_quad(line_dir:tuple, span:dict, bbox:tuple) -> pymupdf.Quad
Compute the quad located inside the bbox.
funcsrc.utils.recover_char_quad(line_dir:tuple, span:dict, char:dict) -> pymupdf.Quad
Recover the quadrilateral of a text character.
funcsrc.utils.recover_line_quad(line:dict, spans:list=None) -> pymupdf.Quad
Calculate the line quad for 'dict' / 'rawdict' text extractions.
funcsrc.utils.recover_quad(line_dir:tuple, span:dict) -> pymupdf.Quad
Recover the quadrilateral of a text span.
funcsrc.utils.recover_span_quad(line_dir:tuple, span:dict, chars:list=None) -> pymupdf.Quad
Calculate the span quad for 'dict' / 'rawdict' text extractions.
funcsrc.utils.rule_dict(item)
Make a Python dict from a PDF page label rule.
funcsrc_classic.__main__.doc_join(args)
Join pages from several PDF documents.
funcsrc_classic.__main__.embedded_add(args)
Insert a new embedded file.
funcsrc_classic.__main__.embedded_copy(args)
Copy embedded files between PDFs.
funcsrc_classic.__main__.embedded_del(args)
Delete an embedded file entry.
funcsrc_classic.__main__.embedded_get(args)
Retrieve contents of an embedded file.
funcsrc_classic.__main__.embedded_list(args)
List embedded files.
funcsrc_classic.__main__.find_line_index(values:List[int], value:int) -> int
Find the right row coordinate.
funcsrc_classic.__main__.joinligature(lig:str) -> str
Return ligature character for a given pair / triple of characters.
funcsrc_classic.__main__.main()
Define command configurations.
funcsrc_classic.__main__.open_file(filename, password, show=False, pdf=True)
Open and authenticate a document.
funcsrc_classic.__main__.print_dict(item)
Print a Python dictionary.
funcsrc_classic.__main__.print_xref(doc, xref)
Print an object given by XREF number.
funcsrc_classic.__main__.recoverpix(doc, item)
Return image for a given XREF.
classsrc_classic.utils.Shape
Create a new shape.
methodsrc_classic.utils.Shape.commit(overlay:bool=True) -> None
Update the page's /Contents object with Shape data.
methodsrc_classic.utils.Shape.draw_bezier(p1:point_like, p2:point_like, p3:point_like, p4:point_like) -> Point
Draw a standard cubic Bezier curve.
methodsrc_classic.utils.Shape.draw_circle(center:point_like, radius:float) -> Point
Draw a circle given its center and radius.
methodsrc_classic.utils.Shape.draw_curve(p1:point_like, p2:point_like, p3:point_like) -> Point
Draw a curve between points using one control point.
methodsrc_classic.utils.Shape.draw_line(p1:point_like, p2:point_like) -> Point
Draw a line between two points.
methodsrc_classic.utils.Shape.draw_oval(tetra:typing.Union[quad_like, rect_like]) -> Point
Draw an ellipse inside a tetrapod.
methodsrc_classic.utils.Shape.draw_polyline(points:list) -> Point
Draw several connected line segments.
methodsrc_classic.utils.Shape.draw_quad(quad:quad_like) -> Point
Draw a Quad.
methodsrc_classic.utils.Shape.draw_rect(rect:rect_like, *radius=None) -> Point
Draw a rectangle.
methodsrc_classic.utils.Shape.draw_sector(center:point_like, point:point_like, beta:float, fullSector:bool=True) -> Point
Draw a circle sector.
methodsrc_classic.utils.Shape.draw_squiggle(p1:point_like, p2:point_like, breadth=2) -> Point
Draw a squiggly line from p1 to p2.
methodsrc_classic.utils.Shape.draw_zigzag(p1:point_like, p2:point_like, breadth:float=2) -> Point
Draw a zig-zagged line from p1 to p2.
funcsrc_classic.utils.Shape.pixlen(x)
Calculate pixel length of x.
funcsrc_classic.utils.apply_redactions(page:Page, images:int=2) -> bool
Apply the redaction annotations of the page.
funcsrc_classic.utils.build_subset(buffer, unc_set, gid_set)
Build font subset using fontTools.
funcsrc_classic.utils.construct_label(style, prefix, pno) -> str
Construct a label based on style, prefix and page number.
funcsrc_classic.utils.del_toc_item(doc:Document, idx:int) -> None
Delete TOC / bookmark item by index.
funcsrc_classic.utils.delete_image(page:Page, xref:int)
Delete the image referred to by xef.
funcsrc_classic.utils.delete_widget(page:Page, widget:Widget) -> Widget
Delete widget from page and return the next one.
funcsrc_classic.utils.draw_quad(page:Page, quad:quad_like, color:OptSeq=(0,), fill:OptSeq=None, dashes:OptStr=None, width:float=1, lineCap:int=0, lineJoin:int=0, morph:OptSeq=None, overlay:bool=True, stroke_opacity:float=1, fill_opacity:float=1, oc:int=0) -> Point
Draw a quadrilateral.
funcsrc_classic.utils.draw_rect(page:Page, rect:rect_like, color:OptSeq=(0,), fill:OptSeq=None, dashes:OptStr=None, width:float=1, lineCap:int=0, lineJoin:int=0, morph:OptSeq=None, overlay:bool=True, stroke_opacity:float=1, fill_opacity:float=1, oc:int=0, radius=None) -> Point
Draw a rectangle.
funcsrc_classic.utils.getColor(name:str) -> tuple
Retrieve RGB color in PDF format by name.
funcsrc_classic.utils.getColorHSV(name:str) -> tuple
Retrieve the hue, saturation, value triple of a color name.
funcsrc_classic.utils.getColorInfoList() -> list
Returns the list of colour name/value tuples used by this module.
funcsrc_classic.utils.getColorList() -> list
Returns a list of just the colour names used by this module.
funcsrc_classic.utils.getDestStr(xref:int, ddict:dict) -> str
Calculate the PDF action string.
funcsrc_classic.utils.get_area(*args) -> float
Calculate area of rectangle.
funcsrc_classic.utils.get_char_widths(doc:Document, xref:int, limit:int=256, idx:int=0, fontdict:OptDict=None) -> list
Get list of glyph information of a font.
funcsrc_classic.utils.get_image_info(page:Page, hashes:bool=False, xrefs:bool=False) -> list
Extract image information only from a TextPage.
funcsrc_classic.utils.get_image_rects(page:Page, name, transform=False) -> list
Return list of image positions on a page.
funcsrc_classic.utils.get_label(page)
Return the label for this PDF page.
funcsrc_classic.utils.get_label_pno(pgNo, labels)
Return the label for this page number.
funcsrc_classic.utils.get_links(page:Page) -> list
Create a list of all links contained in a PDF page.
funcsrc_classic.utils.get_oc(doc:Document, xref:int) -> int
Return optional content object xref for an image or form xobject.
funcsrc_classic.utils.get_old_widths(xref)
Retrieve old font '/W' and '/DW' values.
funcsrc_classic.utils.get_pixmap(page:Page, *matrix:matrix_like=Identity, *dpi=None, *colorspace:Colorspace=csRGB, *clip:rect_like=None, *alpha:bool=False, *annots:bool=True) -> Pixmap
Create pixmap of page.
funcsrc_classic.utils.get_text_blocks(page:Page, clip:rect_like=None, flags:OptInt=None, textpage:TextPage=None, sort:bool=False) -> list
Return the text blocks on a page.
funcsrc_classic.utils.get_toc(doc:Document, simple:bool=True) -> list
Create a table of contents.
funcsrc_classic.utils.has_annots(doc:Document) -> bool
Check whether there are annotations on any page.
funcsrc_classic.utils.has_links(doc:Document) -> bool
Check whether there are links on any page.
funcsrc_classic.utils.insert_link(page:Page, lnk:dict, mark:bool=True) -> None
Insert a new link for the current page.
funcsrc_classic.utils.integerToLetter(i) -> str
Returns letter sequence string for integer i.
funcsrc_classic.utils.integerToRoman(num:int) -> str
Return roman numeral for an integer.
funcsrc_classic.utils.new_page(doc:Document, pno:int=-1, width:float=595, height:float=842) -> Page
Create and return a new page object.
funcsrc_classic.utils.output_justify(start, line)
Justified output of a line.
funcsrc_classic.utils.recover_bbox_quad(line_dir:tuple, span:dict, bbox:tuple) -> Quad
Compute the quad located inside the bbox.
funcsrc_classic.utils.recover_char_quad(line_dir:tuple, span:dict, char:dict) -> Quad
Recover the quadrilateral of a text character.
funcsrc_classic.utils.recover_line_quad(line:dict, spans:list=None) -> Quad
Calculate the line quad for 'dict' / 'rawdict' text extractions.
funcsrc_classic.utils.recover_quad(line_dir:tuple, span:dict) -> Quad
Recover the quadrilateral of a text span.
funcsrc_classic.utils.recover_span_quad(line_dir:tuple, span:dict, chars:list=None) -> Quad
Calculate the span quad for 'dict' / 'rawdict' text extractions.
funcsrc_classic.utils.remove_hidden(cont_lines)
Remove hidden text from a PDF page.
funcsrc_classic.utils.repl_fontnames(doc)
Populate 'font_buffers'.
funcsrc_classic.utils.replace_image(page:Page, xref:int, *filename=None, *pixmap=None, *stream=None)
Replace the image referred to by xref.
funcsrc_classic.utils.search_for(*args, **kwargs) -> list
Search for a string on a page.
funcsrc_classic.utils.set_metadata(doc:Document, m:dict) -> None
Update the PDF /Info object.
funcsrc_classic.utils.set_oc(doc:Document, xref:int, oc:int) -> None
Attach optional content object to image or form xobject.
funcsrc_classic.utils.set_ocmd(doc:Document, xref:int=0, ocgs:typing.Union[list, None]=None, policy:OptStr=None, ve:typing.Union[list, None]=None) -> int
Create or update an OCMD object in a PDF document.
funcsrc_classic.utils.set_toc(doc:Document, toc:list, collapse:int=1) -> int
Create new outline tree (table of contents, TOC).
funcsrc_classic.utils.set_toc_item(doc:Document, idx:int, dest_dict:OptDict=None, kind:OptInt=None, pno:OptInt=None, uri:OptStr=None, title:OptStr=None, to:point_like=None, filename:OptStr=None, zoom:float=0) -> None
Update TOC item by index.
funcsrc_classic.utils.show_pdf_page(*args, **kwargs) -> int
Show page number 'pno' of PDF 'src' in rectangle 'rect'.
funcsrc_classic.utils.subset_fonts(doc:Document, verbose:bool=False) -> None
Build font subsets of a PDF.
funcsrc_classic.utils.textlen(x)
Return length of a string.
funcsrc_classic.utils.update_link(page:Page, lnk:dict) -> None
Update a link on the current page.
funcsrc_classic.utils.write_text(page:Page, **kwargs) -> None
Write the text of one or more TextWriter objects.

About this data

These signatures were extracted from the public source of pymupdf/pymupdf using Python's ast module. Argument names, default values, type annotations and return types are taken verbatim from the code. Implementation bodies are never stored. See how it works for details.

Back to all 805 libraries