mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 05:24:52 +08:00
Update fpdf2 stubs to 2.6 (#9236)
This commit is contained in:
@@ -3,4 +3,12 @@ fpdf.FPDF.output
|
||||
fpdf.fpdf.FPDF.output
|
||||
|
||||
# Unnecessary re-export from codecs
|
||||
fpdf.syntax.BOM_UTF16_BE
|
||||
fpdf.syntax.BOM_UTF16_BE
|
||||
|
||||
# stubtest doesn't recognize ImportError handler
|
||||
fpdf.linearization.signer
|
||||
fpdf.output.signer
|
||||
|
||||
# Argument has default at runtime, but using it raises a TypeError.
|
||||
fpdf.FPDF.set_creation_date
|
||||
fpdf.fpdf.FPDF.set_creation_date
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
version = "2.5.*"
|
||||
version = "2.6.*"
|
||||
requires = ["types-Pillow"]
|
||||
|
||||
[tool.stubtest]
|
||||
|
||||
@@ -1,30 +1,36 @@
|
||||
from _typeshed import Incomplete
|
||||
from abc import ABC
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
from .syntax import PDFObject
|
||||
|
||||
class Action(ABC):
|
||||
next: PDFObject | str | None
|
||||
def __init__(self, next_action: PDFObject | str | None = ...) -> None: ...
|
||||
def dict_as_string(self, key_values: dict[str, Incomplete] | None = ...) -> str: ...
|
||||
@abstractmethod
|
||||
def serialize(self) -> str: ...
|
||||
|
||||
class URIAction(Action):
|
||||
uri: str
|
||||
def __init__(self, uri: str, next_action: PDFObject | str | None = ...) -> None: ...
|
||||
def serialize(self) -> str: ...
|
||||
|
||||
class NamedAction(Action):
|
||||
action_name: Incomplete
|
||||
def __init__(self, action_name, next_action: PDFObject | str | None = ...) -> None: ...
|
||||
def dict_as_string(self) -> str: ... # type: ignore[override]
|
||||
action_name: str
|
||||
def __init__(self, action_name: str, next_action: PDFObject | str | None = ...) -> None: ...
|
||||
def serialize(self) -> str: ...
|
||||
|
||||
class GoToAction(Action):
|
||||
dest: Incomplete
|
||||
def __init__(self, dest, next_action: PDFObject | str | None = ...) -> None: ...
|
||||
def dict_as_string(self) -> str: ... # type: ignore[override]
|
||||
def serialize(self) -> str: ...
|
||||
|
||||
class GoToRemoteAction(Action):
|
||||
file: Incomplete
|
||||
file: str
|
||||
dest: Incomplete
|
||||
def __init__(self, file, dest, next_action: PDFObject | str | None = ...) -> None: ...
|
||||
def dict_as_string(self) -> str: ... # type: ignore[override]
|
||||
def __init__(self, file: str, dest, next_action: PDFObject | str | None = ...) -> None: ...
|
||||
def serialize(self) -> str: ...
|
||||
|
||||
class LaunchAction(Action):
|
||||
file: Incomplete
|
||||
def __init__(self, file, next_action: PDFObject | str | None = ...) -> None: ...
|
||||
def dict_as_string(self) -> str: ... # type: ignore[override]
|
||||
file: str
|
||||
def __init__(self, file: str, next_action: PDFObject | str | None = ...) -> None: ...
|
||||
def serialize(self) -> str: ...
|
||||
|
||||
80
stubs/fpdf2/fpdf/annotations.pyi
Normal file
80
stubs/fpdf2/fpdf/annotations.pyi
Normal file
@@ -0,0 +1,80 @@
|
||||
from _typeshed import Incomplete
|
||||
from datetime import datetime
|
||||
from typing import NamedTuple
|
||||
|
||||
from .actions import Action
|
||||
from .enums import AnnotationFlag, AnnotationName, FileAttachmentAnnotationName
|
||||
from .syntax import Destination, Name, PDFContentStream, PDFObject
|
||||
|
||||
DEFAULT_ANNOT_FLAGS: Incomplete
|
||||
|
||||
class AnnotationMixin:
|
||||
type: Name
|
||||
subtype: Name
|
||||
rect: str
|
||||
border: str
|
||||
f_t: Name | None
|
||||
v: Incomplete | None
|
||||
f: int # AnnotationFlags
|
||||
contents: str | None
|
||||
a: Action | None
|
||||
dest: Destination | None
|
||||
c: str | None
|
||||
t: str | None
|
||||
m: str | None
|
||||
quad_points: str | None
|
||||
p: Incomplete | None
|
||||
name: AnnotationName | FileAttachmentAnnotationName | None
|
||||
ink_list: str | None
|
||||
f_s: str | None
|
||||
def __init__(
|
||||
self,
|
||||
subtype: str,
|
||||
x: int,
|
||||
y: int,
|
||||
width: int,
|
||||
height: int,
|
||||
flags: tuple[AnnotationFlag, ...] = ...,
|
||||
contents: str | None = ...,
|
||||
dest: Destination | None = ...,
|
||||
action: Action | None = ...,
|
||||
color: tuple[int, int, int] | None = ...,
|
||||
modification_time: datetime | None = ...,
|
||||
title: str | None = ...,
|
||||
quad_points: tuple[float, ...] | None = ..., # multiple of 8 floats
|
||||
border_width: int = ...,
|
||||
name: AnnotationName | FileAttachmentAnnotationName | None = ...,
|
||||
ink_list: tuple[int, ...] = ...,
|
||||
file_spec: str | None = ...,
|
||||
field_type: str | None = ...,
|
||||
value: Incomplete | None = ...,
|
||||
) -> None: ...
|
||||
|
||||
class PDFAnnotation(AnnotationMixin, PDFObject): ...
|
||||
|
||||
class AnnotationDict(AnnotationMixin):
|
||||
def serialize(self) -> str: ...
|
||||
|
||||
class PDFEmbeddedFile(PDFContentStream):
|
||||
type: Name
|
||||
params: str
|
||||
def __init__(
|
||||
self,
|
||||
basename: str,
|
||||
contents: bytes,
|
||||
desc: str = ...,
|
||||
creation_date: datetime | None = ...,
|
||||
modification_date: datetime | None = ...,
|
||||
compress: bool = ...,
|
||||
checksum: bool = ...,
|
||||
) -> None: ...
|
||||
def globally_enclosed(self) -> bool: ...
|
||||
def set_globally_enclosed(self, value: bool) -> None: ...
|
||||
def basename(self) -> str: ...
|
||||
def file_spec(self) -> FileSpec: ...
|
||||
|
||||
class FileSpec(NamedTuple):
|
||||
embedded_file: PDFEmbeddedFile
|
||||
basename: str
|
||||
desc: str
|
||||
def serialize(self) -> str: ...
|
||||
@@ -30,26 +30,43 @@ class GraphicsStateDictRegistry(OrderedDict[Raw, Name]):
|
||||
def number_to_str(number) -> str: ...
|
||||
def render_pdf_primitive(primitive) -> Raw: ...
|
||||
|
||||
class DeviceRGB:
|
||||
OPERATOR: str
|
||||
def __new__(cls, r, g, b, a: Incomplete | None = ...): ...
|
||||
@property
|
||||
def colors(self): ...
|
||||
def pdf_repr(self) -> str: ...
|
||||
class _DeviceRGBBase(NamedTuple):
|
||||
r: Number
|
||||
g: Number
|
||||
b: Number
|
||||
a: Number | None
|
||||
|
||||
class DeviceGray:
|
||||
OPERATOR: str
|
||||
def __new__(cls, g, a: Incomplete | None = ...): ...
|
||||
class DeviceRGB(_DeviceRGBBase):
|
||||
OPERATOR: ClassVar[str]
|
||||
def __new__(cls: type[Self], r: Number, g: Number, b: Number, a: Number | None = ...) -> Self: ...
|
||||
@property
|
||||
def colors(self): ...
|
||||
def pdf_repr(self) -> str: ...
|
||||
def colors(self) -> tuple[Number, Number, Number]: ...
|
||||
def serialize(self) -> str: ...
|
||||
|
||||
class DeviceCMYK:
|
||||
OPERATOR: str
|
||||
def __new__(cls, c, m, y, k, a: Incomplete | None = ...): ...
|
||||
class _DeviceGrayBase(NamedTuple):
|
||||
g: Number
|
||||
a: Number | None
|
||||
|
||||
class DeviceGray(_DeviceGrayBase):
|
||||
OPERATOR: ClassVar[str]
|
||||
def __new__(cls: type[Self], g: Number, a: Number | None = ...) -> Self: ...
|
||||
@property
|
||||
def colors(self): ...
|
||||
def pdf_repr(self) -> str: ...
|
||||
def colors(self) -> tuple[Number]: ...
|
||||
def serialize(self) -> str: ...
|
||||
|
||||
class _DeviceCMYKBase(NamedTuple):
|
||||
c: Number
|
||||
m: Number
|
||||
y: Number
|
||||
k: Number
|
||||
a: Number | None
|
||||
|
||||
class DeviceCMYK(_DeviceCMYKBase):
|
||||
OPERATOR: ClassVar[str]
|
||||
def __new__(cls: type[Self], c: Number, m: Number, y: Number, k: Number, a: Number | None = ...) -> Self: ...
|
||||
@property
|
||||
def colors(self) -> tuple[Number, Number, Number, Number]: ...
|
||||
def serialize(self) -> str: ...
|
||||
|
||||
def rgb8(r, g, b, a: Incomplete | None = ...) -> DeviceRGB: ...
|
||||
def gray8(g, a: Incomplete | None = ...) -> DeviceGray: ...
|
||||
@@ -172,7 +189,7 @@ class GraphicsStyle:
|
||||
def stroke_dash_phase(self): ...
|
||||
@stroke_dash_phase.setter
|
||||
def stroke_dash_phase(self, value): ...
|
||||
def to_pdf_dict(self): ...
|
||||
def serialize(self) -> Raw | None: ...
|
||||
def resolve_paint_rule(self): ...
|
||||
|
||||
class Move(NamedTuple):
|
||||
@@ -327,6 +344,7 @@ class PaintedPath:
|
||||
@contextmanager
|
||||
def transform_group(self: Self, transform) -> Iterator[Self]: ...
|
||||
def add_path_element(self, item, _copy: bool = ...) -> None: ...
|
||||
def remove_last_path_element(self) -> None: ...
|
||||
def rectangle(self: Self, x, y, w, h, rx: int = ..., ry: int = ...) -> Self: ...
|
||||
def circle(self: Self, cx, cy, r) -> Self: ...
|
||||
def ellipse(self: Self, cx, cy, rx, ry) -> Self: ...
|
||||
@@ -372,6 +390,7 @@ class GraphicsContext:
|
||||
@clipping_path.setter
|
||||
def clipping_path(self, new_clipath) -> None: ...
|
||||
def add_item(self, item, _copy: bool = ...) -> None: ...
|
||||
def remove_last_item(self) -> None: ...
|
||||
def merge(self, other_context) -> None: ...
|
||||
def build_render_list(
|
||||
self,
|
||||
|
||||
@@ -3,12 +3,6 @@ from enum import Enum, Flag, IntEnum
|
||||
|
||||
from .syntax import Name
|
||||
|
||||
class DocumentState(IntEnum):
|
||||
UNINITIALIZED: int
|
||||
READY: int
|
||||
GENERATING_PAGE: int
|
||||
CLOSED: int
|
||||
|
||||
class SignatureFlag(IntEnum):
|
||||
SIGNATURES_EXIST: int
|
||||
APPEND_ONLY: int
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
import datetime
|
||||
from _typeshed import Incomplete, StrPath
|
||||
from collections import defaultdict
|
||||
from collections.abc import Callable, Iterable, Sequence
|
||||
from contextlib import _GeneratorContextManager
|
||||
from enum import IntEnum
|
||||
from io import BytesIO
|
||||
from typing import Any, ClassVar, NamedTuple, overload
|
||||
from typing_extensions import Literal, TypeAlias
|
||||
|
||||
from fpdf import ViewerPreferences
|
||||
from PIL import Image
|
||||
|
||||
from .actions import Action
|
||||
from .annotations import AnnotationDict, PDFEmbeddedFile
|
||||
from .drawing import DrawingContext, PaintedPath
|
||||
from .enums import (
|
||||
Align,
|
||||
@@ -26,7 +25,10 @@ from .enums import (
|
||||
XPos as XPos,
|
||||
YPos as YPos,
|
||||
)
|
||||
from .html import HTML2FPDF
|
||||
from .output import PDFPage
|
||||
from .recorder import FPDFRecorder
|
||||
from .structure_tree import StructureTreeBuilder
|
||||
from .syntax import DestinationXYZ
|
||||
from .util import _Unit
|
||||
|
||||
@@ -38,46 +40,6 @@ _FontStyle: TypeAlias = Literal["", "B", "I"]
|
||||
_FontStyles: TypeAlias = Literal["", "B", "I", "U", "BU", "UB", "BI", "IB", "IU", "UI", "BIU", "BUI", "IBU", "IUB", "UBI", "UIB"]
|
||||
PAGE_FORMATS: dict[_Format, tuple[float, float]]
|
||||
|
||||
class DocumentState(IntEnum):
|
||||
UNINITIALIZED: int
|
||||
READY: int
|
||||
GENERATING_PAGE: int
|
||||
CLOSED: int
|
||||
|
||||
class Annotation(NamedTuple):
|
||||
type: str
|
||||
x: int
|
||||
y: int
|
||||
width: int
|
||||
height: int
|
||||
flags: tuple[AnnotationFlag, ...] = ...
|
||||
contents: str | None = ...
|
||||
link: str | int | None = ...
|
||||
alt_text: str | None = ...
|
||||
action: Action | None = ...
|
||||
color: int | None = ...
|
||||
modification_time: datetime.datetime | None = ...
|
||||
title: str | None = ...
|
||||
quad_points: Sequence[int] | None = ...
|
||||
page: int | None = ...
|
||||
border_width: int = ...
|
||||
name: AnnotationName | None = ...
|
||||
ink_list: tuple[int, ...] = ...
|
||||
embedded_file_name: str | None = ...
|
||||
field_type: str | None = ...
|
||||
value: str | None = ...
|
||||
def serialize(self, fpdf) -> str: ...
|
||||
|
||||
class EmbeddedFile(NamedTuple):
|
||||
basename: str
|
||||
bytes: bytes
|
||||
desc: str = ...
|
||||
creation_date: datetime.datetime | None = ...
|
||||
modification_date: datetime.datetime | None = ...
|
||||
compress: bool = ...
|
||||
checksum: bool = ...
|
||||
def file_spec(self, embedded_file_ref) -> str: ...
|
||||
|
||||
class TitleStyle(NamedTuple):
|
||||
font_family: str | None = ...
|
||||
font_style: str | None = ...
|
||||
@@ -95,70 +57,78 @@ class ToCPlaceholder(NamedTuple):
|
||||
pages: int = ...
|
||||
|
||||
class SubsetMap:
|
||||
def __init__(self, identities: list[int]) -> None: ...
|
||||
def __init__(self, identities: Iterable[int]) -> None: ...
|
||||
def __len__(self) -> int: ...
|
||||
def pick(self, unicode: int) -> int: ...
|
||||
def dict(self) -> dict[int, int]: ...
|
||||
|
||||
def get_page_format(format: _Format | tuple[float, float], k: float | None = ...) -> tuple[float, float]: ...
|
||||
|
||||
# TODO: TypedDicts
|
||||
_Page: TypeAlias = dict[str, Any]
|
||||
_Font: TypeAlias = dict[str, Any]
|
||||
_FontFile: TypeAlias = dict[str, Any]
|
||||
_Image: TypeAlias = dict[str, Any]
|
||||
|
||||
class FPDF:
|
||||
MARKDOWN_BOLD_MARKER: ClassVar[str]
|
||||
MARKDOWN_ITALICS_MARKER: ClassVar[str]
|
||||
MARKDOWN_UNDERLINE_MARKER: ClassVar[str]
|
||||
offsets: dict[int, int]
|
||||
|
||||
HTML2FPDF_CLASS: ClassVar[type[HTML2FPDF]]
|
||||
|
||||
page: int
|
||||
n: int
|
||||
buffer: bytearray
|
||||
pages: dict[int, _Page]
|
||||
state: DocumentState
|
||||
pages: dict[int, PDFPage]
|
||||
fonts: dict[str, _Font]
|
||||
font_files: dict[str, _FontFile]
|
||||
diffs: dict[int, int]
|
||||
images: dict[str, _Image]
|
||||
annots: defaultdict[int, list[Annotation]]
|
||||
links: dict[int, DestinationXYZ]
|
||||
embedded_files: list[Incomplete]
|
||||
embedded_files_per_pdf_ref: dict[Incomplete, Incomplete]
|
||||
in_footer: int
|
||||
lasth: int
|
||||
current_font: _Font
|
||||
font_family: str
|
||||
font_style: str
|
||||
font_stretching: float
|
||||
char_spacing: float
|
||||
underline: bool
|
||||
embedded_files: list[PDFEmbeddedFile]
|
||||
|
||||
in_footer: bool
|
||||
str_alias_nb_pages: str
|
||||
draw_color: str
|
||||
fill_color: str
|
||||
text_color: str
|
||||
page_background: Incomplete | None
|
||||
angle: int
|
||||
|
||||
xmp_metadata: str | None
|
||||
image_filter: str
|
||||
page_duration: int
|
||||
page_transition: Incomplete | None
|
||||
struct_builder: Incomplete
|
||||
section_title_styles: Incomplete
|
||||
core_fonts: Incomplete
|
||||
allow_images_transparency: bool
|
||||
oversized_images: Incomplete | None
|
||||
oversized_images_ratio: float
|
||||
struct_builder: StructureTreeBuilder
|
||||
section_title_styles: dict[int, Incomplete]
|
||||
|
||||
core_fonts: dict[str, str]
|
||||
core_fonts_encoding: str
|
||||
font_aliases: Incomplete
|
||||
font_aliases: dict[str, str]
|
||||
k: float
|
||||
def_orientation: Incomplete
|
||||
font_size: float
|
||||
c_margin: float
|
||||
|
||||
font_family: str
|
||||
font_style: str
|
||||
font_size_pt: float
|
||||
font_stretching: float
|
||||
char_spacing: float
|
||||
underline: bool
|
||||
current_font: _Font
|
||||
draw_color: str
|
||||
fill_color: str
|
||||
text_color: str
|
||||
page_background: Incomplete | None
|
||||
dash_pattern: dict[str, int] # TODO: TypedDict
|
||||
line_width: float
|
||||
text_mode: TextMode
|
||||
|
||||
dw_pt: float
|
||||
dh_pt: float
|
||||
pdf_version: str
|
||||
|
||||
def_orientation: Literal["P", "L"]
|
||||
x: float
|
||||
y: float
|
||||
l_margin: float
|
||||
t_margin: float
|
||||
c_margin: float
|
||||
viewer_preferences: ViewerPreferences | None
|
||||
compress: bool
|
||||
pdf_version: str
|
||||
creation_date: datetime.datetime
|
||||
|
||||
buffer: bytearray | None
|
||||
|
||||
# Set during call to _set_orientation(), called from __init__().
|
||||
cur_orientation: Literal["P", "L"]
|
||||
@@ -166,6 +136,7 @@ class FPDF:
|
||||
h_pt: float
|
||||
w: float
|
||||
h: float
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
orientation: _Orientation = ...,
|
||||
@@ -173,8 +144,8 @@ class FPDF:
|
||||
format: _Format | tuple[float, float] = ...,
|
||||
font_cache_dir: Literal["DEPRECATED"] = ...,
|
||||
) -> None: ...
|
||||
@property
|
||||
def font_size_pt(self) -> float: ...
|
||||
# args and kwargs are passed to HTML2FPDF_CLASS constructor.
|
||||
def write_html(self, text: str, *args: Any, **kwargs: Any) -> None: ...
|
||||
@property
|
||||
def is_ttf_font(self) -> bool: ...
|
||||
@property
|
||||
@@ -187,9 +158,7 @@ class FPDF:
|
||||
def pages_count(self) -> int: ...
|
||||
def set_margin(self, margin: float) -> None: ...
|
||||
def set_margins(self, left: float, top: float, right: float = ...) -> None: ...
|
||||
l_margin: float
|
||||
def set_left_margin(self, margin: float) -> None: ...
|
||||
t_margin: float
|
||||
def set_top_margin(self, margin: float) -> None: ...
|
||||
r_margin: float
|
||||
def set_right_margin(self, margin: float) -> None: ...
|
||||
@@ -197,6 +166,8 @@ class FPDF:
|
||||
b_margin: float
|
||||
page_break_trigger: float
|
||||
def set_auto_page_break(self, auto: bool, margin: float = ...) -> None: ...
|
||||
@property
|
||||
def default_page_dimensions(self) -> tuple[float, float]: ...
|
||||
zoom_mode: Literal["fullpage", "fullwidth", "real", "default"] | float
|
||||
page_layout: PageLayout | None
|
||||
def set_display_mode(
|
||||
@@ -204,7 +175,6 @@ class FPDF:
|
||||
zoom: Literal["fullpage", "fullwidth", "real", "default"] | float,
|
||||
layout: Literal["single", "continuous", "two", "default"] = ...,
|
||||
) -> None: ...
|
||||
compress: bool
|
||||
def set_compression(self, compress: bool) -> None: ...
|
||||
title: str
|
||||
def set_title(self, title: str) -> None: ...
|
||||
@@ -220,14 +190,11 @@ class FPDF:
|
||||
def set_creator(self, creator: str) -> None: ...
|
||||
producer: str
|
||||
def set_producer(self, producer: str) -> None: ...
|
||||
creation_date: datetime.datetime | bool | None
|
||||
def set_creation_date(self, date: datetime.datetime | bool | None = ...) -> None: ...
|
||||
def set_creation_date(self, date: datetime.datetime) -> None: ...
|
||||
def set_xmp_metadata(self, xmp_metadata: str) -> None: ...
|
||||
def set_doc_option(self, opt: str, value: str) -> None: ...
|
||||
def set_image_filter(self, image_filter: str) -> None: ...
|
||||
def alias_nb_pages(self, alias: str = ...) -> None: ...
|
||||
def open(self) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
def add_page(
|
||||
self,
|
||||
orientation: _Orientation = ...,
|
||||
@@ -315,7 +282,7 @@ class FPDF:
|
||||
style: RenderStyle | str | None = ...,
|
||||
) -> None: ...
|
||||
def add_font(
|
||||
self, family: str, style: _FontStyle = ..., fname: str | None = ..., uni: bool | Literal["DEPRECATED"] = ...
|
||||
self, family: str | None = ..., style: _FontStyle = ..., fname: str | None = ..., uni: bool | Literal["DEPRECATED"] = ...
|
||||
) -> None: ...
|
||||
def set_font(self, family: str | None = ..., style: _FontStyles = ..., size: int = ...) -> None: ...
|
||||
def set_font_size(self, size: float) -> None: ...
|
||||
@@ -325,7 +292,7 @@ class FPDF:
|
||||
def set_link(self, link, y: int = ..., x: int = ..., page: int = ..., zoom: float | Literal["null"] = ...) -> None: ...
|
||||
def link(
|
||||
self, x: float, y: float, w: float, h: float, link: str | int, alt_text: str | None = ..., border_width: int = ...
|
||||
) -> Annotation: ...
|
||||
) -> AnnotationDict: ...
|
||||
def embed_file(
|
||||
self,
|
||||
file_path: StrPath | None = ...,
|
||||
@@ -355,7 +322,7 @@ class FPDF:
|
||||
desc: str = ...,
|
||||
compress: bool = ...,
|
||||
checksum: bool = ...,
|
||||
) -> Annotation: ...
|
||||
) -> AnnotationDict: ...
|
||||
def text_annotation(
|
||||
self,
|
||||
x: float,
|
||||
@@ -385,7 +352,7 @@ class FPDF:
|
||||
color: tuple[float, float, float] = ...,
|
||||
modification_time: datetime.datetime | None = ...,
|
||||
page: int | None = ...,
|
||||
) -> Annotation: ...
|
||||
) -> AnnotationDict: ...
|
||||
def ink_annotation(
|
||||
self,
|
||||
coords: Iterable[Incomplete],
|
||||
@@ -393,7 +360,7 @@ class FPDF:
|
||||
title: str = ...,
|
||||
color: Sequence[float] = ...,
|
||||
border_width: int = ...,
|
||||
) -> Annotation: ...
|
||||
) -> AnnotationDict: ...
|
||||
def text(self, x: float, y: float, txt: str = ...) -> None: ...
|
||||
def rotate(self, angle: float, x: float | None = ..., y: float | None = ...) -> None: ...
|
||||
def rotation(self, angle: float, x: float | None = ..., y: float | None = ...) -> _GeneratorContextManager[None]: ...
|
||||
|
||||
@@ -1,59 +1,70 @@
|
||||
from _typeshed import Incomplete
|
||||
from collections.abc import Callable
|
||||
from html.parser import HTMLParser
|
||||
from typing import Any
|
||||
from logging import Logger
|
||||
from re import Match, Pattern
|
||||
from typing_extensions import Final
|
||||
|
||||
__author__: str
|
||||
__copyright__: str
|
||||
__license__: str
|
||||
from fpdf import FPDF
|
||||
|
||||
LOGGER: Any
|
||||
BULLET_WIN1252: str
|
||||
DEFAULT_HEADING_SIZES: Any
|
||||
COLOR_DICT: Any
|
||||
__author__: Final[str]
|
||||
__copyright__: Final[str]
|
||||
__license__: Final[str]
|
||||
|
||||
def px2mm(px): ...
|
||||
def color_as_decimal(color: str = ...): ...
|
||||
LOGGER: Logger
|
||||
BULLET_WIN1252: Final[str]
|
||||
DEFAULT_HEADING_SIZES: dict[str, int]
|
||||
LEADING_SPACE: Pattern[str]
|
||||
WHITESPACE: Pattern[str]
|
||||
TRAILING_SPACE: Pattern[str]
|
||||
|
||||
COLOR_DICT: Final[dict[str, str]]
|
||||
|
||||
def px2mm(px: float) -> float: ...
|
||||
def color_as_decimal(color: str | None = ...) -> tuple[int, int, int] | None: ...
|
||||
|
||||
class HTML2FPDF(HTMLParser):
|
||||
pdf: Any
|
||||
image_map: Any
|
||||
li_tag_indent: Any
|
||||
table_line_separators: Any
|
||||
ul_bullet_char: Any
|
||||
style: Any
|
||||
pdf: Incomplete
|
||||
image_map: Incomplete
|
||||
li_tag_indent: Incomplete
|
||||
table_line_separators: Incomplete
|
||||
ul_bullet_char: Incomplete
|
||||
style: Incomplete
|
||||
href: str
|
||||
align: str
|
||||
page_links: Any
|
||||
font_stack: Any
|
||||
page_links: Incomplete
|
||||
font_stack: Incomplete
|
||||
indent: int
|
||||
bullet: Any
|
||||
font_size: Any
|
||||
font_color: Any
|
||||
table: Any
|
||||
table_col_width: Any
|
||||
table_col_index: Any
|
||||
td: Any
|
||||
th: Any
|
||||
tr: Any
|
||||
thead: Any
|
||||
tfoot: Any
|
||||
tr_index: Any
|
||||
theader: Any
|
||||
tfooter: Any
|
||||
bullet: Incomplete
|
||||
font_size: Incomplete
|
||||
font_color: Incomplete
|
||||
table: Incomplete
|
||||
table_col_width: Incomplete
|
||||
table_col_index: Incomplete
|
||||
td: Incomplete
|
||||
th: Incomplete
|
||||
tr: Incomplete
|
||||
thead: Incomplete
|
||||
tfoot: Incomplete
|
||||
tr_index: Incomplete
|
||||
theader: Incomplete
|
||||
tfooter: Incomplete
|
||||
theader_out: bool
|
||||
table_row_height: int
|
||||
heading_level: Any
|
||||
heading_sizes: Any
|
||||
heading_level: Incomplete
|
||||
heading_sizes: Incomplete
|
||||
heading_above: float
|
||||
heading_below: float
|
||||
def __init__(
|
||||
self,
|
||||
pdf,
|
||||
image_map: Any | None = ...,
|
||||
pdf: FPDF,
|
||||
image_map: Callable[[str], str] | None = ...,
|
||||
li_tag_indent: int = ...,
|
||||
dd_tag_indent: int = ...,
|
||||
table_line_separators: bool = ...,
|
||||
ul_bullet_char=...,
|
||||
heading_sizes: Any | None = ...,
|
||||
**_,
|
||||
ul_bullet_char: str = ...,
|
||||
heading_sizes: Incomplete | None = ...,
|
||||
**_: object,
|
||||
): ...
|
||||
def width2unit(self, length): ...
|
||||
def handle_data(self, data) -> None: ...
|
||||
@@ -62,19 +73,21 @@ class HTML2FPDF(HTMLParser):
|
||||
tfooter_out: bool
|
||||
def output_table_footer(self) -> None: ...
|
||||
def output_table_sep(self) -> None: ...
|
||||
font_face: Any
|
||||
table_offset: Any
|
||||
font_face: Incomplete
|
||||
table_offset: Incomplete
|
||||
def handle_starttag(self, tag, attrs) -> None: ...
|
||||
tbody: Any
|
||||
tbody: Incomplete
|
||||
def handle_endtag(self, tag) -> None: ...
|
||||
h: Any
|
||||
def set_font(self, face: Any | None = ..., size: Any | None = ...) -> None: ...
|
||||
def set_style(self, tag: Any | None = ..., enable: bool = ...) -> None: ...
|
||||
def set_text_color(self, r: Any | None = ..., g: int = ..., b: int = ...) -> None: ...
|
||||
h: Incomplete
|
||||
def set_font(self, face: Incomplete | None = ..., size: Incomplete | None = ...) -> None: ...
|
||||
def set_style(self, tag: Incomplete | None = ..., enable: bool = ...) -> None: ...
|
||||
def set_text_color(self, r: Incomplete | None = ..., g: int = ..., b: int = ...) -> None: ...
|
||||
def put_link(self, txt) -> None: ...
|
||||
def render_toc(self, pdf, outline) -> None: ...
|
||||
def error(self, message: str) -> None: ...
|
||||
|
||||
def leading_whitespace_repl(matchobj: Match[str]) -> str: ...
|
||||
def whitespace_repl(matchobj: Match[str]) -> str: ...
|
||||
|
||||
class HTMLMixin:
|
||||
HTML2FPDF_CLASS: Any
|
||||
def write_html(self, text, *args, **kwargs) -> None: ...
|
||||
def __init__(self, *args: Incomplete, **kwargs: Incomplete) -> None: ...
|
||||
|
||||
53
stubs/fpdf2/fpdf/linearization.pyi
Normal file
53
stubs/fpdf2/fpdf/linearization.pyi
Normal file
@@ -0,0 +1,53 @@
|
||||
from _typeshed import Incomplete
|
||||
from typing_extensions import Final
|
||||
|
||||
from .output import ContentWithoutID, OutputProducer
|
||||
from .syntax import PDFContentStream, PDFObject
|
||||
|
||||
HINT_STREAM_OFFSET_LENGTH_PLACEHOLDER: Final[str]
|
||||
FIRST_PAGE_END_OFFSET_PLACEHOLDER: Final[str]
|
||||
MAIN_XREF_1ST_ENTRY_OFFSET_PLACEHOLDER: Final[str]
|
||||
FILE_LENGTH_PLACEHOLDER: Final[str]
|
||||
|
||||
class PDFLinearization(PDFObject):
|
||||
linearized: str
|
||||
n: int
|
||||
h: str
|
||||
o: Incomplete | None
|
||||
e: str
|
||||
t: str
|
||||
l: str
|
||||
def __init__(self, pages_count: int) -> None: ...
|
||||
|
||||
class PDFXrefAndTrailer(ContentWithoutID):
|
||||
PREV_MAIN_XREF_START_PLACEHOLDER: str
|
||||
output_builder: Incomplete
|
||||
count: int
|
||||
start_obj_id: int
|
||||
catalog_obj: Incomplete | None
|
||||
info_obj: Incomplete | None
|
||||
first_xref: Incomplete | None
|
||||
main_xref: Incomplete | None
|
||||
startxref: Incomplete | None
|
||||
def __init__(self, output_builder) -> None: ...
|
||||
@property
|
||||
def is_first_xref(self) -> bool: ...
|
||||
@property
|
||||
def is_main_xref(self) -> bool: ...
|
||||
def serialize(self) -> str: ...
|
||||
|
||||
class PDFHintStream(PDFContentStream):
|
||||
s: Incomplete | None
|
||||
t: Incomplete | None
|
||||
o: Incomplete | None
|
||||
a: Incomplete | None
|
||||
e: Incomplete | None
|
||||
v: Incomplete | None
|
||||
i: Incomplete | None
|
||||
c: Incomplete | None
|
||||
l: Incomplete | None
|
||||
r: Incomplete | None
|
||||
b: Incomplete | None
|
||||
|
||||
class LinearizedOutputProducer(OutputProducer):
|
||||
def bufferize(self) -> bytearray: ...
|
||||
@@ -1,8 +1,9 @@
|
||||
from _typeshed import Incomplete
|
||||
from typing import Any, NamedTuple
|
||||
from collections.abc import Generator, Iterable
|
||||
from typing import NamedTuple
|
||||
|
||||
from .structure_tree import StructElem
|
||||
from .syntax import Destination, PDFObject
|
||||
from .syntax import Destination, PDFObject, PDFString
|
||||
|
||||
class OutlineSection(NamedTuple):
|
||||
name: str
|
||||
@@ -12,24 +13,24 @@ class OutlineSection(NamedTuple):
|
||||
struct_elem: StructElem | None = ...
|
||||
|
||||
class OutlineItemDictionary(PDFObject):
|
||||
title: str
|
||||
parent: Any | None
|
||||
prev: Any | None
|
||||
next: Any | None
|
||||
first: Any | None
|
||||
last: Any | None
|
||||
title: PDFString
|
||||
parent: Incomplete | None
|
||||
prev: Incomplete | None
|
||||
next: Incomplete | None
|
||||
first: Incomplete | None
|
||||
last: Incomplete | None
|
||||
count: int
|
||||
dest: str | None
|
||||
dest: Destination | None
|
||||
struct_elem: StructElem | None
|
||||
def __init__(self, title: str, dest: str | None = ..., struct_elem: StructElem | None = ..., **kwargs) -> None: ...
|
||||
def __init__(self, title: str, dest: Destination | None = ..., struct_elem: StructElem | None = ...) -> None: ...
|
||||
|
||||
class OutlineDictionary(PDFObject):
|
||||
type: str
|
||||
first: Any | None
|
||||
last: Any | None
|
||||
first: Incomplete | None
|
||||
last: Incomplete | None
|
||||
count: int
|
||||
def __init__(self, **kwargs) -> None: ...
|
||||
def __init__(self) -> None: ...
|
||||
|
||||
def serialize_outline(sections, first_object_id: int = ..., fpdf: Any | None = ...): ...
|
||||
def build_outline(sections, first_object_id, fpdf) -> tuple[Incomplete, Incomplete]: ...
|
||||
def outline_as_str(outline, outline_items, fpdf) -> str: ...
|
||||
def build_outline_objs(
|
||||
sections: Iterable[Incomplete],
|
||||
) -> Generator[Incomplete, None, list[OutlineDictionary | OutlineItemDictionary]]: ...
|
||||
|
||||
184
stubs/fpdf2/fpdf/output.pyi
Normal file
184
stubs/fpdf2/fpdf/output.pyi
Normal file
@@ -0,0 +1,184 @@
|
||||
from _typeshed import Incomplete
|
||||
from collections import defaultdict
|
||||
from logging import Logger
|
||||
from typing_extensions import Final
|
||||
|
||||
from .annotations import AnnotationDict
|
||||
from .syntax import Name, PDFArray, PDFContentStream, PDFObject
|
||||
|
||||
LOGGER: Logger
|
||||
ZOOM_CONFIGS: Final[dict[str, tuple[str, ...]]]
|
||||
|
||||
class ContentWithoutID: ...
|
||||
|
||||
class PDFHeader(ContentWithoutID):
|
||||
pdf_version: str
|
||||
def __init__(self, pdf_version: str) -> None: ...
|
||||
def serialize(self) -> str: ...
|
||||
|
||||
class PDFFont(PDFObject):
|
||||
type: Name
|
||||
subtype: Name
|
||||
base_font: Name
|
||||
encoding: Name | None
|
||||
d_w: Incomplete | None
|
||||
w: Incomplete | None
|
||||
descendant_fonts: Incomplete | None
|
||||
to_unicode: Incomplete | None
|
||||
c_i_d_system_info: Incomplete | None
|
||||
font_descriptor: Incomplete | None
|
||||
c_i_d_to_g_i_d_map: Incomplete | None
|
||||
def __init__(
|
||||
self, subtype: str, base_font: str, encoding: str | None = ..., d_w: Incomplete | None = ..., w: Incomplete | None = ...
|
||||
) -> None: ...
|
||||
|
||||
class PDFFontDescriptor(PDFObject):
|
||||
type: Name
|
||||
ascent: Incomplete
|
||||
descent: Incomplete
|
||||
cap_height: Incomplete
|
||||
flags: Incomplete
|
||||
font_b_box: Incomplete
|
||||
italic_angle: Incomplete
|
||||
stem_v: Incomplete
|
||||
missing_width: Incomplete
|
||||
font_name: Incomplete | None
|
||||
def __init__(self, ascent, descent, cap_height, flags, font_b_box, italic_angle, stem_v, missing_width) -> None: ...
|
||||
|
||||
class CIDSystemInfo(PDFObject):
|
||||
registry: str
|
||||
ordering: str
|
||||
supplement: Incomplete
|
||||
def __init__(self, registry: str | None, ordering: str | None, supplement) -> None: ...
|
||||
|
||||
class PDFInfo(PDFObject):
|
||||
title: str | None
|
||||
subject: str | None
|
||||
author: str | None
|
||||
keywords: str | None
|
||||
creator: str | None
|
||||
producer: str | None
|
||||
creation_date: Incomplete
|
||||
def __init__(
|
||||
self,
|
||||
title: str | None,
|
||||
subject: str | None,
|
||||
author: str | None,
|
||||
keywords: str | None,
|
||||
creator: str | None,
|
||||
producer: str | None,
|
||||
creation_date,
|
||||
) -> None: ...
|
||||
|
||||
class AcroForm:
|
||||
fields: Incomplete
|
||||
sig_flags: Incomplete
|
||||
def __init__(self, fields, sig_flags) -> None: ...
|
||||
def serialize(self) -> str: ...
|
||||
|
||||
class PDFCatalog(PDFObject):
|
||||
type: Name
|
||||
lang: str | None
|
||||
page_layout: Incomplete | None
|
||||
page_mode: Incomplete | None
|
||||
viewer_preferences: Incomplete | None
|
||||
pages: Incomplete | None
|
||||
acro_form: Incomplete | None
|
||||
open_action: Incomplete | None
|
||||
mark_info: Incomplete | None
|
||||
metadata: Incomplete | None
|
||||
names: Incomplete | None
|
||||
outlines: Incomplete | None
|
||||
struct_tree_root: Incomplete | None
|
||||
def __init__(
|
||||
self,
|
||||
lang: str | None = ...,
|
||||
page_layout: Incomplete | None = ...,
|
||||
page_mode: Incomplete | None = ...,
|
||||
viewer_preferences: Incomplete | None = ...,
|
||||
) -> None: ...
|
||||
|
||||
class PDFResources(PDFObject):
|
||||
proc_set: Incomplete
|
||||
font: Incomplete
|
||||
x_object: Incomplete
|
||||
ext_g_state: Incomplete
|
||||
def __init__(self, proc_set, font, x_object, ext_g_state) -> None: ...
|
||||
|
||||
class PDFFontStream(PDFContentStream):
|
||||
length1: int
|
||||
def __init__(self, contents: bytes) -> None: ...
|
||||
|
||||
class PDFXmpMetadata(PDFContentStream):
|
||||
type: Name
|
||||
subtype: Name
|
||||
def __init__(self, contents: bytes) -> None: ...
|
||||
|
||||
class PDFXObject(PDFContentStream):
|
||||
type: Name
|
||||
subtype: Name
|
||||
width: Incomplete
|
||||
height: Incomplete
|
||||
color_space: Incomplete
|
||||
bits_per_component: Incomplete
|
||||
filter: Name
|
||||
decode: Incomplete | None
|
||||
decode_parms: Incomplete | None
|
||||
s_mask: Incomplete | None
|
||||
def __init__(
|
||||
self,
|
||||
contents,
|
||||
subtype: str,
|
||||
width,
|
||||
height,
|
||||
color_space,
|
||||
bits_per_component,
|
||||
img_filter: str | None = ...,
|
||||
decode: Incomplete | None = ...,
|
||||
decode_parms: Incomplete | None = ...,
|
||||
) -> None: ...
|
||||
|
||||
class PDFPage(PDFObject):
|
||||
type: Name
|
||||
contents: Incomplete
|
||||
dur: Incomplete | None
|
||||
trans: Incomplete
|
||||
annots: PDFArray[AnnotationDict]
|
||||
group: Incomplete | None
|
||||
media_box: Incomplete | None
|
||||
struct_parents: Incomplete | None
|
||||
resources: Incomplete | None
|
||||
parent: Incomplete | None
|
||||
def __init__(self, duration: Incomplete | None, transition, contents) -> None: ...
|
||||
def dimensions(self) -> tuple[float | None, float | None]: ...
|
||||
def set_dimensions(self, width_pt: float | None, height_pt: float | None) -> None: ...
|
||||
|
||||
class PDFPagesRoot(PDFObject):
|
||||
type: Name
|
||||
count: Incomplete
|
||||
media_box: Incomplete
|
||||
kids: Incomplete | None
|
||||
def __init__(self, count, media_box) -> None: ...
|
||||
|
||||
class PDFExtGState(PDFObject):
|
||||
def __init__(self, dict_as_str) -> None: ...
|
||||
def serialize(self, obj_dict: object = ...) -> str: ...
|
||||
|
||||
class PDFXrefAndTrailer(ContentWithoutID):
|
||||
output_builder: Incomplete
|
||||
count: int
|
||||
catalog_obj: Incomplete | None
|
||||
info_obj: Incomplete | None
|
||||
def __init__(self, output_builder) -> None: ...
|
||||
def serialize(self) -> str: ...
|
||||
|
||||
class OutputProducer:
|
||||
fpdf: Incomplete
|
||||
pdf_objs: list[Incomplete]
|
||||
obj_id: int
|
||||
offsets: dict[Incomplete, Incomplete]
|
||||
trace_labels_per_obj_id: dict[Incomplete, Incomplete]
|
||||
sections_size_per_trace_label: defaultdict[Incomplete, int]
|
||||
buffer: bytearray
|
||||
def __init__(self, fpdf) -> None: ...
|
||||
def bufferize(self) -> bytearray: ...
|
||||
@@ -1,52 +1,47 @@
|
||||
from typing import Any, NamedTuple
|
||||
from _typeshed import Incomplete
|
||||
from collections import defaultdict
|
||||
from collections.abc import Generator, Iterable
|
||||
|
||||
from .syntax import PDFObject
|
||||
|
||||
class MarkedContent(NamedTuple):
|
||||
page_object_id: int
|
||||
struct_parents_id: int
|
||||
struct_type: str
|
||||
mcid: int | None = ...
|
||||
title: str | None = ...
|
||||
alt_text: str | None = ...
|
||||
from .syntax import PDFArray, PDFObject, PDFString
|
||||
|
||||
class NumberTree(PDFObject):
|
||||
nums: Any
|
||||
def __init__(self, **kwargs) -> None: ...
|
||||
def serialize(self, fpdf: Any | None = ..., obj_dict: Any | None = ...): ...
|
||||
nums: defaultdict[Incomplete, list[Incomplete]]
|
||||
def __init__(self) -> None: ...
|
||||
def serialize(self, obj_dict: object = ...) -> str: ...
|
||||
|
||||
class StructTreeRoot(PDFObject):
|
||||
type: str
|
||||
parent_tree: Any
|
||||
k: Any
|
||||
def __init__(self, **kwargs) -> None: ...
|
||||
parent_tree: NumberTree
|
||||
k: PDFArray[Incomplete]
|
||||
def __init__(self) -> None: ...
|
||||
|
||||
class StructElem(PDFObject):
|
||||
type: str
|
||||
s: Any
|
||||
p: Any
|
||||
k: Any
|
||||
pg: Any
|
||||
t: Any
|
||||
alt: Any
|
||||
s: str
|
||||
p: PDFObject
|
||||
k: PDFArray[Incomplete]
|
||||
t: PDFString | None
|
||||
alt: PDFString | None
|
||||
pg: Incomplete | None
|
||||
def __init__(
|
||||
self,
|
||||
struct_type: str,
|
||||
parent: PDFObject,
|
||||
kids: list[int] | list[StructElem],
|
||||
page: PDFObject | None = ...,
|
||||
kids: Iterable[int] | Iterable[StructElem],
|
||||
page_number: int | None = ...,
|
||||
title: str | None = ...,
|
||||
alt: str | None = ...,
|
||||
**kwargs,
|
||||
) -> None: ...
|
||||
def page_number(self) -> int | None: ...
|
||||
|
||||
class StructureTreeBuilder:
|
||||
struct_tree_root: Any
|
||||
doc_struct_elem: Any
|
||||
struct_elem_per_mc: Any
|
||||
struct_tree_root: Incomplete
|
||||
doc_struct_elem: Incomplete
|
||||
struct_elem_per_mc: Incomplete
|
||||
def __init__(self) -> None: ...
|
||||
def add_marked_content(self, marked_content) -> None: ...
|
||||
def next_mcid_for_page(self, page_object_id): ...
|
||||
def empty(self): ...
|
||||
def serialize(self, first_object_id: int = ..., fpdf: Any | None = ...): ...
|
||||
def assign_ids(self, n): ...
|
||||
def add_marked_content(
|
||||
self, page_number: int, struct_type: str, mcid: int | None = ..., title: str | None = ..., alt_text: str | None = ...
|
||||
) -> tuple[Incomplete, Incomplete]: ...
|
||||
def next_mcid_for_page(self, page_number: int) -> int: ...
|
||||
def empty(self) -> bool: ...
|
||||
def __iter__(self) -> Generator[Incomplete, None, None]: ...
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
from _typeshed import Incomplete
|
||||
from collections.abc import Callable
|
||||
from re import Pattern
|
||||
from typing import NamedTuple
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
from .drawing import Point
|
||||
_BasePen: TypeAlias = Incomplete # actually fontTools.pens.basePen.BasePen
|
||||
|
||||
__pdoc__: dict[str, bool]
|
||||
|
||||
@@ -56,35 +56,12 @@ class ShapeBuilder:
|
||||
|
||||
def convert_transforms(tfstr): ...
|
||||
|
||||
class SVGSmoothCubicCurve(NamedTuple):
|
||||
c2: Point
|
||||
end: Point
|
||||
@classmethod
|
||||
def from_path_points(cls, path, c2x, c2y, ex, ey): ...
|
||||
def render(self, path_gsds, style, last_item, initial_point): ...
|
||||
def render_debug(self, path_gsds, style, last_item, initial_point, debug_stream, pfx): ...
|
||||
|
||||
class SVGRelativeSmoothCubicCurve(NamedTuple):
|
||||
c2: Point
|
||||
end: Point
|
||||
@classmethod
|
||||
def from_path_points(cls, path, c2x, c2y, ex, ey): ...
|
||||
def render(self, path_gsds, style, last_item, initial_point): ...
|
||||
def render_debug(self, path_gsds, style, last_item, initial_point, debug_stream, pfx): ...
|
||||
|
||||
class SVGSmoothQuadraticCurve(NamedTuple):
|
||||
end: Point
|
||||
@classmethod
|
||||
def from_path_points(cls, path, ex, ey): ...
|
||||
def render(self, path_gsds, style, last_item, initial_point): ...
|
||||
def render_debug(self, path_gsds, style, last_item, initial_point, debug_stream, pfx): ...
|
||||
|
||||
class SVGRelativeSmoothQuadraticCurve(NamedTuple):
|
||||
end: Point
|
||||
@classmethod
|
||||
def from_path_points(cls, path, ex, ey): ...
|
||||
def render(self, path_gsds, style, last_item, initial_point): ...
|
||||
def render_debug(self, path_gsds, style, last_item, initial_point, debug_stream, pfx): ...
|
||||
class PathPen(_BasePen):
|
||||
pdf_path: Incomplete
|
||||
last_was_line_to: bool
|
||||
first_is_move: bool | None
|
||||
def __init__(self, pdf_path, *args, **kwargs): ...
|
||||
def arcTo(self, rx, ry, rotation, arc, sweep, end) -> None: ...
|
||||
|
||||
def svg_path_converter(pdf_path, svg_path) -> None: ...
|
||||
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
from _typeshed import Incomplete, SupportsItems
|
||||
from abc import ABC
|
||||
from abc import ABC, abstractmethod
|
||||
from re import Pattern
|
||||
from typing import Any, ClassVar
|
||||
from typing import ClassVar, Generic, TypeVar
|
||||
from typing_extensions import Literal
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
def clear_empty_fields(d): ...
|
||||
def create_dictionary_string(
|
||||
dict_,
|
||||
@@ -17,42 +19,47 @@ def create_list_string(list_): ...
|
||||
def iobj_ref(n): ...
|
||||
def create_stream(stream): ...
|
||||
|
||||
class Raw(str): ...
|
||||
|
||||
class Name(str):
|
||||
NAME_ESC: ClassVar[Pattern[bytes]]
|
||||
def serialize(self) -> str: ...
|
||||
|
||||
class PDFObject:
|
||||
def __init__(self, id: Any | None = ...) -> None: ...
|
||||
def __init__(self) -> None: ...
|
||||
@property
|
||||
def id(self): ...
|
||||
def id(self) -> int: ...
|
||||
@id.setter
|
||||
def id(self, n) -> None: ...
|
||||
def id(self, n: int) -> None: ...
|
||||
@property
|
||||
def ref(self): ...
|
||||
def serialize(self, fpdf: Any | None = ..., obj_dict: Any | None = ...): ...
|
||||
def ref(self) -> str: ...
|
||||
def serialize(self, obj_dict: Incomplete | None = ...) -> str: ...
|
||||
def content_stream(self) -> bytes: ...
|
||||
|
||||
class PDFContentStream(PDFObject):
|
||||
filter: Name | None
|
||||
length: int
|
||||
def __init__(self, contents: bytes, compress: bool = ...) -> None: ...
|
||||
|
||||
def build_obj_dict(key_values: SupportsItems[str, Incomplete]) -> dict[str, str]: ...
|
||||
def camel_case(snake_case: str) -> str: ...
|
||||
|
||||
class PDFString(str):
|
||||
USE_HEX_ENCODING: ClassVar[bool]
|
||||
def serialize(self): ...
|
||||
def serialize(self) -> str: ...
|
||||
|
||||
class PDFArray(list[Any]):
|
||||
def serialize(self): ...
|
||||
class PDFArray(list[_T], Generic[_T]):
|
||||
def serialize(self) -> str: ...
|
||||
|
||||
class Destination(ABC):
|
||||
def as_str(self, pdf: Any | None = ...) -> None: ...
|
||||
@abstractmethod
|
||||
def serialize(self) -> str: ...
|
||||
|
||||
class DestinationXYZ(Destination):
|
||||
page: int
|
||||
x: float
|
||||
y: float
|
||||
page_number: int
|
||||
top: float
|
||||
left: float
|
||||
zoom: float | Literal["null"]
|
||||
page_as_obj_id: bool
|
||||
def __init__(
|
||||
self, page: int, x: float = ..., y: float = ..., zoom: float | Literal["null"] = ..., page_as_obj_id: bool = ...
|
||||
) -> None: ...
|
||||
def as_str(self, pdf: Any | None = ...): ...
|
||||
|
||||
class Raw(str): ...
|
||||
|
||||
class Name(str):
|
||||
NAME_ESC: ClassVar[Pattern[bytes]]
|
||||
def pdf_repr(self) -> str: ...
|
||||
page_ref: Incomplete | None
|
||||
def __init__(self, page: int, top: float, left: float = ..., zoom: float | Literal["null"] = ...) -> None: ...
|
||||
def serialize(self) -> str: ...
|
||||
|
||||
@@ -1,58 +1,59 @@
|
||||
from abc import ABC
|
||||
from typing import Any
|
||||
from abc import ABC, abstractmethod
|
||||
from typing_extensions import Literal
|
||||
|
||||
class Transition(ABC):
|
||||
def dict_as_string(self) -> None: ...
|
||||
@abstractmethod
|
||||
def serialize(self) -> str: ...
|
||||
|
||||
class SplitTransition(Transition):
|
||||
dimension: Any
|
||||
direction: Any
|
||||
def __init__(self, dimension, direction) -> None: ...
|
||||
def dict_as_string(self): ...
|
||||
dimension: Literal["H", "V"]
|
||||
direction: Literal["I", "O"]
|
||||
def __init__(self, dimension: Literal["H", "V"], direction: Literal["I", "O"]) -> None: ...
|
||||
def serialize(self) -> str: ...
|
||||
|
||||
class BlindsTransition(Transition):
|
||||
dimension: Any
|
||||
def __init__(self, dimension) -> None: ...
|
||||
def dict_as_string(self): ...
|
||||
dimension: Literal["H", "V"]
|
||||
def __init__(self, dimension: Literal["H", "V"]) -> None: ...
|
||||
def serialize(self) -> str: ...
|
||||
|
||||
class BoxTransition(Transition):
|
||||
direction: Any
|
||||
def __init__(self, direction) -> None: ...
|
||||
def dict_as_string(self): ...
|
||||
direction: Literal["I", "O"]
|
||||
def __init__(self, direction: Literal["I", "O"]) -> None: ...
|
||||
def serialize(self) -> str: ...
|
||||
|
||||
class WipeTransition(Transition):
|
||||
direction: Any
|
||||
def __init__(self, direction) -> None: ...
|
||||
def dict_as_string(self): ...
|
||||
direction: Literal[0, 90, 180, 270]
|
||||
def __init__(self, direction: Literal[0, 90, 180, 270]) -> None: ...
|
||||
def serialize(self) -> str: ...
|
||||
|
||||
class DissolveTransition(Transition):
|
||||
def dict_as_string(self): ...
|
||||
def serialize(self) -> str: ...
|
||||
|
||||
class GlitterTransition(Transition):
|
||||
direction: Any
|
||||
def __init__(self, direction) -> None: ...
|
||||
def dict_as_string(self): ...
|
||||
direction: Literal[0, 270, 315]
|
||||
def __init__(self, direction: Literal[0, 270, 315]) -> None: ...
|
||||
def serialize(self) -> str: ...
|
||||
|
||||
class FlyTransition(Transition):
|
||||
dimension: Any
|
||||
direction: Any
|
||||
def __init__(self, dimension, direction: Any | None = ...) -> None: ...
|
||||
def dict_as_string(self): ...
|
||||
dimension: Literal["H", "V"]
|
||||
direction: Literal[0, 270] | None
|
||||
def __init__(self, dimension: Literal["H", "V"], direction: Literal[0, 270] | None = ...) -> None: ...
|
||||
def serialize(self) -> str: ...
|
||||
|
||||
class PushTransition(Transition):
|
||||
direction: Any
|
||||
def __init__(self, direction) -> None: ...
|
||||
def dict_as_string(self): ...
|
||||
direction: Literal[0, 270]
|
||||
def __init__(self, direction: Literal[0, 270]) -> None: ...
|
||||
def serialize(self) -> str: ...
|
||||
|
||||
class CoverTransition(Transition):
|
||||
direction: Any
|
||||
def __init__(self, direction) -> None: ...
|
||||
def dict_as_string(self): ...
|
||||
direction: Literal[0, 270]
|
||||
def __init__(self, direction: Literal[0, 270]) -> None: ...
|
||||
def serialize(self) -> str: ...
|
||||
|
||||
class UncoverTransition(Transition):
|
||||
direction: Any
|
||||
def __init__(self, direction) -> None: ...
|
||||
def dict_as_string(self): ...
|
||||
direction: Literal[0, 270]
|
||||
def __init__(self, direction: Literal[0, 270]) -> None: ...
|
||||
def serialize(self) -> str: ...
|
||||
|
||||
class FadeTransition(Transition):
|
||||
def dict_as_string(self): ...
|
||||
def serialize(self) -> str: ...
|
||||
|
||||
@@ -5,7 +5,7 @@ from typing_extensions import Literal, TypeAlias
|
||||
|
||||
_Unit: TypeAlias = Literal["pt", "mm", "cm", "in"]
|
||||
|
||||
def object_id_for_page(page: int) -> int: ...
|
||||
def buffer_subst(buffer: bytearray, placeholder: str, value: str) -> bytearray: ...
|
||||
def format_date(date: datetime.datetime, with_tz: bool = ...) -> str: ...
|
||||
def enclose_in_parens(s: str) -> str: ...
|
||||
def escape_parens(s): ...
|
||||
|
||||
Reference in New Issue
Block a user