|
|
|
@@ -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: ...
|
|
|
|
|