mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-10-04 19:28:50 +08:00
[reportlab] Add more annotations for pdfgen (#15452)
This commit is contained in:
1 parent
de7daebb0b
commit
9a9cc1834d
5 files changed
+68
-43
No files matched your search
@@ -3,6 +3,9 @@ from collections.abc import Callable
|
||||
from typing import IO, Literal
|
||||
|
||||
from reportlab.lib.colors import Color, _ConvertibleToColor
|
||||
from reportlab.pdfbase.acroform import AcroForm
|
||||
from reportlab.pdfbase.pdfdoc import Destination
|
||||
from reportlab.pdfgen.pathobject import PDFPathObject
|
||||
from reportlab.pdfgen.textobject import PDFTextObject, _PDFColorSetter
|
||||
|
||||
class ShowBoundaryValue:
|
||||
@@ -18,14 +21,14 @@ class ShowBoundaryValue:
|
||||
def __bool__(self) -> bool: ...
|
||||
|
||||
class Canvas(_PDFColorSetter):
|
||||
bottomup: int
|
||||
bottomup: bool | Literal[0, 1]
|
||||
imageCaching: Incomplete
|
||||
state_stack: Incomplete
|
||||
state_stack: list[Incomplete]
|
||||
def __init__(
|
||||
self,
|
||||
filename: str | IO[bytes],
|
||||
pagesize: tuple[float, float] | None = None,
|
||||
bottomup: int = 1,
|
||||
bottomup: bool | Literal[0, 1] = 1,
|
||||
pageCompression=None,
|
||||
invariant=None,
|
||||
verbosity: int = 0,
|
||||
@@ -46,8 +49,8 @@ class Canvas(_PDFColorSetter):
|
||||
def init_graphics_state(self) -> None: ...
|
||||
def push_state_stack(self) -> None: ...
|
||||
def pop_state_stack(self) -> None: ...
|
||||
STATE_ATTRIBUTES: Incomplete
|
||||
STATE_RANGE: Incomplete
|
||||
STATE_ATTRIBUTES: list[str]
|
||||
STATE_RANGE: list[int]
|
||||
def setAuthor(self, author: str | None) -> None: ...
|
||||
def setDateFormatter(self, dateFormatter) -> None: ...
|
||||
def addOutlineEntry(self, title, key, level: int = 0, closed=None) -> None: ...
|
||||
@@ -57,17 +60,17 @@ class Canvas(_PDFColorSetter):
|
||||
def setCreator(self, creator: str | None) -> None: ...
|
||||
def setProducer(self, producer: str | None) -> None: ...
|
||||
def setKeywords(self, keywords: str | None) -> None: ...
|
||||
def pageHasData(self): ...
|
||||
def pageHasData(self) -> bool: ...
|
||||
def showOutline(self) -> None: ...
|
||||
def showFullScreen0(self) -> None: ...
|
||||
def setBlendMode(self, v) -> None: ...
|
||||
def showPage(self) -> None: ...
|
||||
def setPageCallBack(self, func) -> None: ...
|
||||
def bookmarkPage(self, key, fit: str = "Fit", left=None, top=None, bottom=None, right=None, zoom=None): ...
|
||||
def bookmarkHorizontalAbsolute(self, key, top, left: int = 0, fit: str = "XYZ", **kw): ...
|
||||
def bookmarkPage(self, key, fit: str = "Fit", left=None, top=None, bottom=None, right=None, zoom=None) -> Destination: ...
|
||||
def bookmarkHorizontalAbsolute(self, key, top, left: int = 0, fit: str = "XYZ", **kw) -> Destination: ...
|
||||
def bookmarkHorizontal(self, key, relativeX, relativeY, **kw) -> None: ...
|
||||
def doForm(self, name) -> None: ...
|
||||
def hasForm(self, name): ...
|
||||
def hasForm(self, name: str) -> bool: ...
|
||||
def drawInlineImage(
|
||||
self,
|
||||
image,
|
||||
@@ -80,7 +83,7 @@ class Canvas(_PDFColorSetter):
|
||||
anchorAtXY: bool = False,
|
||||
showBoundary: bool = False,
|
||||
extraReturn=None,
|
||||
): ...
|
||||
) -> tuple[Incomplete, Incomplete]: ...
|
||||
def drawImage(
|
||||
self,
|
||||
image,
|
||||
@@ -94,18 +97,37 @@ class Canvas(_PDFColorSetter):
|
||||
anchorAtXY: bool = False,
|
||||
showBoundary: bool = False,
|
||||
extraReturn=None,
|
||||
): ...
|
||||
) -> tuple[Incomplete, Incomplete]: ...
|
||||
def beginForm(self, name, lowerx: int = 0, lowery: int = 0, upperx=None, uppery=None) -> None: ...
|
||||
def endForm(self, **extra_attributes) -> None: ...
|
||||
def addPostScriptCommand(self, command, position: int = 1) -> None: ...
|
||||
def freeTextAnnotation(self, contents, DA, Rect=None, addtopage: int = 1, name=None, relative: int = 0, **kw) -> None: ...
|
||||
def textAnnotation(self, contents, Rect=None, addtopage: int = 1, name=None, relative: int = 0, **kw) -> None: ...
|
||||
def freeTextAnnotation(
|
||||
self, contents, DA, Rect=None, addtopage: bool | Literal[0, 1] = 1, name=None, relative: bool | Literal[0, 1] = 0, **kw
|
||||
) -> None: ...
|
||||
def textAnnotation(
|
||||
self, contents, Rect=None, addtopage: bool | Literal[0, 1] = 1, name=None, relative: bool | Literal[0, 1] = 0, **kw
|
||||
) -> None: ...
|
||||
textAnnotation0 = textAnnotation
|
||||
def highlightAnnotation(
|
||||
self, contents, Rect, QuadPoints=None, Color=[0.83, 0.89, 0.95], addtopage: int = 1, name=None, relative: int = 0, **kw
|
||||
self,
|
||||
contents,
|
||||
Rect,
|
||||
QuadPoints=None,
|
||||
Color=[0.83, 0.89, 0.95],
|
||||
addtopage: bool | Literal[0, 1] = 1,
|
||||
name=None,
|
||||
relative: bool | Literal[0, 1] = 0,
|
||||
**kw,
|
||||
) -> None: ...
|
||||
def inkAnnotation(
|
||||
self, contents, InkList=None, Rect=None, addtopage: int = 1, name=None, relative: int = 0, **kw
|
||||
self,
|
||||
contents,
|
||||
InkList=None,
|
||||
Rect=None,
|
||||
addtopage: bool | Literal[0, 1] = 1,
|
||||
name=None,
|
||||
relative: bool | Literal[0, 1] = 0,
|
||||
**kw,
|
||||
) -> None: ...
|
||||
inkAnnotation0 = inkAnnotation
|
||||
def linkAbsolute(
|
||||
@@ -113,31 +135,31 @@ class Canvas(_PDFColorSetter):
|
||||
contents,
|
||||
destinationname,
|
||||
Rect=None,
|
||||
addtopage: int = 1,
|
||||
addtopage: bool | Literal[0, 1] = 1,
|
||||
name=None,
|
||||
thickness: int = 0,
|
||||
color: Color | None = None,
|
||||
dashArray=None,
|
||||
**kw,
|
||||
): ...
|
||||
) -> None: ...
|
||||
def linkRect(
|
||||
self,
|
||||
contents,
|
||||
destinationname,
|
||||
Rect=None,
|
||||
addtopage: int = 1,
|
||||
addtopage: bool | Literal[0, 1] = 1,
|
||||
name=None,
|
||||
relative: int = 1,
|
||||
relative: bool | Literal[0, 1] = 1,
|
||||
thickness: int = 0,
|
||||
color: Color | None = None,
|
||||
dashArray=None,
|
||||
**kw,
|
||||
): ...
|
||||
) -> None: ...
|
||||
def linkURL(
|
||||
self,
|
||||
url,
|
||||
rect,
|
||||
relative: int = 0,
|
||||
relative: bool | Literal[0, 1] = 0,
|
||||
thickness: int = 0,
|
||||
color: Color | None = None,
|
||||
dashArray=None,
|
||||
@@ -154,7 +176,7 @@ class Canvas(_PDFColorSetter):
|
||||
def setBleedBox(self, size) -> None: ...
|
||||
# NOTE: Only accepts right angles
|
||||
def setPageRotation(self, rot: float) -> None: ...
|
||||
def addLiteral(self, s: object, escaped: int = 1) -> None: ...
|
||||
def addLiteral(self, s: object, escaped: Literal[0, 1] = 1) -> None: ...
|
||||
def resetTransforms(self) -> None: ...
|
||||
def transform(self, a: float, b: float, c: float, d: float, e: float, f: float) -> None: ...
|
||||
def absolutePosition(self, x: float, y: float) -> tuple[float, float]: ...
|
||||
@@ -237,8 +259,8 @@ class Canvas(_PDFColorSetter):
|
||||
wordSpace: float | None = None,
|
||||
shaping: bool = False,
|
||||
) -> None: ...
|
||||
def getAvailableFonts(self): ...
|
||||
def listLoadedFonts0(self): ...
|
||||
def getAvailableFonts(self) -> list[Incomplete]: ...
|
||||
def listLoadedFonts0(self) -> list[Incomplete]: ...
|
||||
def setFont(self, psfontname: str, size: float, leading: float | None = None) -> None: ...
|
||||
def setFontSize(self, size: float | None = None, leading: float | None = None) -> None: ...
|
||||
def stringWidth(self, text: str, fontName: str | None = None, fontSize: float | None = None) -> float: ...
|
||||
@@ -247,26 +269,26 @@ class Canvas(_PDFColorSetter):
|
||||
def setLineJoin(self, mode) -> None: ...
|
||||
def setMiterLimit(self, limit) -> None: ...
|
||||
def setDash(self, array: list[float] | tuple[float, ...] | float = [], phase: float = 0) -> None: ...
|
||||
def beginPath(self): ...
|
||||
def beginPath(self) -> PDFPathObject: ...
|
||||
def drawPath(self, aPath, stroke: int = 1, fill: int = 0, fillMode=None) -> None: ...
|
||||
def clipPath(self, aPath, stroke: int = 1, fill: int = 0, fillMode=None) -> None: ...
|
||||
def beginText(self, x: float = 0, y: float = 0, direction: Literal["LTR", "RTL"] | None = None) -> PDFTextObject: ...
|
||||
def drawText(self, aTextObject: PDFTextObject) -> None: ...
|
||||
def setPageCompression(self, pageCompression: int = 1) -> None: ...
|
||||
def setPageCompression(self, pageCompression: bool | Literal[0, 1] | None = 1) -> None: ...
|
||||
def setPageDuration(self, duration=None) -> None: ...
|
||||
def setPageTransition(
|
||||
self, effectname: str | None = None, duration: float = 1, direction: float = 0, dimension: str = "H", motion: str = "I"
|
||||
) -> None: ...
|
||||
def getCurrentPageContent(self): ...
|
||||
def getCurrentPageContent(self) -> str: ...
|
||||
def setViewerPreference(self, pref, value) -> None: ...
|
||||
def getViewerPreference(self, pref): ...
|
||||
def delViewerPreference(self, pref) -> None: ...
|
||||
def setCatalogEntry(self, key, value) -> None: ...
|
||||
def getCatalogEntry(self, key): ...
|
||||
def delCatalogEntry(self, key) -> None: ...
|
||||
def setCatalogEntry(self, key: str, value) -> None: ...
|
||||
def getCatalogEntry(self, key: str): ...
|
||||
def delCatalogEntry(self, key: str) -> None: ...
|
||||
def addPageLabel(self, pageNum, style=None, start=None, prefix=None) -> None: ...
|
||||
@property
|
||||
def acroForm(self): ...
|
||||
def acroForm(self) -> AcroForm: ...
|
||||
def drawBoundary(self, sb, x1: float, y1: float, width: float, height: float) -> None: ...
|
||||
# Following callbacks are accepted: canvas, kind and label
|
||||
def setNamedCB(self, name: str, cb: Callable[[Canvas, str | None, str], None]) -> None: ...
|
||||
|
||||
@@ -4,7 +4,7 @@ __version__: Final[str]
|
||||
|
||||
class PDFPathObject:
|
||||
def __init__(self, code=None) -> None: ...
|
||||
def getCode(self): ...
|
||||
def getCode(self) -> str: ...
|
||||
def moveTo(self, x, y) -> None: ...
|
||||
def lineTo(self, x, y) -> None: ...
|
||||
def curveTo(self, x1, y1, x2, y2, x3, y3) -> None: ...
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
from _typeshed import Incomplete
|
||||
from typing import Final
|
||||
|
||||
__version__: Final[str]
|
||||
|
||||
def bezierArc(x1, y1, x2, y2, startAng: int = 0, extent: int = 90): ...
|
||||
def bezierArc(
|
||||
x1, y1, x2, y2, startAng: int = 0, extent: int = 90
|
||||
) -> list[tuple[Incomplete, Incomplete, Incomplete, Incomplete, Incomplete, Incomplete, Incomplete, Incomplete]]: ...
|
||||
@@ -1,5 +1,5 @@
|
||||
from _typeshed import Incomplete
|
||||
from typing import Final
|
||||
from typing import Final, Literal
|
||||
|
||||
__version__: Final[str]
|
||||
|
||||
@@ -10,16 +10,16 @@ class PDFImage:
|
||||
width: Incomplete
|
||||
height: Incomplete
|
||||
filename: Incomplete
|
||||
imageCaching: Incomplete
|
||||
imageCaching: bool | Literal[0, 1]
|
||||
colorSpace: str
|
||||
bitsPerComponent: int
|
||||
filters: Incomplete
|
||||
source: Incomplete
|
||||
def __init__(self, image, x, y, width=None, height=None, caching: int = 0) -> None: ...
|
||||
def jpg_imagedata(self): ...
|
||||
def cache_imagedata(self): ...
|
||||
def PIL_imagedata(self): ...
|
||||
def non_jpg_imagedata(self, image): ...
|
||||
def __init__(self, image, x, y, width=None, height=None, caching: bool | Literal[0, 1] = 0) -> None: ...
|
||||
def jpg_imagedata(self) -> tuple[list[str], Incomplete, Incomplete]: ...
|
||||
def cache_imagedata(self) -> list[str]: ...
|
||||
def PIL_imagedata(self) -> tuple[list[str], Incomplete, Incomplete]: ...
|
||||
def non_jpg_imagedata(self, image) -> tuple[list[str], int, int]: ...
|
||||
imageData: Incomplete
|
||||
imgwidth: Incomplete
|
||||
imgheight: Incomplete
|
||||
@@ -32,5 +32,5 @@ class PDFImage:
|
||||
anchorAtXY: bool = False,
|
||||
showBoundary: bool = False,
|
||||
extraReturn=None,
|
||||
): ...
|
||||
def format(self, document): ...
|
||||
) -> bool: ...
|
||||
def format(self, document) -> bytes: ...
|
||||
@@ -68,5 +68,5 @@ class PDFTextObject(_PDFColorSetter):
|
||||
def setRise(self, rise: float) -> None: ...
|
||||
def textOut(self, text: str) -> None: ...
|
||||
def textLine(self, text: str = "") -> None: ...
|
||||
def textLines(self, stuff: list[str] | tuple[str, ...] | str, trim: int = 1) -> None: ...
|
||||
def textLines(self, stuff: list[str] | tuple[str, ...] | str, trim: Literal[0, 1] = 1) -> None: ...
|
||||
def __nonzero__(self) -> bool: ...
|
||||
Reference in new issue
Block a user