PyMuPDF Documentation
- Introduction
- Requirements
- Installation
- Tutorial
- Recipes
- Recipes: Images
- How to Make Images from Document Pages
- How to Increase Image Resolution
- How to Create Partial Pixmaps (Clips)
- How to Zoom a Clip to a GUI Window
- How to Create or Suppress Annotation Images
- How to Extract Images: Non-PDF Documents
- How to Extract Images: PDF Documents
- How to Handle Image Masks
- How to Make one PDF of all your Pictures (or Files)
- How to Create Vector Images
- How to Convert Images
- How to Use Pixmaps: Glueing Images
- How to Use Pixmaps: Making a Fractal
- How to Interface with NumPy
- How to Add Images to a PDF Page
- Recipes: Text
- Recipes: Annotations
- Recipes: Drawing and Graphics
- Recipes: Multiprocessing
- Recipes: General
- How to Open with a Wrong File Extension
- How to Embed or Attach Files
- How to Delete and Re-Arrange Pages
- How to Join PDFs
- How to Add Pages
- How To Dynamically Clean Up Corrupt PDFs
- How to Split Single Pages
- How to Combine Single Pages
- How to Convert Any Document to PDF
- How to Deal with Messages Issued by MuPDF
- How to Deal with PDF Encryption
- Recipes: Common Issues and their Solutions
- Recipes: Low-Level Interfaces
- Recipes: Journalling
- Recipes: Stories
- How to add a line of text with some formatting
- How to use images
- Reading external HTML and CSS for a Story
- How to output database content with Story templates
- How to integrate with existing PDFs
- How to make multi-columned layouts and access fonts from package pymupdf-fonts
- How make a layout which wraps around a predefined “no go area” layout
- How to output a table
- How to create a simple grid layout
- How to generate a Table of Contents
- How to display a list from JSON data
- Using the alternative
Story.write*()
functions
- Recipes: Images
- Module fitz
- Classes
- Annot
Annot
Annot.get_pixmap()
Annot.get_text()
Annot.get_textbox()
Annot.set_info()
Annot.set_line_ends()
Annot.set_oc()
Annot.get_oc()
Annot.set_irt_xref()
Annot.set_open()
Annot.set_popup()
Annot.set_opacity()
Annot.blendmode
Annot.set_blendmode()
Annot.set_name()
Annot.set_rect()
Annot.set_rotation()
Annot.set_border()
Annot.set_flags()
Annot.set_colors()
Annot.delete_responses()
Annot.update()
Annot.file_info
Annot.get_file()
Annot.update_file()
Annot.get_sound()
Annot.opacity
Annot.parent
Annot.rotation
Annot.rect
Annot.next
Annot.type
Annot.info
Annot.flags
Annot.line_ends
Annot.vertices
Annot.colors
Annot.xref
Annot.irt_xref
Annot.popup_xref
Annot.has_popup
Annot.is_open
Annot.popup_rect
Annot.border
- Annotation Icons in MuPDF
- Example
- Archive
- Colorspace
- DisplayList
- Document
Document
Document.__init__()
Document.get_oc()
Document.set_oc()
Document.get_layers()
Document.add_layer()
Document.switch_layer()
Document.add_ocg()
Document.set_ocmd()
Document.get_ocmd()
Document.get_layer()
Document.set_layer()
Document.get_ocgs()
Document.layer_ui_configs()
Document.set_layer_ui_config()
Document.authenticate()
Document.get_page_numbers()
Document.get_page_labels()
Document.set_page_labels()
Document.make_bookmark()
Document.find_bookmark()
Document.chapter_page_count()
Document.next_location()
Document.prev_location()
Document.load_page()
Document.reload_page()
Document.page_cropbox()
Document.page_xref()
Document.pages()
Document.convert_to_pdf()
Document.get_toc()
Document.xref_get_keys()
Document.xref_get_key()
Document.xref_set_key()
Document.get_page_pixmap()
Document.get_page_xobjects()
Document.get_page_images()
Document.get_page_fonts()
Document.get_page_text()
Document.layout()
Document.select()
Document.set_metadata()
Document.get_xml_metadata()
Document.set_xml_metadata()
Document.set_toc()
Document.outline_xref()
Document.del_toc_item()
Document.set_toc_item()
Document.can_save_incrementally()
Document.scrub()
Document.save()
Document.ez_save()
Document.saveIncr()
Document.tobytes()
Document.search_page_for()
Document.insert_pdf()
Document.insert_file()
Document.new_page()
Document.insert_page()
Document.delete_page()
Document.delete_pages()
Document.copy_page()
Document.fullcopy_page()
Document.move_page()
Document.need_appearances()
Document.get_sigflags()
Document.embfile_add()
Document.embfile_count()
Document.embfile_get()
Document.embfile_del()
Document.embfile_info()
Document.embfile_names()
Document.embfile_upd()
Document.close()
Document.xref_object()
Document.pdf_catalog()
Document.pdf_trailer()
Document.xref_stream()
Document.xref_stream_raw()
Document.update_object()
Document.update_stream()
Document.xref_copy()
Document.extract_image()
Document.extract_font()
Document.xref_xml_metadata()
Document.has_links()
Document.has_annots()
Document.subset_fonts()
Document.journal_enable()
Document.journal_start_op()
Document.journal_stop_op()
Document.journal_position()
Document.journal_op_name()
Document.journal_can_do()
Document.journal_undo()
Document.journal_redo()
Document.journal_save()
Document.journal_load()
Document.save_snapshot()
Document.outline
Document.is_closed
Document.is_dirty
Document.is_pdf
Document.is_form_pdf
Document.is_reflowable
Document.is_repaired
Document.needs_pass
Document.is_encrypted
Document.permissions
Document.metadata
Document.name
Document.page_count
Document.chapter_count
Document.last_location
Document.FormFonts
set_metadata()
Exampleset_toc()
Demonstrationinsert_pdf()
Examples- Other Examples
- DocumentWriter
- Font
- Identity
- IRect
IRect
IRect.__init__()
IRect.__init__()
IRect.__init__()
IRect.__init__()
IRect.get_area()
IRect.intersect()
IRect.contains()
IRect.intersects()
IRect.torect()
IRect.morph()
IRect.norm()
IRect.normalize()
IRect.top_left
IRect.tl
IRect.top_right
IRect.tr
IRect.bottom_left
IRect.bl
IRect.bottom_right
IRect.br
IRect.rect
IRect.quad
IRect.width
IRect.height
IRect.x0
IRect.y0
IRect.x1
IRect.y1
IRect.is_infinite
IRect.is_empty
- Link
- linkDest
- Matrix
Matrix
Matrix.__init__()
Matrix.__init__()
Matrix.__init__()
Matrix.__init__()
Matrix.__init__()
Matrix.__init__()
Matrix.__init__()
Matrix.norm()
Matrix.prerotate()
Matrix.prescale()
Matrix.preshear()
Matrix.pretranslate()
Matrix.concat()
Matrix.invert()
Matrix.a
Matrix.b
Matrix.c
Matrix.d
Matrix.e
Matrix.f
Matrix.is_rectilinear
- Examples
- Shifting
- Flipping
- Shearing
- Rotating
- Outline
- Page
- Pixmap
Pixmap
Pixmap.__init__()
Pixmap.__init__()
Pixmap.__init__()
Pixmap.__init__()
Pixmap.__init__()
Pixmap.__init__()
Pixmap.__init__()
Pixmap.__init__()
Pixmap.__init__()
Pixmap.clear_with()
Pixmap.tint_with()
Pixmap.gamma_with()
Pixmap.shrink()
Pixmap.pixel()
Pixmap.set_pixel()
Pixmap.set_rect()
Pixmap.set_origin()
Pixmap.set_dpi()
Pixmap.set_alpha()
Pixmap.invert_irect()
Pixmap.copy()
Pixmap.save()
Pixmap.pdfocr_save()
Pixmap.pdfocr_tobytes()
Pixmap.tobytes()
Pixmap.pil_save()
Pixmap.pil_tobytes()
Pixmap.warp()
Pixmap.color_count()
Pixmap.color_topusage()
Pixmap.alpha
Pixmap.digest
Pixmap.colorspace
Pixmap.stride
Pixmap.is_monochrome
Pixmap.is_unicolor
Pixmap.irect
Pixmap.samples
Pixmap.samples_mv
Pixmap.samples_ptr
Pixmap.size
Pixmap.width
Pixmap.w
Pixmap.height
Pixmap.h
Pixmap.x
Pixmap.y
Pixmap.n
Pixmap.xres
Pixmap.yres
Pixmap.interpolate
- Supported Input Image Formats
- Supported Output Image Formats
- Point
- Quad
- Rect
Rect
Rect.__init__()
Rect.__init__()
Rect.__init__()
Rect.__init__()
Rect.__init__()
Rect.__init__()
Rect.__init__()
Rect.round()
Rect.transform()
Rect.intersect()
Rect.include_rect()
Rect.include_point()
Rect.get_area()
Rect.contains()
Rect.intersects()
Rect.torect()
Rect.morph()
Rect.norm()
Rect.normalize()
Rect.irect
Rect.top_left
Rect.tl
Rect.top_right
Rect.tr
Rect.bottom_left
Rect.bl
Rect.bottom_right
Rect.br
Rect.quad
Rect.width
Rect.height
Rect.x0
Rect.y0
Rect.x1
Rect.y1
Rect.is_infinite
Rect.is_empty
Rect.is_valid
- Shape
Shape
Shape.__init__()
Shape.draw_line()
Shape.draw_squiggle()
Shape.draw_zigzag()
Shape.draw_polyline()
Shape.draw_bezier()
Shape.draw_oval()
Shape.draw_circle()
Shape.draw_curve()
Shape.draw_sector()
Shape.draw_rect()
Shape.draw_quad()
Shape.finish()
Shape.insert_text()
Shape.insert_textbox()
Shape.commit()
Shape.doc
Shape.page
Shape.height
Shape.width
Shape.draw_cont
Shape.text_cont
Shape.rect
Shape.totalcont
Shape.lastPoint
- Usage
- Examples
- Common Parameters
- Story
- TextPage
- TextWriter
- Tools
Tools
Tools.gen_id()
Tools.set_annot_stem()
Tools.set_small_glyph_heights()
Tools.set_subset_fontnames()
Tools.unset_quad_corrections()
Tools.store_shrink()
Tools.show_aa_level()
Tools.set_aa_level()
Tools.reset_mupdf_warnings()
Tools.mupdf_display_errors()
Tools.mupdf_warnings()
Tools.fitz_config
Tools.store_maxsize
Tools.store_size
- Example Session
- Widget
Widget
Widget.button_states()
Widget.update()
Widget.reset()
Widget.next
Widget.border_color
Widget.border_style
Widget.border_width
Widget.border_dashes
Widget.choice_values
Widget.field_name
Widget.field_label
Widget.field_value
Widget.field_flags
Widget.field_type
Widget.field_type_string
Widget.fill_color
Widget.button_caption
Widget.is_signed
Widget.rect
Widget.text_color
Widget.text_font
Widget.text_fontsize
Widget.text_maxlen
Widget.text_type
Widget.xref
Widget.script
Widget.script_stroke
Widget.script_format
Widget.script_change
Widget.script_calc
- Standard Fonts for Widgets
- Supported Widget Types
- Xml
Xml
Xml.add_bullet_list()
Xml.add_codeblock()
Xml.add_description_list()
Xml.add_division()
Xml.add_header()
Xml.add_horizontal_line()
Xml.add_image()
Xml.add_link()
Xml.add_number_list()
Xml.add_paragraph()
Xml.add_span()
Xml.add_subscript()
Xml.add_superscript()
Xml.add_code()
Xml.add_var()
Xml.add_samp()
Xml.add_kbd()
Xml.add_text()
Xml.set_align()
Xml.set_attribute()
Xml.get_attributes()
Xml.get_attribute_value()
Xml.remove_attribute()
Xml.set_bgcolor()
Xml.set_bold()
Xml.set_color()
Xml.set_columns()
Xml.set_font()
Xml.set_fontsize()
Xml.set_id()
Xml.set_italic()
Xml.set_leading()
Xml.set_lineheight()
Xml.set_margins()
Xml.set_pagebreak_after()
Xml.set_pagebreak_before()
Xml.set_properties()
Xml.add_style()
Xml.add_class()
Xml.set_text_indent()
Xml.append_child()
Xml.create_text_node()
Xml.create_element()
Xml.insert_before()
Xml.insert_after()
Xml.clone()
Xml.remove()
Xml.debug()
Xml.find()
Xml.find_next()
Xml.tagname
Xml.text
Xml.is_text
Xml.first_child
Xml.last_child
Xml.next
Xml.previous
Xml.root
- Setting Text properties
- Context Manager support
- Annot
- Operator Algebra for Geometry Objects
- Low Level Functions and Classes
- Functions
paper_size()
paper_rect()
sRGB_to_pdf()
sRGB_to_rgb()
glyph_name_to_unicode()
unicode_to_glyph_name()
adobe_glyph_names()
adobe_glyph_unicodes()
css_for_pymupdf_font()
recover_quad()
make_table()
planish_line()
paper_sizes()
fitz_fontdescriptors
TESSDATA_PREFIX
pdfcolor
get_pdf_now()
get_text_length()
get_pdf_str()
image_profile()
ConversionHeader()
ConversionTrailer()
Document.del_xml_metadata()
Document.xml_metadata_xref()
Page.run()
Page.get_bboxlog()
Page.get_texttrace()
Page.wrap_contents()
Page.is_wrapped
Page.get_text_blocks()
Page.get_text_words()
Page.get_displaylist()
Page.get_contents()
Page.set_contents()
Page.clean_contents()
Page.read_contents()
Annot.clean_contents()
Document.get_char_widths()
Document.is_stream()
Document.get_new_xref()
Document.xref_length()
recover_quad()
recover_char_quad()
recover_span_quad()
recover_line_quad()
INFINITE_QUAD()
INFINITE_RECT()
INFINITE_IRECT()
EMPTY_QUAD()
EMPTY_RECT()
EMPTY_IRECT()
- Device
- Working together: DisplayList and TextPage
- Functions
- Glossary
- Constants and Enumerations
- Color Database
- Appendix 1: Details on Text Extraction
- Appendix 2: Considerations on Embedded Files
- Appendix 3: Assorted Technical Information
- Change Log
- Deprecated Names