Module fpdf.enums
Classes
class AccessPermission (*args, **kwds)
-
Expand source code Browse git
class AccessPermission(IntFlag): "Permission flags will translate as an integer on the encryption dictionary" PRINT_LOW_RES = 0b000000000100 "Print the document" MODIFY = 0b000000001000 "Modify the contents of the document" COPY = 0b000000010000 "Copy or extract text and graphics from the document" ANNOTATION = 0b000000100000 "Add or modify text annotations" FILL_FORMS = 0b000100000000 "Fill in existing interactive form fields" COPY_FOR_ACCESSIBILITY = 0b001000000000 "Extract text and graphics in support of accessibility to users with disabilities" ASSEMBLE = 0b010000000000 "Insert, rotate or delete pages and create bookmarks or thumbnail images" PRINT_HIGH_RES = 0b100000000000 "Print document at the highest resolution" @classmethod def all(cls): "All flags enabled" result = 0 for permission in list(AccessPermission): result = result | permission return result @classmethod def none(cls): "All flags disabled" return 0
Permission flags will translate as an integer on the encryption dictionary
Ancestors
- enum.IntFlag
- builtins.int
- enum.ReprEnum
- enum.Flag
- enum.Enum
Class variables
var ANNOTATION
-
Add or modify text annotations
var ASSEMBLE
-
Insert, rotate or delete pages and create bookmarks or thumbnail images
var COPY
-
Copy or extract text and graphics from the document
var COPY_FOR_ACCESSIBILITY
-
Extract text and graphics in support of accessibility to users with disabilities
var FILL_FORMS
-
Fill in existing interactive form fields
var MODIFY
-
Modify the contents of the document
var PRINT_HIGH_RES
-
Print document at the highest resolution
var PRINT_LOW_RES
-
Print the document
Static methods
def all()
-
All flags enabled
def none()
-
All flags disabled
class Align (*args, **kwds)
-
Expand source code Browse git
class Align(CoerciveEnum): "Defines how to render text in a cell" C = intern("CENTER") "Center text horizontally" X = intern("X_CENTER") "Center text horizontally around current x position" L = intern("LEFT") "Left-align text" R = intern("RIGHT") "Right-align text" J = intern("JUSTIFY") "Justify text" # pylint: disable=arguments-differ @classmethod def coerce(cls, value): if value == "": return cls.L if isinstance(value, str): value = value.upper() return super(cls, cls).coerce(value)
Defines how to render text in a cell
Ancestors
- CoerciveEnum
- enum.Enum
Class variables
var C
-
Center text horizontally
var J
-
Justify text
var L
-
Left-align text
var R
-
Right-align text
var X
-
Center text horizontally around current x position
Inherited members
class Angle (*args, **kwds)
-
Expand source code Browse git
class Angle(CoerciveIntEnum): "Direction values used for mirror transformations specifying the angle of mirror line" NORTH = 90 EAST = 0 SOUTH = 270 WEST = 180 NORTHEAST = 45 SOUTHEAST = 315 SOUTHWEST = 225 NORTHWEST = 135
Direction values used for mirror transformations specifying the angle of mirror line
Ancestors
- CoerciveIntEnum
- enum.IntEnum
- builtins.int
- enum.ReprEnum
- enum.Enum
Class variables
var EAST
-
The type of the None singleton.
var NORTH
-
The type of the None singleton.
var NORTHEAST
-
The type of the None singleton.
var NORTHWEST
-
The type of the None singleton.
var SOUTH
-
The type of the None singleton.
var SOUTHEAST
-
The type of the None singleton.
var SOUTHWEST
-
The type of the None singleton.
var WEST
-
The type of the None singleton.
Inherited members
class AnnotationFlag (*args, **kwds)
-
Expand source code Browse git
class AnnotationFlag(CoerciveIntEnum): INVISIBLE = 1 """ If set, do not display the annotation if it does not belong to one of the standard annotation types and no annotation handler is available. """ HIDDEN = 2 "If set, do not display or print the annotation or allow it to interact with the user" PRINT = 4 "If set, print the annotation when the page is printed." NO_ZOOM = 8 "If set, do not scale the annotation’s appearance to match the magnification of the page." NO_ROTATE = 16 "If set, do not rotate the annotation’s appearance to match the rotation of the page." NO_VIEW = 32 "If set, do not display the annotation on the screen or allow it to interact with the user" READ_ONLY = 64 """ If set, do not allow the annotation to interact with the user. The annotation may be displayed or printed but should not respond to mouse clicks. """ LOCKED = 128 """ If set, do not allow the annotation to be deleted or its properties (including position and size) to be modified by the user. """ TOGGLE_NO_VIEW = 256 "If set, invert the interpretation of the NoView flag for certain events." LOCKED_CONTENTS = 512 "If set, do not allow the contents of the annotation to be modified by the user."
An enumeration that provides a helper to coerce strings and integers into enumeration members.
Ancestors
- CoerciveIntEnum
- enum.IntEnum
- builtins.int
- enum.ReprEnum
- enum.Enum
Class variables
var HIDDEN
-
If set, do not display or print the annotation or allow it to interact with the user
var INVISIBLE
-
If set, do not display the annotation if it does not belong to one of the standard annotation types and no annotation handler is available.
var LOCKED
-
If set, do not allow the annotation to be deleted or its properties (including position and size) to be modified by the user.
var LOCKED_CONTENTS
-
If set, do not allow the contents of the annotation to be modified by the user.
var NO_ROTATE
-
If set, do not rotate the annotation’s appearance to match the rotation of the page.
var NO_VIEW
-
If set, do not display the annotation on the screen or allow it to interact with the user
var NO_ZOOM
-
If set, do not scale the annotation’s appearance to match the magnification of the page.
var PRINT
-
If set, print the annotation when the page is printed.
var READ_ONLY
-
If set, do not allow the annotation to interact with the user. The annotation may be displayed or printed but should not respond to mouse clicks.
var TOGGLE_NO_VIEW
-
If set, invert the interpretation of the NoView flag for certain events.
Inherited members
class AnnotationName (*args, **kwds)
-
Expand source code Browse git
class AnnotationName(CoerciveEnum): "The name of an icon that shall be used in displaying the annotation" NOTE = Name("Note") COMMENT = Name("Comment") HELP = Name("Help") PARAGRAPH = Name("Paragraph") NEW_PARAGRAPH = Name("NewParagraph") INSERT = Name("Insert")
The name of an icon that shall be used in displaying the annotation
Ancestors
- CoerciveEnum
- enum.Enum
Class variables
var COMMENT
-
The type of the None singleton.
var HELP
-
The type of the None singleton.
var INSERT
-
The type of the None singleton.
var NEW_PARAGRAPH
-
The type of the None singleton.
var NOTE
-
The type of the None singleton.
var PARAGRAPH
-
The type of the None singleton.
Inherited members
class BlendMode (*args, **kwds)
-
Expand source code Browse git
class BlendMode(CoerciveEnum): "An enumeration of the named standard named blend functions supported by PDF." NORMAL = Name("Normal") '''"Selects the source color, ignoring the backdrop."''' MULTIPLY = Name("Multiply") '''"Multiplies the backdrop and source color values."''' SCREEN = Name("Screen") """ "Multiplies the complements of the backdrop and source color values, then complements the result." """ OVERLAY = Name("Overlay") """ "Multiplies or screens the colors, depending on the backdrop color value. Source colors overlay the backdrop while preserving its highlights and shadows. The backdrop color is not replaced but is mixed with the source color to reflect the lightness or darkness of the backdrop." """ DARKEN = Name("Darken") '''"Selects the darker of the backdrop and source colors."''' LIGHTEN = Name("Lighten") '''"Selects the lighter of the backdrop and source colors."''' COLOR_DODGE = Name("ColorDodge") """ "Brightens the backdrop color to reflect the source color. Painting with black produces no changes." """ COLOR_BURN = Name("ColorBurn") """ "Darkens the backdrop color to reflect the source color. Painting with white produces no change." """ HARD_LIGHT = Name("HardLight") """ "Multiplies or screens the colors, depending on the source color value. The effect is similar to shining a harsh spotlight on the backdrop." """ SOFT_LIGHT = Name("SoftLight") """ "Darkens or lightens the colors, depending on the source color value. The effect is similar to shining a diffused spotlight on the backdrop." """ DIFFERENCE = Name("Difference") '''"Subtracts the darker of the two constituent colors from the lighter color."''' EXCLUSION = Name("Exclusion") """ "Produces an effect similar to that of the Difference mode but lower in contrast. Painting with white inverts the backdrop color; painting with black produces no change." """ HUE = Name("Hue") """ "Creates a color with the hue of the source color and the saturation and luminosity of the backdrop color." """ SATURATION = Name("Saturation") """ "Creates a color with the saturation of the source color and the hue and luminosity of the backdrop color. Painting with this mode in an area of the backdrop that is a pure gray (no saturation) produces no change." """ COLOR = Name("Color") """ "Creates a color with the hue and saturation of the source color and the luminosity of the backdrop color. This preserves the gray levels of the backdrop and is useful for coloring monochrome images or tinting color images." """ LUMINOSITY = Name("Luminosity") """ "Creates a color with the luminosity of the source color and the hue and saturation of the backdrop color. This produces an inverse effect to that of the Color mode." """
An enumeration of the named standard named blend functions supported by PDF.
Ancestors
- CoerciveEnum
- enum.Enum
Class variables
var COLOR
-
"Creates a color with the hue and saturation of the source color and the luminosity of the backdrop color. This preserves the gray levels of the backdrop and is useful for coloring monochrome images or tinting color images."
var COLOR_BURN
-
"Darkens the backdrop color to reflect the source color. Painting with white produces no change."
var COLOR_DODGE
-
"Brightens the backdrop color to reflect the source color. Painting with black produces no changes."
var DARKEN
-
"Selects the darker of the backdrop and source colors."
var DIFFERENCE
-
"Subtracts the darker of the two constituent colors from the lighter color."
var EXCLUSION
-
"Produces an effect similar to that of the Difference mode but lower in contrast. Painting with white inverts the backdrop color; painting with black produces no change."
var HARD_LIGHT
-
"Multiplies or screens the colors, depending on the source color value. The effect is similar to shining a harsh spotlight on the backdrop."
var HUE
-
"Creates a color with the hue of the source color and the saturation and luminosity of the backdrop color."
var LIGHTEN
-
"Selects the lighter of the backdrop and source colors."
var LUMINOSITY
-
"Creates a color with the luminosity of the source color and the hue and saturation of the backdrop color. This produces an inverse effect to that of the Color mode."
var MULTIPLY
-
"Multiplies the backdrop and source color values."
var NORMAL
-
"Selects the source color, ignoring the backdrop."
var OVERLAY
-
"Multiplies or screens the colors, depending on the backdrop color value. Source colors overlay the backdrop while preserving its highlights and shadows. The backdrop color is not replaced but is mixed with the source color to reflect the lightness or darkness of the backdrop."
var SATURATION
-
"Creates a color with the saturation of the source color and the hue and luminosity of the backdrop color. Painting with this mode in an area of the backdrop that is a pure gray (no saturation) produces no change."
var SCREEN
-
"Multiplies the complements of the backdrop and source color values, then complements the result."
var SOFT_LIGHT
-
"Darkens or lightens the colors, depending on the source color value. The effect is similar to shining a diffused spotlight on the backdrop."
Inherited members
class CellBordersLayout (*args, **kwds)
-
Expand source code Browse git
class CellBordersLayout(CoerciveIntFlag): """Defines how to render cell borders in table The integer value of `border` determines which borders are applied. Below are some common examples: - border=1 (LEFT): Only the left border is enabled. - border=3 (LEFT | RIGHT): Both the left and right borders are enabled. - border=5 (LEFT | TOP): The left and top borders are enabled. - border=12 (TOP | BOTTOM): The top and bottom borders are enabled. - border=15 (ALL): All borders (left, right, top, bottom) are enabled. - border=16 (INHERIT): Inherit the border settings from the parent element. Using `border=3` will combine LEFT and RIGHT borders, as it represents the bitwise OR of `LEFT (1)` and `RIGHT (2)`. """ NONE = 0 "Draw no border on any side of cell" LEFT = 1 "Draw border on the left side of the cell" RIGHT = 2 "Draw border on the right side of the cell" TOP = 4 "Draw border on the top side of the cell" BOTTOM = 8 "Draw border on the bottom side of the cell" ALL = LEFT | RIGHT | TOP | BOTTOM "Draw border on all side of the cell" INHERIT = 16 "Inherits the border layout from the table borders layout" @classmethod def coerce(cls, value): if isinstance(value, int) and value > 16: raise ValueError("INHERIT cannot be combined with other values") return super().coerce(value) def __and__(self, value): value = super().__and__(value) if value > 16: raise ValueError("INHERIT cannot be combined with other values") return value def __or__(self, value): value = super().__or__(value) if value > 16: raise ValueError("INHERIT cannot be combined with other values") return value def __str__(self): border_str = [] if self & CellBordersLayout.LEFT: border_str.append("L") if self & CellBordersLayout.RIGHT: border_str.append("R") if self & CellBordersLayout.TOP: border_str.append("T") if self & CellBordersLayout.BOTTOM: border_str.append("B") return "".join(border_str) if border_str else "NONE"
Defines how to render cell borders in table
The integer value of
border
determines which borders are applied. Below are some common examples:- border=1 (LEFT): Only the left border is enabled.
- border=3 (LEFT | RIGHT): Both the left and right borders are enabled.
- border=5 (LEFT | TOP): The left and top borders are enabled.
- border=12 (TOP | BOTTOM): The top and bottom borders are enabled.
- border=15 (ALL): All borders (left, right, top, bottom) are enabled.
- border=16 (INHERIT): Inherit the border settings from the parent element.
Using
border=3
will combine LEFT and RIGHT borders, as it represents the bitwise OR ofLEFT (1)
andRIGHT (2)
.Ancestors
- CoerciveIntFlag
- enum.IntFlag
- builtins.int
- enum.ReprEnum
- enum.Flag
- enum.Enum
Class variables
var ALL
-
Draw border on all side of the cell
var BOTTOM
-
Draw border on the bottom side of the cell
var INHERIT
-
Inherits the border layout from the table borders layout
var LEFT
-
Draw border on the left side of the cell
var NONE
-
Draw no border on any side of cell
var RIGHT
-
Draw border on the right side of the cell
var TOP
-
Draw border on the top side of the cell
Inherited members
class CharVPos (*args, **kwds)
-
Expand source code Browse git
class CharVPos(CoerciveEnum): "Defines the vertical position of text relative to the line." SUP = intern("SUP") "Superscript" SUB = intern("SUB") "Subscript" NOM = intern("NOM") "Nominator of a fraction" DENOM = intern("DENOM") "Denominator of a fraction" LINE = intern("LINE") "Default line position"
Defines the vertical position of text relative to the line.
Ancestors
- CoerciveEnum
- enum.Enum
Class variables
var DENOM
-
Denominator of a fraction
var LINE
-
Default line position
var NOM
-
Nominator of a fraction
var SUB
-
Subscript
var SUP
-
Superscript
Inherited members
class ClippingPathIntersectionRule (*args, **kwds)
-
Expand source code Browse git
class ClippingPathIntersectionRule(CoerciveEnum): "An enumeration of the PDF drawing directives that define a path as a clipping path." NONZERO = "W" """ "The nonzero winding number rule determines whether a given point is inside a path by conceptually drawing a ray from that point to infinity in any direction and then examining the places where a segment of the path crosses the ray. Starting with a count of 0, the rule adds 1 each time a path segment crosses the ray from left to right and subtracts 1 each time a segment crosses from right to left. After counting all the crossings, if the result is 0, the point is outside the path; otherwise, it is inside." """ EVENODD = "W*" """ "An alternative to the nonzero winding number rule is the even-odd rule. This rule determines whether a point is inside a path by drawing a ray from that point in any direction and simply counting the number of path segments that cross the ray, regardless of direction. If this number is odd, the point is inside; if even, the point is outside. This yields the same results as the nonzero winding number rule for paths with simple shapes, but produces different results for more complex shapes."""
An enumeration of the PDF drawing directives that define a path as a clipping path.
Ancestors
- CoerciveEnum
- enum.Enum
Class variables
var EVENODD
-
"An alternative to the nonzero winding number rule is the even-odd rule. This rule determines whether a point is inside a path by drawing a ray from that point in any direction and simply counting the number of path segments that cross the ray, regardless of direction. If this number is odd, the point is inside; if even, the point is outside. This yields the same results as the nonzero winding number rule for paths with simple shapes, but produces different results for more complex shapes.
var NONZERO
-
"The nonzero winding number rule determines whether a given point is inside a path by conceptually drawing a ray from that point to infinity in any direction and then examining the places where a segment of the path crosses the ray. Starting with a count of 0, the rule adds 1 each time a path segment crosses the ray from left to right and subtracts 1 each time a segment crosses from right to left. After counting all the crossings, if the result is 0, the point is outside the path; otherwise, it is inside."
Inherited members
class CoerciveEnum (*args, **kwds)
-
Expand source code Browse git
class CoerciveEnum(Enum): "An enumeration that provides a helper to coerce strings into enumeration members." @classmethod def coerce(cls, value, case_sensitive=False): """ Attempt to coerce `value` into a member of this enumeration. If value is already a member of this enumeration it is returned unchanged. Otherwise, if it is a string, attempt to convert it as an enumeration value. If that fails, attempt to convert it (case insensitively, by upcasing) as an enumeration name. If all different conversion attempts fail, an exception is raised. Args: value (Enum, str): the value to be coerced. Raises: ValueError: if `value` is a string but neither a member by name nor value. TypeError: if `value`'s type is neither a member of the enumeration nor a string. """ if isinstance(value, cls): return value if isinstance(value, str): try: return cls(value) except ValueError: pass try: return cls[value] if case_sensitive else cls[value.upper()] except KeyError: pass raise ValueError(f"{value} is not a valid {cls.__name__}") raise TypeError(f"{value} cannot be converted to a {cls.__name__}")
An enumeration that provides a helper to coerce strings into enumeration members.
Ancestors
- enum.Enum
Subclasses
- Align
- AnnotationName
- BlendMode
- CharVPos
- ClippingPathIntersectionRule
- Corner
- Duplex
- FileAttachmentAnnotationName
- IntersectionRule
- PageBoundaries
- PageLabelStyle
- PageLayout
- PageMode
- PageOrientation
- PathPaintRule
- RenderStyle
- TableBordersLayout
- TableCellFillMode
- TableSpan
- TextDirection
- TextMarkupType
- VAlign
- WrapMode
- XPos
- YPos
Static methods
def coerce(value, case_sensitive=False)
-
Attempt to coerce
value
into a member of this enumeration.If value is already a member of this enumeration it is returned unchanged. Otherwise, if it is a string, attempt to convert it as an enumeration value. If that fails, attempt to convert it (case insensitively, by upcasing) as an enumeration name.
If all different conversion attempts fail, an exception is raised.
Args
value
:Enum, str
- the value to be coerced.
Raises
ValueError
- if
value
is a string but neither a member by name nor value. TypeError
- if
value
's type is neither a member of the enumeration nor a string.
class CoerciveIntEnum (*args, **kwds)
-
Expand source code Browse git
class CoerciveIntEnum(IntEnum): """ An enumeration that provides a helper to coerce strings and integers into enumeration members. """ @classmethod def coerce(cls, value): """ Attempt to coerce `value` into a member of this enumeration. If value is already a member of this enumeration it is returned unchanged. Otherwise, if it is a string, attempt to convert it (case insensitively, by upcasing) as an enumeration name. Otherwise, if it is an int, attempt to convert it as an enumeration value. Otherwise, an exception is raised. Args: value (IntEnum, str, int): the value to be coerced. Raises: ValueError: if `value` is an int but not a member of this enumeration. ValueError: if `value` is a string but not a member by name. TypeError: if `value`'s type is neither a member of the enumeration nor an int or a string. """ if isinstance(value, cls): return value if isinstance(value, str): try: return cls[value.upper()] except KeyError: raise ValueError(f"{value} is not a valid {cls.__name__}") from None if isinstance(value, int): return cls(value) raise TypeError(f"{value} cannot convert to a {cls.__name__}")
An enumeration that provides a helper to coerce strings and integers into enumeration members.
Ancestors
- enum.IntEnum
- builtins.int
- enum.ReprEnum
- enum.Enum
Subclasses
Static methods
def coerce(value)
-
Attempt to coerce
value
into a member of this enumeration.If value is already a member of this enumeration it is returned unchanged. Otherwise, if it is a string, attempt to convert it (case insensitively, by upcasing) as an enumeration name. Otherwise, if it is an int, attempt to convert it as an enumeration value.
Otherwise, an exception is raised.
Args
value
:IntEnum, str, int
- the value to be coerced.
Raises
ValueError
- if
value
is an int but not a member of this enumeration. ValueError
- if
value
is a string but not a member by name. TypeError
- if
value
's type is neither a member of the enumeration nor an int or a string.
class CoerciveIntFlag (*args, **kwds)
-
Expand source code Browse git
class CoerciveIntFlag(IntFlag): """ Enumerated constants that can be combined using the bitwise operators, with a helper to coerce strings and integers into enumeration members. """ @classmethod def coerce(cls, value): """ Attempt to coerce `value` into a member of this enumeration. If value is already a member of this enumeration it is returned unchanged. Otherwise, if it is a string, attempt to convert it (case insensitively, by upcasing) as an enumeration name. Otherwise, if it is an int, attempt to convert it as an enumeration value. Otherwise, an exception is raised. Args: value (IntEnum, str, int): the value to be coerced. Raises: ValueError: if `value` is an int but not a member of this enumeration. ValueError: if `value` is a string but not a member by name. TypeError: if `value`'s type is neither a member of the enumeration nor an int or a string. """ if isinstance(value, cls): return value if isinstance(value, str): try: return cls[value.upper()] except KeyError: pass try: flags = cls[value[0].upper()] for char in value[1:]: flags = flags | cls[char.upper()] return flags except KeyError: raise ValueError(f"{value} is not a valid {cls.__name__}") from None if isinstance(value, int): return cls(value) raise TypeError(f"{value} cannot convert to a {cls.__name__}")
Enumerated constants that can be combined using the bitwise operators, with a helper to coerce strings and integers into enumeration members.
Ancestors
- enum.IntFlag
- builtins.int
- enum.ReprEnum
- enum.Flag
- enum.Enum
Subclasses
Static methods
def coerce(value)
-
Attempt to coerce
value
into a member of this enumeration.If value is already a member of this enumeration it is returned unchanged. Otherwise, if it is a string, attempt to convert it (case insensitively, by upcasing) as an enumeration name. Otherwise, if it is an int, attempt to convert it as an enumeration value. Otherwise, an exception is raised.
Args
value
:IntEnum, str, int
- the value to be coerced.
Raises
ValueError
- if
value
is an int but not a member of this enumeration. ValueError
- if
value
is a string but not a member by name. TypeError
- if
value
's type is neither a member of the enumeration nor an int or a string.
class Corner (*args, **kwds)
-
Expand source code Browse git
class Corner(CoerciveEnum): TOP_RIGHT = "TOP_RIGHT" TOP_LEFT = "TOP_LEFT" BOTTOM_RIGHT = "BOTTOM_RIGHT" BOTTOM_LEFT = "BOTTOM_LEFT"
An enumeration that provides a helper to coerce strings into enumeration members.
Ancestors
- CoerciveEnum
- enum.Enum
Class variables
var BOTTOM_LEFT
-
The type of the None singleton.
var BOTTOM_RIGHT
-
The type of the None singleton.
var TOP_LEFT
-
The type of the None singleton.
var TOP_RIGHT
-
The type of the None singleton.
Inherited members
class Duplex (*args, **kwds)
-
Expand source code Browse git
class Duplex(CoerciveEnum): "The paper handling option that shall be used when printing the file from the print dialog." SIMPLEX = Name("Simplex") "Print single-sided" DUPLEX_FLIP_SHORT_EDGE = Name("DuplexFlipShortEdge") "Duplex and flip on the short edge of the sheet" DUPLEX_FLIP_LONG_EDGE = Name("DuplexFlipLongEdge") "Duplex and flip on the long edge of the sheet"
The paper handling option that shall be used when printing the file from the print dialog.
Ancestors
- CoerciveEnum
- enum.Enum
Class variables
var DUPLEX_FLIP_LONG_EDGE
-
Duplex and flip on the long edge of the sheet
var DUPLEX_FLIP_SHORT_EDGE
-
Duplex and flip on the short edge of the sheet
var SIMPLEX
-
Print single-sided
Inherited members
class EncryptionMethod (*args, **kwds)
-
Expand source code Browse git
class EncryptionMethod(Enum): "Algorithm to be used to encrypt the document" NO_ENCRYPTION = 0 RC4 = 1 AES_128 = 2 AES_256 = 3
Algorithm to be used to encrypt the document
Ancestors
- enum.Enum
Class variables
var AES_128
-
The type of the None singleton.
var AES_256
-
The type of the None singleton.
var NO_ENCRYPTION
-
The type of the None singleton.
var RC4
-
The type of the None singleton.
class FileAttachmentAnnotationName (*args, **kwds)
-
Expand source code Browse git
class FileAttachmentAnnotationName(CoerciveEnum): "The name of an icon that shall be used in displaying the annotation" PUSH_PIN = Name("PushPin") GRAPH_PUSH_PIN = Name("GraphPushPin") PAPERCLIP_TAG = Name("PaperclipTag")
The name of an icon that shall be used in displaying the annotation
Ancestors
- CoerciveEnum
- enum.Enum
Class variables
var GRAPH_PUSH_PIN
-
The type of the None singleton.
var PAPERCLIP_TAG
-
The type of the None singleton.
var PUSH_PIN
-
The type of the None singleton.
Inherited members
class FontDescriptorFlags (*args, **kwds)
-
Expand source code Browse git
class FontDescriptorFlags(Flag): """An enumeration of the flags for the unsigned 32-bit integer entry in the font descriptor specifying various characteristics of the font. Bit positions are numbered from 1 (low-order) to 32 (high-order). """ FIXED_PITCH = 0x0000001 """ "All glyphs have the same width (as opposed to proportional or variable-pitch fonts, which have different widths." """ SYMBOLIC = 0x0000004 """ "Font contains glyphs outside the Adobe standard Latin character set. This flag and the Nonsymbolic flag shall not both be set or both be clear." """ ITALIC = 0x0000040 """ "Glyphs have dominant vertical strokes that are slanted." """ FORCE_BOLD = 0x0040000 """ "The flag shall determine whether bold glyphs shall be painted with extra pixels even at very small text sizes by a conforming reader. If set, features of bold glyphs may be thickened at small text sizes." """
An enumeration of the flags for the unsigned 32-bit integer entry in the font descriptor specifying various characteristics of the font. Bit positions are numbered from 1 (low-order) to 32 (high-order).
Ancestors
- enum.Flag
- enum.Enum
Class variables
var FIXED_PITCH
-
"All glyphs have the same width (as opposed to proportional or variable-pitch fonts, which have different widths."
var FORCE_BOLD
-
"The flag shall determine whether bold glyphs shall be painted with extra pixels even at very small text sizes by a conforming reader. If set, features of bold glyphs may be thickened at small text sizes."
var ITALIC
-
"Glyphs have dominant vertical strokes that are slanted."
var SYMBOLIC
-
"Font contains glyphs outside the Adobe standard Latin character set. This flag and the Nonsymbolic flag shall not both be set or both be clear."
class IntersectionRule (*args, **kwds)
-
Expand source code Browse git
class IntersectionRule(CoerciveEnum): """ An enumeration representing the two possible PDF intersection rules. The intersection rule is used by the renderer to determine which points are considered to be inside the path and which points are outside the path. This primarily affects fill rendering and clipping paths. """ NONZERO = "nonzero" """ "The nonzero winding number rule determines whether a given point is inside a path by conceptually drawing a ray from that point to infinity in any direction and then examining the places where a segment of the path crosses the ray. Starting with a count of 0, the rule adds 1 each time a path segment crosses the ray from left to right and subtracts 1 each time a segment crosses from right to left. After counting all the crossings, if the result is 0, the point is outside the path; otherwise, it is inside." """ EVENODD = "evenodd" """ "An alternative to the nonzero winding number rule is the even-odd rule. This rule determines whether a point is inside a path by drawing a ray from that point in any direction and simply counting the number of path segments that cross the ray, regardless of direction. If this number is odd, the point is inside; if even, the point is outside. This yields the same results as the nonzero winding number rule for paths with simple shapes, but produces different results for more complex shapes." """
An enumeration representing the two possible PDF intersection rules.
The intersection rule is used by the renderer to determine which points are considered to be inside the path and which points are outside the path. This primarily affects fill rendering and clipping paths.
Ancestors
- CoerciveEnum
- enum.Enum
Class variables
var EVENODD
-
"An alternative to the nonzero winding number rule is the even-odd rule. This rule determines whether a point is inside a path by drawing a ray from that point in any direction and simply counting the number of path segments that cross the ray, regardless of direction. If this number is odd, the point is inside; if even, the point is outside. This yields the same results as the nonzero winding number rule for paths with simple shapes, but produces different results for more complex shapes."
var NONZERO
-
"The nonzero winding number rule determines whether a given point is inside a path by conceptually drawing a ray from that point to infinity in any direction and then examining the places where a segment of the path crosses the ray. Starting with a count of 0, the rule adds 1 each time a path segment crosses the ray from left to right and subtracts 1 each time a segment crosses from right to left. After counting all the crossings, if the result is 0, the point is outside the path; otherwise, it is inside."
Inherited members
class MethodReturnValue (*args, **kwds)
-
Expand source code Browse git
class MethodReturnValue(CoerciveIntFlag): """ Defines the return value(s) of a FPDF content-rendering method. This enum values can be combined with & and | operators: PAGE_BREAK | LINES """ PAGE_BREAK = 1 "The method will return a boolean indicating if a page break occured" LINES = 2 "The method will return a multi-lines array of strings, after performing word-wrapping" HEIGHT = 4 "The method will return how much vertical space was used"
Defines the return value(s) of a FPDF content-rendering method.
This enum values can be combined with & and | operators: PAGE_BREAK | LINES
Ancestors
- CoerciveIntFlag
- enum.IntFlag
- builtins.int
- enum.ReprEnum
- enum.Flag
- enum.Enum
Class variables
var HEIGHT
-
The method will return how much vertical space was used
var LINES
-
The method will return a multi-lines array of strings, after performing word-wrapping
var PAGE_BREAK
-
The method will return a boolean indicating if a page break occured
Inherited members
class PDFStyleKeys (*args, **kwds)
-
Expand source code Browse git
class PDFStyleKeys(Enum): "An enumeration of the graphics state parameter dictionary keys." FILL_ALPHA = Name("ca") BLEND_MODE = Name("BM") # shared between stroke and fill STROKE_ALPHA = Name("CA") STROKE_ADJUSTMENT = Name("SA") STROKE_WIDTH = Name("LW") STROKE_CAP_STYLE = Name("LC") STROKE_JOIN_STYLE = Name("LJ") STROKE_MITER_LIMIT = Name("ML") STROKE_DASH_PATTERN = Name("D") # array of array, number, e.g. [[1 1] 0]
An enumeration of the graphics state parameter dictionary keys.
Ancestors
- enum.Enum
Class variables
var BLEND_MODE
-
The type of the None singleton.
var FILL_ALPHA
-
The type of the None singleton.
var STROKE_ADJUSTMENT
-
The type of the None singleton.
var STROKE_ALPHA
-
The type of the None singleton.
var STROKE_CAP_STYLE
-
The type of the None singleton.
var STROKE_DASH_PATTERN
-
The type of the None singleton.
var STROKE_JOIN_STYLE
-
The type of the None singleton.
var STROKE_MITER_LIMIT
-
The type of the None singleton.
var STROKE_WIDTH
-
The type of the None singleton.
class PageBoundaries (*args, **kwds)
-
Expand source code Browse git
class PageBoundaries(CoerciveEnum): ART_BOX = Name("ArtBox") BLEED_BOX = Name("BleedBox") CROP_BOX = Name("CropBox") MEDIA_BOX = Name("MediaBox") TRIM_BOX = Name("TrimBox")
An enumeration that provides a helper to coerce strings into enumeration members.
Ancestors
- CoerciveEnum
- enum.Enum
Class variables
var ART_BOX
-
The type of the None singleton.
var BLEED_BOX
-
The type of the None singleton.
var CROP_BOX
-
The type of the None singleton.
var MEDIA_BOX
-
The type of the None singleton.
var TRIM_BOX
-
The type of the None singleton.
Inherited members
class PageLabelStyle (*args, **kwds)
-
Expand source code Browse git
class PageLabelStyle(CoerciveEnum): "Style of the page label" NUMBER = intern("D") "decimal arabic numerals" UPPER_ROMAN = intern("R") "uppercase roman numerals" LOWER_ROMAN = intern("r") "lowercase roman numerals" UPPER_LETTER = intern("A") "uppercase letters A to Z, AA to ZZ, AAA to ZZZ and so on" LOWER_LETTER = intern("a") "uppercase letters a to z, aa to zz, aaa to zzz and so on" NONE = None "no label"
Style of the page label
Ancestors
- CoerciveEnum
- enum.Enum
Class variables
var LOWER_LETTER
-
uppercase letters a to z, aa to zz, aaa to zzz and so on
var LOWER_ROMAN
-
lowercase roman numerals
var NONE
-
no label
var NUMBER
-
decimal arabic numerals
var UPPER_LETTER
-
uppercase letters A to Z, AA to ZZ, AAA to ZZZ and so on
var UPPER_ROMAN
-
uppercase roman numerals
Inherited members
class PageLayout (*args, **kwds)
-
Expand source code Browse git
class PageLayout(CoerciveEnum): "Specify the page layout shall be used when the document is opened" SINGLE_PAGE = Name("SinglePage") "Display one page at a time" ONE_COLUMN = Name("OneColumn") "Display the pages in one column" TWO_COLUMN_LEFT = Name("TwoColumnLeft") "Display the pages in two columns, with odd-numbered pages on the left" TWO_COLUMN_RIGHT = Name("TwoColumnRight") "Display the pages in two columns, with odd-numbered pages on the right" TWO_PAGE_LEFT = Name("TwoPageLeft") "Display the pages two at a time, with odd-numbered pages on the left" TWO_PAGE_RIGHT = Name("TwoPageRight") "Display the pages two at a time, with odd-numbered pages on the right"
Specify the page layout shall be used when the document is opened
Ancestors
- CoerciveEnum
- enum.Enum
Class variables
var ONE_COLUMN
-
Display the pages in one column
var SINGLE_PAGE
-
Display one page at a time
var TWO_COLUMN_LEFT
-
Display the pages in two columns, with odd-numbered pages on the left
var TWO_COLUMN_RIGHT
-
Display the pages in two columns, with odd-numbered pages on the right
var TWO_PAGE_LEFT
-
Display the pages two at a time, with odd-numbered pages on the left
var TWO_PAGE_RIGHT
-
Display the pages two at a time, with odd-numbered pages on the right
Inherited members
class PageMode (*args, **kwds)
-
Expand source code Browse git
class PageMode(CoerciveEnum): "Specifying how to display the document on exiting full-screen mode" USE_NONE = Name("UseNone") "Neither document outline nor thumbnail images visible" USE_OUTLINES = Name("UseOutlines") "Document outline visible" USE_THUMBS = Name("UseThumbs") "Thumbnail images visible" FULL_SCREEN = Name("FullScreen") "Full-screen mode, with no menu bar, window controls, or any other window visible" USE_OC = Name("UseOC") "Optional content group panel visible" USE_ATTACHMENTS = Name("UseAttachments") "Attachments panel visible"
Specifying how to display the document on exiting full-screen mode
Ancestors
- CoerciveEnum
- enum.Enum
Class variables
var FULL_SCREEN
-
Full-screen mode, with no menu bar, window controls, or any other window visible
var USE_ATTACHMENTS
-
Attachments panel visible
var USE_NONE
-
Neither document outline nor thumbnail images visible
var USE_OC
-
Optional content group panel visible
var USE_OUTLINES
-
Document outline visible
var USE_THUMBS
-
Thumbnail images visible
Inherited members
class PageOrientation (*args, **kwds)
-
Expand source code Browse git
class PageOrientation(CoerciveEnum): PORTRAIT = intern("P") LANDSCAPE = intern("L") # pylint: disable=arguments-differ @classmethod def coerce(cls, value): if isinstance(value, str): value = value.upper() return super(cls, cls).coerce(value)
An enumeration that provides a helper to coerce strings into enumeration members.
Ancestors
- CoerciveEnum
- enum.Enum
Class variables
var LANDSCAPE
-
The type of the None singleton.
var PORTRAIT
-
The type of the None singleton.
Inherited members
class PathPaintRule (*args, **kwds)
-
Expand source code Browse git
class PathPaintRule(CoerciveEnum): """ An enumeration of the PDF drawing directives that determine how the renderer should paint a given path. """ # the auto-close paint rules are omitted here because it's easier to just emit # close operators when appropriate, programmatically STROKE = "S" '''"Stroke the path."''' FILL_NONZERO = "f" """ "Fill the path, using the nonzero winding number rule to determine the region to fill. Any subpaths that are open are implicitly closed before being filled." """ FILL_EVENODD = "f*" """ "Fill the path, using the even-odd rule to determine the region to fill. Any subpaths that are open are implicitly closed before being filled." """ STROKE_FILL_NONZERO = "B" """ "Fill and then stroke the path, using the nonzero winding number rule to determine the region to fill. This operator produces the same result as constructing two identical path objects, painting the first with `FILL_NONZERO` and the second with `STROKE`." """ STROKE_FILL_EVENODD = "B*" """ "Fill and then stroke the path, using the even-odd rule to determine the region to fill. This operator produces the same result as `STROKE_FILL_NONZERO`, except that the path is filled as if with `FILL_EVENODD` instead of `FILL_NONZERO`." """ DONT_PAINT = "n" """ "End the path object without filling or stroking it. This operator is a path-painting no-op, used primarily for the side effect of changing the current clipping path." """ AUTO = "auto" """ Automatically determine which `PathPaintRule` should be used. PaintedPath will select one of the above `PathPaintRule`s based on the resolved set/inherited values of its style property. """
An enumeration of the PDF drawing directives that determine how the renderer should paint a given path.
Ancestors
- CoerciveEnum
- enum.Enum
Class variables
var AUTO
-
Automatically determine which
PathPaintRule
should be used.PaintedPath will select one of the above
PathPaintRule
s based on the resolved set/inherited values of its style property. var DONT_PAINT
-
"End the path object without filling or stroking it. This operator is a path-painting no-op, used primarily for the side effect of changing the current clipping path."
var FILL_EVENODD
-
"Fill the path, using the even-odd rule to determine the region to fill. Any subpaths that are open are implicitly closed before being filled."
var FILL_NONZERO
-
"Fill the path, using the nonzero winding number rule to determine the region to fill. Any subpaths that are open are implicitly closed before being filled."
var STROKE
-
"Stroke the path."
var STROKE_FILL_EVENODD
-
"Fill and then stroke the path, using the even-odd rule to determine the region to fill. This operator produces the same result as
STROKE_FILL_NONZERO
, except that the path is filled as if withFILL_EVENODD
instead ofFILL_NONZERO
." var STROKE_FILL_NONZERO
-
"Fill and then stroke the path, using the nonzero winding number rule to determine the region to fill. This operator produces the same result as constructing two identical path objects, painting the first with
FILL_NONZERO
and the second withSTROKE
."
Inherited members
class RenderStyle (*args, **kwds)
-
Expand source code Browse git
class RenderStyle(CoerciveEnum): "Defines how to render shapes" D = intern("DRAW") """ Draw lines. Line color can be controlled with `fpdf.fpdf.FPDF.set_draw_color()`. Line thickness can be controlled with `fpdf.fpdf.FPDF.set_line_width()`. """ F = intern("FILL") """ Fill areas. Filling color can be controlled with `fpdf.fpdf.FPDF.set_fill_color()`. """ DF = intern("DRAW_FILL") "Draw lines and fill areas" @property def operator(self): return {self.D: "S", self.F: "f", self.DF: "B"}[self] @property def is_draw(self): return self in (self.D, self.DF) @property def is_fill(self): return self in (self.F, self.DF) # pylint: disable=arguments-differ @classmethod def coerce(cls, value): if not value: return cls.D if value == "FD": value = "DF" return super(cls, cls).coerce(value)
Defines how to render shapes
Ancestors
- CoerciveEnum
- enum.Enum
Class variables
var D
-
Draw lines. Line color can be controlled with
FPDF.set_draw_color()
. Line thickness can be controlled withFPDF.set_line_width()
. var DF
-
Draw lines and fill areas
var F
-
Fill areas. Filling color can be controlled with
FPDF.set_fill_color()
.
Instance variables
prop is_draw
-
Expand source code Browse git
@property def is_draw(self): return self in (self.D, self.DF)
prop is_fill
-
Expand source code Browse git
@property def is_fill(self): return self in (self.F, self.DF)
prop operator
-
Expand source code Browse git
@property def operator(self): return {self.D: "S", self.F: "f", self.DF: "B"}[self]
Inherited members
class SignatureFlag (*args, **kwds)
-
Expand source code Browse git
class SignatureFlag(IntEnum): SIGNATURES_EXIST = 1 "If set, the document contains at least one signature field." APPEND_ONLY = 2 """ If set, the document contains signatures that may be invalidated if the file is saved (written) in a way that alters its previous contents, as opposed to an incremental update. """
Enum where members are also (and must be) ints
Ancestors
- enum.IntEnum
- builtins.int
- enum.ReprEnum
- enum.Enum
Class variables
var APPEND_ONLY
-
If set, the document contains signatures that may be invalidated if the file is saved (written) in a way that alters its previous contents, as opposed to an incremental update.
var SIGNATURES_EXIST
-
If set, the document contains at least one signature field.
class StrokeCapStyle (*args, **kwds)
-
Expand source code Browse git
class StrokeCapStyle(CoerciveIntEnum): """ An enumeration of values defining how the end of a stroke should be rendered. This affects the ends of the segments of dashed strokes, as well. """ BUTT = 0 """ "The stroke is squared off at the endpoint of the path. There is no projection beyond the end of the path." """ ROUND = 1 """ "A semicircular arc with a diameter equal to the line width is drawn around the endpoint and filled in." """ SQUARE = 2 """ "The stroke continues beyond the endpoint of the path for a distance equal to half the line width and is squared off." """
An enumeration of values defining how the end of a stroke should be rendered.
This affects the ends of the segments of dashed strokes, as well.
Ancestors
- CoerciveIntEnum
- enum.IntEnum
- builtins.int
- enum.ReprEnum
- enum.Enum
Class variables
var BUTT
-
"The stroke is squared off at the endpoint of the path. There is no projection beyond the end of the path."
var ROUND
-
"A semicircular arc with a diameter equal to the line width is drawn around the endpoint and filled in."
var SQUARE
-
"The stroke continues beyond the endpoint of the path for a distance equal to half the line width and is squared off."
Inherited members
class StrokeJoinStyle (*args, **kwds)
-
Expand source code Browse git
class StrokeJoinStyle(CoerciveIntEnum): """ An enumeration of values defining how the corner joining two path components should be rendered. """ MITER = 0 """ "The outer edges of the strokes for the two segments are extended until they meet at an angle, as in a picture frame. If the segments meet at too sharp an angle (as defined by the miter limit parameter), a bevel join is used instead." """ ROUND = 1 """ "An arc of a circle with a diameter equal to the line width is drawn around the point where the two segments meet, connecting the outer edges of the strokes for the two segments. This pieslice-shaped figure is filled in, pro- ducing a rounded corner." """ BEVEL = 2 """ "The two segments are finished with butt caps and the resulting notch beyond the ends of the segments is filled with a triangle." """
An enumeration of values defining how the corner joining two path components should be rendered.
Ancestors
- CoerciveIntEnum
- enum.IntEnum
- builtins.int
- enum.ReprEnum
- enum.Enum
Class variables
var BEVEL
-
"The two segments are finished with butt caps and the resulting notch beyond the ends of the segments is filled with a triangle."
var MITER
-
"The outer edges of the strokes for the two segments are extended until they meet at an angle, as in a picture frame. If the segments meet at too sharp an angle (as defined by the miter limit parameter), a bevel join is used instead."
var ROUND
-
"An arc of a circle with a diameter equal to the line width is drawn around the point where the two segments meet, connecting the outer edges of the strokes for the two segments. This pieslice-shaped figure is filled in, pro- ducing a rounded corner."
Inherited members
class TableBordersLayout (*args, **kwds)
-
Expand source code Browse git
class TableBordersLayout(CoerciveEnum): "Defines how to render table borders" ALL = intern("ALL") "Draw all table cells borders" NONE = intern("NONE") "Draw zero cells border" INTERNAL = intern("INTERNAL") "Draw only internal horizontal & vertical borders" MINIMAL = intern("MINIMAL") "Draw only the top horizontal border, below the headings, and internal vertical borders" HORIZONTAL_LINES = intern("HORIZONTAL_LINES") "Draw only horizontal lines" NO_HORIZONTAL_LINES = intern("NO_HORIZONTAL_LINES") "Draw all cells border except horizontal lines, after the headings" SINGLE_TOP_LINE = intern("SINGLE_TOP_LINE") "Draw only the top horizontal border, below the headings"
Defines how to render table borders
Ancestors
- CoerciveEnum
- enum.Enum
Class variables
var ALL
-
Draw all table cells borders
var HORIZONTAL_LINES
-
Draw only horizontal lines
var INTERNAL
-
Draw only internal horizontal & vertical borders
var MINIMAL
-
Draw only the top horizontal border, below the headings, and internal vertical borders
var NONE
-
Draw zero cells border
var NO_HORIZONTAL_LINES
-
Draw all cells border except horizontal lines, after the headings
var SINGLE_TOP_LINE
-
Draw only the top horizontal border, below the headings
Inherited members
class TableCellFillMode (*args, **kwds)
-
Expand source code Browse git
class TableCellFillMode(CoerciveEnum): "Defines which table cells to fill" NONE = intern("NONE") "Fill zero table cell" ALL = intern("ALL") "Fill all table cells" ROWS = intern("ROWS") "Fill only table cells in odd rows" COLUMNS = intern("COLUMNS") "Fill only table cells in odd columns" EVEN_ROWS = intern("EVEN_ROWS") "Fill only table cells in even rows" EVEN_COLUMNS = intern("EVEN_COLUMNS") "Fill only table cells in even columns" # pylint: disable=arguments-differ @classmethod def coerce(cls, value): "Any class that has a .should_fill_cell() method is considered a valid 'TableCellFillMode' (duck-typing)" if callable(getattr(value, "should_fill_cell", None)): return value return super().coerce(value) def should_fill_cell(self, i, j): if self is self.NONE: return False if self is self.ALL: return True if self is self.ROWS: return i % 2 == 1 if self is self.COLUMNS: return j % 2 == 1 if self is self.EVEN_ROWS: return i % 2 == 0 if self is self.EVEN_COLUMNS: return j % 2 == 0 raise NotImplementedError
Defines which table cells to fill
Ancestors
- CoerciveEnum
- enum.Enum
Class variables
var ALL
-
Fill all table cells
var COLUMNS
-
Fill only table cells in odd columns
var EVEN_COLUMNS
-
Fill only table cells in even columns
var EVEN_ROWS
-
Fill only table cells in even rows
var NONE
-
Fill zero table cell
var ROWS
-
Fill only table cells in odd rows
Static methods
def coerce(value)
-
Any class that has a .should_fill_cell() method is considered a valid 'TableCellFillMode' (duck-typing)
Methods
def should_fill_cell(self, i, j)
-
Expand source code Browse git
def should_fill_cell(self, i, j): if self is self.NONE: return False if self is self.ALL: return True if self is self.ROWS: return i % 2 == 1 if self is self.COLUMNS: return j % 2 == 1 if self is self.EVEN_ROWS: return i % 2 == 0 if self is self.EVEN_COLUMNS: return j % 2 == 0 raise NotImplementedError
class TableHeadingsDisplay (*args, **kwds)
-
Expand source code Browse git
class TableHeadingsDisplay(CoerciveIntEnum): "Defines how the table headings should be displayed" NONE = 0 "0: Only render the table headings at the beginning of the table" ON_TOP_OF_EVERY_PAGE = 1 "1: When a page break occurs, repeat the table headings at the top of every table fragment"
Defines how the table headings should be displayed
Ancestors
- CoerciveIntEnum
- enum.IntEnum
- builtins.int
- enum.ReprEnum
- enum.Enum
Class variables
var NONE
-
0: Only render the table headings at the beginning of the table
var ON_TOP_OF_EVERY_PAGE
-
1: When a page break occurs, repeat the table headings at the top of every table fragment
Inherited members
class TableSpan (*args, **kwds)
-
Expand source code Browse git
class TableSpan(CoerciveEnum): ROW = intern("ROW") "Mark this cell as a continuation of the previous row" COL = intern("COL") "Mark this cell as a continuation of the previous column"
An enumeration that provides a helper to coerce strings into enumeration members.
Ancestors
- CoerciveEnum
- enum.Enum
Class variables
var COL
-
Mark this cell as a continuation of the previous column
var ROW
-
Mark this cell as a continuation of the previous row
Inherited members
class TextDirection (*args, **kwds)
-
Expand source code Browse git
class TextDirection(CoerciveEnum): "Text rendering direction for text shaping" LTR = intern("LTR") "left to right" RTL = intern("RTL") "right to left" TTB = intern("TTB") "top to bottom" BTT = intern("BTT") "bottom to top"
Text rendering direction for text shaping
Ancestors
- CoerciveEnum
- enum.Enum
Class variables
var BTT
-
bottom to top
var LTR
-
left to right
var RTL
-
right to left
var TTB
-
top to bottom
Inherited members
class TextEmphasis (*args, **kwds)
-
Expand source code Browse git
class TextEmphasis(CoerciveIntFlag): """ Indicates use of bold / italics / underline. This enum values can be combined with & and | operators: style = B | I """ NONE = 0 "No emphasis" B = 1 "Bold" I = 2 "Italics" U = 4 "Underline" @property def style(self): return "".join( name for name, value in self.__class__.__members__.items() if value & self ) def add(self, value: "TextEmphasis"): return self | value def remove(self, value: "TextEmphasis"): return TextEmphasis.coerce( "".join(s for s in self.style if s not in value.style) ) @classmethod def coerce(cls, value): if isinstance(value, str): if value == "": return cls.NONE if value.upper() == "BOLD": return cls.B if value.upper() == "ITALICS": return cls.I if value.upper() == "UNDERLINE": return cls.U return super(cls, cls).coerce(value)
Indicates use of bold / italics / underline.
This enum values can be combined with & and | operators: style = B | I
Ancestors
- CoerciveIntFlag
- enum.IntFlag
- builtins.int
- enum.ReprEnum
- enum.Flag
- enum.Enum
Class variables
var B
-
Bold
var I
-
Italics
var NONE
-
No emphasis
var U
-
Underline
Instance variables
prop style
-
Expand source code Browse git
@property def style(self): return "".join( name for name, value in self.__class__.__members__.items() if value & self )
Methods
def add(self,
value: TextEmphasis)-
Expand source code Browse git
def add(self, value: "TextEmphasis"): return self | value
def remove(self,
value: TextEmphasis)-
Expand source code Browse git
def remove(self, value: "TextEmphasis"): return TextEmphasis.coerce( "".join(s for s in self.style if s not in value.style) )
Inherited members
class TextMarkupType (*args, **kwds)
-
Expand source code Browse git
class TextMarkupType(CoerciveEnum): "Subtype of a text markup annotation" HIGHLIGHT = Name("Highlight") UNDERLINE = Name("Underline") SQUIGGLY = Name("Squiggly") STRIKE_OUT = Name("StrikeOut")
Subtype of a text markup annotation
Ancestors
- CoerciveEnum
- enum.Enum
Class variables
var HIGHLIGHT
-
The type of the None singleton.
var SQUIGGLY
-
The type of the None singleton.
var STRIKE_OUT
-
The type of the None singleton.
var UNDERLINE
-
The type of the None singleton.
Inherited members
class TextMode (*args, **kwds)
-
Expand source code Browse git
class TextMode(CoerciveIntEnum): "Values described in PDF spec section 'Text Rendering Mode'" FILL = 0 STROKE = 1 FILL_STROKE = 2 INVISIBLE = 3 FILL_CLIP = 4 STROKE_CLIP = 5 FILL_STROKE_CLIP = 6 CLIP = 7
Values described in PDF spec section 'Text Rendering Mode'
Ancestors
- CoerciveIntEnum
- enum.IntEnum
- builtins.int
- enum.ReprEnum
- enum.Enum
Class variables
var CLIP
-
The type of the None singleton.
var FILL
-
The type of the None singleton.
var FILL_CLIP
-
The type of the None singleton.
var FILL_STROKE
-
The type of the None singleton.
var FILL_STROKE_CLIP
-
The type of the None singleton.
var INVISIBLE
-
The type of the None singleton.
var STROKE
-
The type of the None singleton.
var STROKE_CLIP
-
The type of the None singleton.
Inherited members
class VAlign (*args, **kwds)
-
Expand source code Browse git
class VAlign(CoerciveEnum): """Defines how to vertically render text in a cell. Default value is MIDDLE""" M = intern("MIDDLE") "Center text vertically" T = intern("TOP") "Place text at the top of the cell, but obey the cells padding" B = intern("BOTTOM") "Place text at the bottom of the cell, but obey the cells padding" # pylint: disable=arguments-differ @classmethod def coerce(cls, value): if value == "": return cls.M return super(cls, cls).coerce(value)
Defines how to vertically render text in a cell. Default value is MIDDLE
Ancestors
- CoerciveEnum
- enum.Enum
Class variables
var B
-
Place text at the bottom of the cell, but obey the cells padding
var M
-
Center text vertically
var T
-
Place text at the top of the cell, but obey the cells padding
Inherited members
class WrapMode (*args, **kwds)
-
Expand source code Browse git
class WrapMode(CoerciveEnum): "Defines how to break and wrap lines in multi-line text." WORD = intern("WORD") "Wrap by word" CHAR = intern("CHAR") "Wrap by character"
Defines how to break and wrap lines in multi-line text.
Ancestors
- CoerciveEnum
- enum.Enum
Class variables
var CHAR
-
Wrap by character
var WORD
-
Wrap by word
Inherited members
class XPos (*args, **kwds)
-
Expand source code Browse git
class XPos(CoerciveEnum): "Positional values in horizontal direction for use after printing text." LEFT = intern("LEFT") # self.x "left end of the cell" RIGHT = intern("RIGHT") # self.x + w "right end of the cell (default)" START = intern("START") "left start of actual text" END = intern("END") "right end of actual text" WCONT = intern("WCONT") "for write() to continue next (slightly left of END)" CENTER = intern("CENTER") "center of actual text" LMARGIN = intern("LMARGIN") # self.l_margin "left page margin (start of printable area)" RMARGIN = intern("RMARGIN") # self.w - self.r_margin "right page margin (end of printable area)"
Positional values in horizontal direction for use after printing text.
Ancestors
- CoerciveEnum
- enum.Enum
Class variables
var CENTER
-
center of actual text
var END
-
right end of actual text
var LEFT
-
left end of the cell
var LMARGIN
-
left page margin (start of printable area)
var RIGHT
-
right end of the cell (default)
var RMARGIN
-
right page margin (end of printable area)
var START
-
left start of actual text
var WCONT
-
for write() to continue next (slightly left of END)
Inherited members
class YPos (*args, **kwds)
-
Expand source code Browse git
class YPos(CoerciveEnum): "Positional values in vertical direction for use after printing text" TOP = intern("TOP") # self.y "top of the first line (default)" LAST = intern("LAST") "top of the last line (same as TOP for single-line text)" NEXT = intern("NEXT") # LAST + h "top of next line (bottom of current text)" TMARGIN = intern("TMARGIN") # self.t_margin "top page margin (start of printable area)" BMARGIN = intern("BMARGIN") # self.h - self.b_margin "bottom page margin (end of printable area)"
Positional values in vertical direction for use after printing text
Ancestors
- CoerciveEnum
- enum.Enum
Class variables
var BMARGIN
-
bottom page margin (end of printable area)
var LAST
-
top of the last line (same as TOP for single-line text)
var NEXT
-
top of next line (bottom of current text)
var TMARGIN
-
top page margin (start of printable area)
var TOP
-
top of the first line (default)
Inherited members