sdkagent

fpdf2 API reference

250 public APIs from fpdf2 (py-pdf/fpdf2) — 84 classes, 30 functions, 136 methods. Signatures extracted by static analysis of the actual source.

Repository: py-pdf/fpdf2

KindCount
Classes84
Functions30
Methods136

API list

classfpdf.annotations.AnnotationDict
A PDF annotation that get serialized as an inline <<dictionary>>
classfpdf.annotations.PDFAnnotation
A PDF annotation that get serialized as an obj<</>>endobj block
funcfpdf.deprecation.get_stack_level() -> int
Get the first place in the call stack that is not inside fpdf2
funcfpdf.deprecation.support_deprecated_txt_arg(fn:Callable[P, R]) -> Callable[P, R]
Decorator converting `txt=` arguments into `text=` arguments
classfpdf.drawing.Arc
An elliptical arc path element.
methodfpdf.drawing.Arc.end_point() -> Point
The end point of this path element.
classfpdf.drawing.BezierCurve
A cubic Bézier curve path element.
methodfpdf.drawing.BezierCurve.bounding_box(start:Point) -> tuple[BoundingBox, Point]
Compute the bounding box of this cubic Bézier curve.
methodfpdf.drawing.BezierCurve.end_point() -> Point
The end point of this path element.
methodfpdf.drawing.BoundingBox.from_points(points:list[Point]) -> 'BoundingBox'
Given a list of points, create a bounding box that encloses them all.
methodfpdf.drawing.BoundingBox.height() -> float
Return the height of the bounding box.
methodfpdf.drawing.BoundingBox.is_valid() -> bool
Return True if the bounding box is not empty.
methodfpdf.drawing.BoundingBox.max_distance_to_point(cx:float, cy:float) -> float
Max Euclidean distance from (cx,cy) to any bbox corner.
methodfpdf.drawing.BoundingBox.merge(other:'BoundingBox') -> 'BoundingBox'
Expand this bounding box to include another one.
methodfpdf.drawing.BoundingBox.to_pdf_array() -> str
Convert bounding box to a PDF array string.
methodfpdf.drawing.BoundingBox.to_tuple() -> tuple[float, float, float, float]
Convert bounding box to a 4-tuple.
methodfpdf.drawing.BoundingBox.width() -> float
Return the width of the bounding box.
classfpdf.drawing.ClippingPath
The PaintedPath API but to be used to create clipping paths.
classfpdf.drawing.Close
A path close element.
methodfpdf.drawing.Close.bounding_box(start:Point) -> tuple[BoundingBox, Point]
Return an empty bounding box; Close does not affect the geometry.
methodfpdf.drawing.Close.end_point() -> Point
The end point of a Close is undefined; return (0, 0).
classfpdf.drawing.Ellipse
An ellipse.
classfpdf.drawing.GlyphPathPen
A pen that can be used to draw glyphs into a `PaintedPath`.
classfpdf.drawing.GradientPaint
Fill/stroke paint using a gradient
classfpdf.drawing.ImageSoftMask
Soft mask backed by a grayscale image XObject.
classfpdf.drawing.Line
A path line element.
methodfpdf.drawing.Line.end_point() -> Point
The end point of this path element.
classfpdf.drawing.Move
A path move element.
methodfpdf.drawing.Move.end_point() -> Point
The end point of this path element.
classfpdf.drawing.PaintedPath
A path to be drawn by the PDF renderer.
methodfpdf.drawing.PaintedPath.add_path_element(item:Renderable, clone:bool=True) -> None
Add the given element as a path item of this path.
methodfpdf.drawing.PaintedPath.circle(cx:Number, cy:Number, r:Number) -> 'PaintedPath'
Append a circle as a closed subpath to the current path.
methodfpdf.drawing.PaintedPath.clipping_path() -> Optional['ClippingPath']
Set the clipping path for this path.
methodfpdf.drawing.PaintedPath.close() -> None
Explicitly close the current (sub)path.
methodfpdf.drawing.PaintedPath.curve_to(x1:Number, y1:Number, x2:Number, y2:Number, x3:Number, y3:Number) -> 'PaintedPath'
Append a cubic Bézier curve to this path.
methodfpdf.drawing.PaintedPath.ellipse(cx:Number, cy:Number, rx:Number, ry:Number) -> 'PaintedPath'
Append an ellipse as a closed subpath to the current path.
methodfpdf.drawing.PaintedPath.horizontal_line_to(x:Number) -> 'PaintedPath'
Append a straight horizontal line to the given abscissa.
methodfpdf.drawing.PaintedPath.line_to(x:Number, y:Number) -> 'PaintedPath'
Append a straight line to this path.
methodfpdf.drawing.PaintedPath.move_to(x:Number, y:Number) -> 'PaintedPath'
Start a new subpath or move the path starting point.
methodfpdf.drawing.PaintedPath.style() -> GraphicsStyle
The `GraphicsStyle` applied to all elements of this path.
methodfpdf.drawing.PaintedPath.text(x:float, y:float, content:str, font_family:str='helvetica', font_style:str='', font_size:float=12.0, text_anchor:str='start') -> 'PaintedPath'
Append a text run at (x, y) to this path.
methodfpdf.drawing.PaintedPath.vertical_line_to(y:Number) -> 'PaintedPath'
Append a straight vertical line to the given ordinate.
classfpdf.drawing.QuadraticBezierCurve
A quadratic Bézier curve path element.
methodfpdf.drawing.QuadraticBezierCurve.end_point() -> Point
The end point of this path element.
classfpdf.drawing.Rectangle
A pdf primitive rectangle.
methodfpdf.drawing.Rectangle.bounding_box(start:Point) -> tuple[BoundingBox, Point]
Compute the bounding box of this rectangle.
methodfpdf.drawing.Rectangle.end_point() -> Point
The end point of a rectangle is the origin.
classfpdf.drawing.RelativeArc
An elliptical arc path element.
classfpdf.drawing.RoundedRectangle
A rectangle with rounded corners.
classfpdf.drawing.Text
SVG-like text renderable.
methodfpdf.drawing.Text.bounding_box(start:Point) -> tuple['BoundingBox', Point]
Compute a conservative bbox for the text.
methodfpdf.drawing.VerticalLine.bounding_box(start:Point) -> tuple[BoundingBox, Point]
Compute the bounding box of this vertical line.
classfpdf.drawing_primitives.DeviceCMYK
A class representing a PDF DeviceCMYK color.
classfpdf.drawing_primitives.DeviceGray
A class representing a PDF DeviceGray color.
classfpdf.drawing_primitives.DeviceRGB
A class representing a PDF DeviceRGB color.
classfpdf.drawing_primitives.Point
An x-y coordinate pair within the two-dimensional coordinate frame.
methodfpdf.drawing_primitives.Point.dot(other:'Point') -> float
Compute the dot product of two points.
classfpdf.drawing_primitives.Transform
A representation of an affine transformation matrix for 2D shapes.
methodfpdf.drawing_primitives.Transform.identity() -> 'Transform'
Create a transform representing the identity transform.
methodfpdf.drawing_primitives.Transform.inverse() -> 'Transform'
Produce a transform that is the inverse of this transform.
methodfpdf.drawing_primitives.Transform.render(last_item:'Renderable') -> tuple[str, 'Renderable']
Render the transform to its PDF output representation.
methodfpdf.drawing_primitives.Transform.rotation(theta:Number) -> 'Transform'
Create a transform that performs rotation.
methodfpdf.drawing_primitives.Transform.rotation_d(theta_d:Number) -> 'Transform'
Create a transform that performs rotation **in degrees**.
methodfpdf.drawing_primitives.Transform.row_norms() -> tuple[float, float]
Returns (sqrt(a² + c²), sqrt(b² + d²)), i.e.
methodfpdf.drawing_primitives.Transform.scaling(x:Number, y:Optional[Number]=None) -> 'Transform'
Create a transform that performs scaling.
methodfpdf.drawing_primitives.Transform.shearing(x:Number, y:Optional[Number]=None) -> 'Transform'
Create a transform that performs shearing (not of sheep).
methodfpdf.drawing_primitives.Transform.skew(ax:Number=0, ay:Optional[Number]=None) -> 'Transform'
Compose with a skew (radians).
methodfpdf.drawing_primitives.Transform.skew_d(ax_d:Number=0, ay_d:Optional[Number]=None) -> 'Transform'
Compose with a skew (degrees).
methodfpdf.drawing_primitives.Transform.skewing(ax:Number=0, ay:Optional[Number]=None) -> 'Transform'
Create a skew (shear) transform using angles **in radians**.
methodfpdf.drawing_primitives.Transform.skewing_d(ax_d:Number=0, ay_d:Optional[Number]=None) -> 'Transform'
Create a skew (shear) transform using angles **in degrees**.
methodfpdf.drawing_primitives.Transform.translation(x:Number, y:Number) -> 'Transform'
Create a transform that performs translation.
funcfpdf.drawing_primitives.cmyk8(c:Number, m:Number, y:Number, k:Number, a:Optional[Number]=None) -> DeviceCMYK
Produce a DeviceCMYK color from the given 8-bit CMYK values.
funcfpdf.drawing_primitives.gray8(g:Number, a:Optional[Number]=None) -> DeviceGray
Produce a DeviceGray color from the given 8-bit gray value.
funcfpdf.drawing_primitives.rgb8(r:Number, g:Number, b:Number, a:Optional[Number]=None) -> DeviceGray | DeviceRGB
Produce a DeviceRGB color from the given 8-bit RGB values.
funcfpdf.encryption.int32(n:int) -> int
convert long to signed 32 bit integer
classfpdf.enums.Align
Defines how to render text in a cell
classfpdf.enums.CellFillProtocol
Protocol for custom table cell fill mode classes
classfpdf.enums.CharVPos
Defines the vertical position of text relative to the line.
classfpdf.enums.CoerciveEnum
An enumeration that provides a helper to coerce strings into enumeration members.
methodfpdf.enums.CoerciveEnum.coerce(value:E | str, case_sensitive:bool=False) -> E
Attempt to coerce `value` into a member of this enumeration.
classfpdf.enums.CompositingOperation
An enumeration of Porter-Duff compositing operations.
classfpdf.enums.EncryptionMethod
Algorithm to be used to encrypt the document
classfpdf.enums.GradientUnits
Specifies the coordinate system for gradients.
classfpdf.enums.MethodReturnValue
Defines the return value(s) of a FPDF content-rendering method.
classfpdf.enums.OutputIntentSubType
Definition for Output Intent Subtypes
classfpdf.enums.PDFStyleKeys
An enumeration of the graphics state parameter dictionary keys.
classfpdf.enums.PageLabelStyle
Style of the page label
classfpdf.enums.PageLayout
Specify the page layout shall be used when the document is opened
classfpdf.enums.PageMode
Specifying how to display the document on exiting full-screen mode
classfpdf.enums.RenderStyle
Defines how to render shapes
classfpdf.enums.TableBordersLayoutAll
Class for drawing all cell borders
classfpdf.enums.TableBordersLayoutHorizontalLines
Class to draw only horizontal lines
classfpdf.enums.TableBordersLayoutInternal
Class to draw only internal horizontal & vertical borders
classfpdf.enums.TableBordersLayoutNone
Class for drawing zero cell borders
classfpdf.enums.TableBordersLayoutSingleTopLine
Class to draw a single top line
classfpdf.enums.TableCellFillMode
Defines which table cells to fill
classfpdf.enums.TableHeadingsDisplay
Defines how the table headings should be displayed
classfpdf.enums.TextDirection
Text rendering direction for text shaping
classfpdf.enums.TextEmphasis
Indicates use of bold / italics / underline.
classfpdf.enums.TextMarkupType
Subtype of a text markup annotation
classfpdf.enums.TextMode
Values described in PDF spec section 'Text Rendering Mode'
classfpdf.enums.VAlign
Defines how to vertically render text in a cell.
classfpdf.enums.WrapMode
Defines how to break and wrap lines in multi-line text.
classfpdf.enums.YPos
Positional values in vertical direction for use after printing text
classfpdf.errors.FPDFPageFormatException
Error is thrown when a bad page format is given
classfpdf.font_type_3.CBDTColorFont
Support for CBDT+CBLC bitmap color fonts.
classfpdf.font_type_3.COLRFont
Support for COLRv0 and COLRv1 OpenType color vector fonts.
classfpdf.font_type_3.EBDTBitmapFont
Support for EBLC+EBDT bitmap fonts.
classfpdf.font_type_3.SBIXColorFont
Support for SBIX bitmap color fonts.
classfpdf.font_type_3.SVGColorFont
Support for SVG OpenType vector color fonts.
classfpdf.fonts.FontFace
Represent basic font styling properties.
classfpdf.fonts.HarfBuzzFont
uharfbuzz.Font than can be deepcopied
classfpdf.fpdf.FPDF
PDF Generation class
methodfpdf.fpdf.FPDF.add_action(action:Action, x:float, y:float, w:float, h:float, **kwargs:Any) -> AnnotationDict
Puts an Action annotation on a rectangular area of the page.
methodfpdf.fpdf.FPDF.add_link(y:float=0, x:float=0, page:int=-1, zoom:str | float='null', name:Optional[str]=None) -> int
Creates a new internal link and returns its identifier.
methodfpdf.fpdf.FPDF.alias_nb_pages(alias:str='{nb}') -> None
Defines an alias for the total number of pages.
methodfpdf.fpdf.FPDF.arc(x:float, y:float, a:float, start_angle:float, end_angle:float, b:Optional[float]=None, inclination:float=0, clockwise:bool=False, start_from_center:bool=False, end_at_center:bool=False, style:Optional[RenderStyle | str]=None) -> None
Outputs an arc.
methodfpdf.fpdf.FPDF.circle(x:float, y:float, radius:float, style:Optional[RenderStyle | str]=None) -> None
Outputs a circle.
methodfpdf.fpdf.FPDF.code39(text:str, x:float, y:float, w:float=1.5, h:float=5) -> None
Barcode 3of9
methodfpdf.fpdf.FPDF.dashed_line(x1:float, y1:float, x2:float, y2:float, dash_length:float=1, space_length:float=1) -> None
Draw a dashed line between two points.
methodfpdf.fpdf.FPDF.draw_path(path:GraphicsContext, debug_stream:Optional[bool]=None, copy:bool=True) -> None
Add a pre-constructed path to the document.
methodfpdf.fpdf.FPDF.draw_vector_glyph(path:Union[PaintedPath, GraphicsContext], font:'Type3Font') -> str
Add a pre-constructed path to the document.
methodfpdf.fpdf.FPDF.drawing_context(debug_stream:Optional[bool]=None) -> Generator[DrawingContext, None, None]
Create a context for drawing paths on the current page.
methodfpdf.fpdf.FPDF.ellipse(x:float, y:float, w:float, h:float, style:Optional[RenderStyle | str]=None) -> None
Outputs an ellipse.
methodfpdf.fpdf.FPDF.eph() -> float
Effective page height: the page height minus its vertical margins.
methodfpdf.fpdf.FPDF.epw() -> float
Effective page width: the page width minus its horizontal margins.
methodfpdf.fpdf.FPDF.footer() -> None
Footer to be implemented in your own inherited class.
methodfpdf.fpdf.FPDF.get_fallback_font(char:str, style:str='') -> Optional[str]
Returns which fallback font has the requested glyph.
methodfpdf.fpdf.FPDF.get_named_destination(name:str) -> str
Retrieves a named destination by its name and creates a link to it.
methodfpdf.fpdf.FPDF.get_page_label() -> str
Return the current page `fpdf.output.PDFPageLabel`.
methodfpdf.fpdf.FPDF.get_string_width(s:str, normalized:bool=False, markdown:bool=False) -> float
Returns the length of a string in user unit.
methodfpdf.fpdf.FPDF.get_x() -> float
Returns the abscissa of the current position.
methodfpdf.fpdf.FPDF.get_y() -> float
Returns the ordinate of the current position.
methodfpdf.fpdf.FPDF.ink_annotation(coords:Sequence[tuple[float, float]], text:str='', color:tuple[float, float, float]=(1, 1, 0), border_width:float=1, **kwargs:Any) -> AnnotationDict
Adds add an ink annotation on the page.
methodfpdf.fpdf.FPDF.interleaved2of5(text:str, x:float, y:float, w:float=1, h:float=10) -> None
Barcode I2of5 (numeric), adds a 0 if odd length
methodfpdf.fpdf.FPDF.line(x1:float, y1:float, x2:float, y2:float) -> None
Draw a line between two points.
methodfpdf.fpdf.FPDF.ln(h:Optional[float]=None) -> None
Line Feed.
methodfpdf.fpdf.FPDF.local_context(**kwargs:Any) -> Generator[None, None, None]
Creates a local graphics state, which won't affect the surrounding code.
methodfpdf.fpdf.FPDF.normalize_text(text:str) -> str
Check that text input is in the correct format/encoding
methodfpdf.fpdf.FPDF.page_no() -> int
Get the current page number
methodfpdf.fpdf.FPDF.polygon(point_list:Sequence[tuple[float, float]], fill:bool=False, style:Optional[RenderStyle | str]=None) -> None
Outputs a polygon defined by three or more points.
methodfpdf.fpdf.FPDF.polyline(point_list:Sequence[tuple[float, float]], fill:bool=False, polygon:bool=False, style:Optional[RenderStyle | str]=None) -> None
Draws lines between two or more points.
methodfpdf.fpdf.FPDF.rect(x:float, y:float, w:float, h:float, style:Optional[RenderStyle | str]=None, round_corners:bool=False, corner_radius:float=0) -> None
Outputs a rectangle.
methodfpdf.fpdf.FPDF.rotate(angle:float, x:Optional[float]=None, y:Optional[float]=None) -> None
..
methodfpdf.fpdf.FPDF.rotation(angle:float, x:Optional[float]=None, y:Optional[float]=None) -> Generator[None, None, None]
Method to perform a rotation around a given center.
methodfpdf.fpdf.FPDF.set_author(author:str | Sequence[str]) -> None
Defines the author of the document.
methodfpdf.fpdf.FPDF.set_char_spacing(spacing:float) -> None
Sets horizontal character spacing.
methodfpdf.fpdf.FPDF.set_compression(compress:bool) -> None
Activates or deactivates page compression.
methodfpdf.fpdf.FPDF.set_creation_date(date:Optional[datetime]=None) -> None
Sets Creation of Date time, or current time if None given.
methodfpdf.fpdf.FPDF.set_creator(creator:str) -> None
Defines the creator of the document.
methodfpdf.fpdf.FPDF.set_dash_pattern(dash:float=0, gap:float=0, phase:float=0) -> None
Set the current dash pattern for lines and curves.
methodfpdf.fpdf.FPDF.set_display_mode(zoom:str | float, layout:str='continuous') -> None
Defines the way the document is to be displayed by the viewer.
methodfpdf.fpdf.FPDF.set_doc_option(opt:Literal['core_fonts_encoding'], value:str) -> None
Defines a document option.
methodfpdf.fpdf.FPDF.set_font(family:Optional[str]=None, style:Union[str, TextEmphasis]='', size:float=0) -> None
Sets the font used to print character strings.
methodfpdf.fpdf.FPDF.set_font_size(size:float) -> None
Configure the font size in points Args: size (float): font size in points
methodfpdf.fpdf.FPDF.set_left_margin(margin:float) -> None
Sets the document left margin.
methodfpdf.fpdf.FPDF.set_link(link:Optional[int]=None, y:float=0, x:float=0, page:int=-1, zoom:float | str='null', name:Optional[str]=None) -> DestinationXYZ | str
Defines the page and position a link points to.
methodfpdf.fpdf.FPDF.set_margin(margin:float) -> None
Sets the document right, left, top & bottom margins to the same value.
methodfpdf.fpdf.FPDF.set_producer(producer:str) -> None
Producer of document
methodfpdf.fpdf.FPDF.set_right_margin(margin:float) -> None
Sets the document right margin.
methodfpdf.fpdf.FPDF.set_stretching(stretching:float) -> None
Sets horizontal font stretching.
methodfpdf.fpdf.FPDF.set_subject(subject:str) -> None
Defines the subject of the document.
methodfpdf.fpdf.FPDF.set_text_color(r:Number | Color | str | Sequence[Number] | DeviceCMYK | DeviceGray | DeviceRGB, g:Number=-1, b:Number=-1) -> None
Defines the color used for text.
methodfpdf.fpdf.FPDF.set_title(title:str) -> None
Defines the title of the document.
methodfpdf.fpdf.FPDF.set_top_margin(margin:float) -> None
Sets the document top margin.
methodfpdf.fpdf.FPDF.set_x(x:float) -> None
Defines the abscissa of the current position.
methodfpdf.fpdf.FPDF.set_xy(x:float, y:float) -> None
Defines the abscissa and ordinate of the current position.
methodfpdf.fpdf.FPDF.set_y(y:float) -> None
Moves the current abscissa back to the left margin and sets the ordinate.
methodfpdf.fpdf.FPDF.solid_arc(x:float, y:float, a:float, start_angle:float, end_angle:float, b:Optional[float]=None, inclination:float=0, clockwise:bool=False, style:Optional[RenderStyle | str]=None) -> None
Outputs a solid arc.
methodfpdf.fpdf.FPDF.star(x:float, y:float, r_in:float, r_out:float, corners:int, rotate_degrees:float=0, style:Optional[RenderStyle | str]=None) -> None
Outputs a regular star with n corners.
methodfpdf.fpdf.FPDF.start_section(name:str, level:int=0, strict:bool=True) -> None
Start a section in the document outline.
methodfpdf.fpdf.FPDF.text(x:float, y:float, text:str='') -> None
Prints a character string.
methodfpdf.fpdf.FPDF.transform(transform:Transform) -> Generator[None, None, None]
Apply a transformation matrix to the current graphics state.
methodfpdf.fpdf.FPDF.use_pattern(shading:Gradient) -> Generator[None, None, None]
Create a context for using a shading pattern on the current page.
methodfpdf.fpdf.FPDF.write(h:Optional[float]=None, text:str='', link:Optional[str | int]='', print_sh:bool=False, wrapmode:WrapMode=WrapMode.WORD) -> bool
Prints text from the current position.
methodfpdf.fpdf.FPDF.write_html(text:str, *args:Any, **kwargs:Any) -> None
Parse HTML and convert it to PDF.
funcfpdf.fpdf.check_page(fn:Callable[P, R]) -> Callable[P, R]
Decorator to protect drawing methods
funcfpdf.fpdf.get_page_format(format:str | tuple[float, float], k:Optional[float]=None) -> tuple[float, float]
Return page width and height size in points.
classfpdf.graphics_state.GraphicsStateMixin
Mixin class for managing a stack of graphics state variables.
methodfpdf.graphics_state.GraphicsStateMixin.char_vpos() -> CharVPos
Return vertical character position relative to line.
methodfpdf.graphics_state.GraphicsStateMixin.denom_lift() -> float
Return lift factor for denominator text.
methodfpdf.graphics_state.GraphicsStateMixin.denom_scale() -> float
Return scale factor for denominator text.
methodfpdf.graphics_state.GraphicsStateMixin.nom_lift() -> float
Return lift factor for nominator text.
methodfpdf.graphics_state.GraphicsStateMixin.nom_scale() -> float
Return scale factor for nominator text.
methodfpdf.graphics_state.GraphicsStateMixin.sub_lift() -> float
Return lift factor for subscript text.
methodfpdf.graphics_state.GraphicsStateMixin.sub_scale() -> float
Return scale factor for subscript text.
methodfpdf.graphics_state.GraphicsStateMixin.sup_lift() -> float
Return lift factor for superscript text.
methodfpdf.graphics_state.GraphicsStateMixin.sup_scale() -> float
Return scale factor for superscript text.
classfpdf.html.HTML2FPDF
Render basic HTML to FPDF
methodfpdf.html.HTML2FPDF.put_link(text:str) -> None
Insert a hyperlink
funcfpdf.html.color_as_decimal(color:Optional[str]='#000000') -> Optional[DeviceRGB | DeviceGray]
Convert a web color name to a (R, G, B) color tuple.
funcfpdf.html.parse_css_style(style_attr:str) -> dict[str, str]
Parse `style="..."` HTML attributes, and return a dict of key-value
classfpdf.image_datastructures.ImageInfo
Information about an image used in the PDF document (base class).
methodfpdf.image_datastructures.ImageInfo.height() -> float
Intrinsic image height
methodfpdf.image_datastructures.ImageInfo.width() -> float
Intrinsic image width
classfpdf.image_datastructures.RasterImageInfo
Information about a raster image used in the PDF document
classfpdf.image_datastructures.VectorImageInfo
Information about a vector image used in the PDF document
funcfpdf.image_parsing.is_iccp_valid(iccp:bytes, filename:str | Path) -> bool
Checks the validity of an ICC profile
classfpdf.image_parsing.temp_attr
temporary change the attribute of an object using a context manager
funcfpdf.image_parsing.transcode_monochrome(img:'PILImage') -> bytes
Convert the open PIL.Image imgdata to compressed CCITT Group4 data.
funcfpdf.output.OutputProducer.esc(s:str) -> str
Return XML-escaped text suitable for XMP (attributes or text nodes).
classfpdf.output.PDFPageLabel
This will be displayed by some PDF readers to identify pages.
classfpdf.output.PDFXrefAndTrailer
Cross-reference table & file trailer
methodfpdf.pattern.Gradient.has_alpha() -> bool
True if any stop carries alpha != 1.0.
classfpdf.pattern.Pattern
Represents a PDF Pattern object.
classfpdf.pattern.Type2Function
Transition between 2 colors
classfpdf.pattern.Type2FunctionGray
1‑channel exponential interpolation for alpha/luminance ramps.
funcfpdf.pattern.extract_alpha_stops(stops01:list[tuple[float, Color]]) -> list[tuple[float, float]]
Return [(u, a)] with a∈[0,1]; missing alpha => 1.0.
funcfpdf.pattern.sample_stops(stops01:list[tuple[float, Color]], u:float) -> tuple[float, ...]
Piecewise-linear sampling in [0,1].
funcfpdf.pattern.spread_map(u:float, method:GradientSpreadMethod) -> float
Map u∈R -> [0,1] via PAD/REPEAT/REFLECT.
classfpdf.prefs.ViewerPreferences
Specifies the way the document shall be displayed on the screen
classfpdf.svg.Percent
class to represent percentage values
classfpdf.svg.SVGLimits
Configurable limits for SVG processing.
classfpdf.svg.SymbolInfo
Reusable SVG <symbol> sizing metadata.
funcfpdf.svg.convert_transforms(tfstr:str) -> Transform
Convert SVG/CSS transform functions into PDF transforms.
funcfpdf.svg.parse_viewbox(viewbox:str) -> tuple[float, float, float, float]
Parse an SVG viewBox into min-x, min-y, width, and height values.
funcfpdf.svg.resolve_angle(angle_str:str, default_unit:str='deg') -> float
Convert an angle value to our canonical angle unit, radians
funcfpdf.svg.resolve_length(length_str:str, default_unit:str='pt') -> float
Convert a length unit to our canonical length unit, pt.
funcfpdf.svg.without_ns(qualified_tag:str) -> str
Remove the xmlns namespace from a qualified XML tag name
funcfpdf.svg.xmlns(space:str, name:str) -> str
Create an XML namespace string representation for the given tag name.
funcfpdf.svg.xmlns_lookup(space:str, *names:str) -> dict[str, str]
Create a lookup for the given name in the given XML namespace.
funcfpdf.syntax.create_list_string(list_:list[str]) -> str
format list of strings as PDF array
funcfpdf.syntax.iobj_ref(n:int) -> str
format an indirect PDF Object reference from its id number
funcfpdf.syntax.render_pdf_primitive(primitive:PDFPrimitive) -> Raw
Render a Python value as a PDF primitive type.
classfpdf.table.Cell
Internal representation of a table cell
classfpdf.table.Row
Object that `Table.row()` yields, used to build a row in a table
methodfpdf.table.Table.row(cells:Sequence[str]=(), style:Optional[FontFace]=None, v_align:Optional[str | VAlign]=None, min_height:Optional[float]=None) -> 'Row'
Adds a row to the table.
classfpdf.template.FlexTemplate
A flexible templating class.
methodfpdf.template.FlexTemplate.load_elements(elements:Sequence[dict[str, Any]]) -> None
Load a template definition.
methodfpdf.template.FlexTemplate.parse_csv(infile:os.PathLike[str], delimiter:str=',', decimal_sep:str='.', encoding:Optional[str]=None) -> None
Load the template definition from a CSV file.
methodfpdf.template.FlexTemplate.parse_json(infile:os.PathLike[str], encoding:str='utf-8') -> None
Load the template definition from a JSON file.
methodfpdf.template.FlexTemplate.render(offsetx:float=0.0, offsety:float=0.0, rotate:float=0.0, scale:float=1.0) -> None
Add the contents of the template to the PDF document.
classfpdf.template.Template
A simple templating class.
methodfpdf.template.Template.add_page() -> None
Finish the current page, and proceed to the next one.
methodfpdf.template.Template.render(outfile:Optional[str]=None, dest:Optional[str]=None) -> None
Finish the document and process all pending data.
classfpdf.text_region.LineWrapper
Connects each TextLine with the Paragraph it was written to.
classfpdf.text_region.TextColumnarMixin
Enable a TextRegion to perform page breaks
classfpdf.text_region.TextRegion
Abstract base class for all text region subclasses.
methodfpdf.text_region.TextRegion.current_x_extents(y:float, height:float) -> tuple[float, float]
Return the horizontal extents of the current line.
classfpdf.text_region.TextRegionMixin
Mix-in to be added to FPDF() in order to support text regions.
classfpdf.util.FloatTolerance
Utility class for floating point math with a defined tolerance.
methodfpdf.util.FloatTolerance.equal(a:float, b:float) -> bool
Check if two floats are almost equal within the defined tolerance.
methodfpdf.util.FloatTolerance.greater_than(a:float, b:float) -> bool
Check if a is greater than b considering the defined tolerance.
methodfpdf.util.FloatTolerance.is_zero(a:float) -> bool
Check if a float is almost zero within the defined tolerance.
methodfpdf.util.FloatTolerance.less_than(a:float, b:float) -> bool
Check if a is less than b considering the defined tolerance.
methodfpdf.util.FloatTolerance.not_equal(a:float, b:float) -> bool
Check if two floats are not almost equal within the defined tolerance.
funcfpdf.util.get_parsed_unicode_range(unicode_range:str | Sequence[str | int | tuple[int, int]]) -> set[int]
Parse unicode_range parameter into a set of codepoints.
funcfpdf.util.get_scale_factor(unit:Union[str, Number]) -> float
Get how many pts are in a unit.
funcfpdf.util.int2roman(n:int) -> str
Convert an integer to Roman numeral
funcfpdf.util.number_to_str(number:Number) -> str
Convert a decimal number to a minimal string representation (no trailing 0 or .).

About this data

These signatures were extracted from the public source of py-pdf/fpdf2 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