[reportlab] Add more annotations for pdfbase (#15431)

This commit is contained in:
Semyon Moroz
2026-02-20 18:44:28 +00:00
committed by GitHub
parent 5af6060410
commit 789bc53252
11 changed files with 530 additions and 373 deletions
+5 -4
View File
@@ -1,15 +1,16 @@
from _typeshed import Incomplete
from typing import Literal
def fp_str(*a): ...
def unicode2T1(utext, fonts): ...
def fp_str(*a) -> str: ...
def unicode2T1(utext, fonts) -> list[tuple[Incomplete, Incomplete]]: ...
def instanceStringWidthT1(self, text: str, size: float, encoding: str = "utf8") -> float: ...
def instanceStringWidthTTF(self, text: str, size: float, encoding: str = "utf8") -> float: ...
def hex32(i) -> str: ...
def add32(x: int, y: int) -> int: ...
def calcChecksum(data: str | bytes) -> int: ...
def escapePDF(s): ...
def escapePDF(s) -> str: ...
def asciiBase85Encode(input: str) -> str: ...
def asciiBase85Decode(input): ...
def asciiBase85Decode(input) -> bytes: ...
def sameFrag(f, g) -> bool | Literal[0]: ...
__all__ = [
+13 -12
View File
@@ -3,6 +3,7 @@ import zipimport
from _typeshed import Incomplete, SupportsItems
from collections.abc import Generator, Iterable, MutableMapping
from os import PathLike
from time import _TimeTuple, struct_time
from types import TracebackType
from typing import AnyStr, Final, Literal, TypeVar, overload, type_check_only
from urllib.request import _UrlopenRet
@@ -174,23 +175,23 @@ class RLString(str):
def makeFileName(s): ...
class FixedOffsetTZ(datetime.tzinfo):
def __init__(self, h, m, name) -> None: ...
def utcoffset(self, dt): ...
def tzname(self, dt): ...
def dst(self, dt): ...
def __init__(self, h: float, m: float, name: str | None) -> None: ...
def utcoffset(self, dt: datetime.datetime | None) -> datetime.timedelta: ...
def tzname(self, dt: datetime.datetime | None) -> str | None: ...
def dst(self, dt: datetime.datetime | None) -> datetime.timedelta: ...
class TimeStamp:
tzname: str
t: Incomplete
lt: Incomplete
YMDhms: Incomplete
dhh: Incomplete
dmm: Incomplete
def __init__(self, invariant=None) -> None: ...
t: float
lt: struct_time | _TimeTuple
YMDhms: tuple[int, ...]
dhh: int
dmm: int
def __init__(self, invariant: int | bool | None = None) -> None: ...
@property
def datetime(self): ...
def datetime(self) -> datetime.datetime: ...
@property
def asctime(self): ...
def asctime(self) -> str: ...
def recursiveGetAttr(obj, name, g=None): ...
def recursiveSetAttr(obj, name, value) -> None: ...
+161 -40
View File
@@ -1,37 +1,47 @@
from _typeshed import Incomplete
from weakref import ReferenceType
from reportlab.pdfbase.pdfdoc import PDFObject
from reportlab.pdfbase.pdfdoc import PDFDictionary, PDFObject, PDFStream
__all__ = ("AcroForm",)
visibilities: dict[str, int]
orientations: dict[str, list[Incomplete]]
fieldFlagValues: dict[str, int]
annotationFlagValues: dict[str, int]
def bsPDF(borderWidth: int, borderStyle: str, dashLen) -> PDFDictionary: ...
def escPDF(s) -> str: ...
def makeFlags(s: int | str, d: dict[str, int] = ...) -> int: ...
class PDFFromString(PDFObject):
def __init__(self, s) -> None: ...
def format(self, document): ...
def __init__(self, s: str | bytes) -> None: ...
def format(self, document) -> bytes: ...
class RadioGroup(PDFObject):
TU: Incomplete
Ff: Incomplete
kids: Incomplete
Ff: int
kids: list[Incomplete]
T: Incomplete
V: Incomplete
def __init__(self, name, tooltip: str = "", fieldFlags: str = "noToggleToOff required radio") -> None: ...
def format(self, doc): ...
def format(self, doc) -> bytes: ...
class AcroForm(PDFObject):
formFontNames: Incomplete
referenceMap: Incomplete
fonts: Incomplete
fields: Incomplete
formFontNames: dict[str, str]
referenceMap: dict[Incomplete, Incomplete]
fonts: dict[str, str]
fields: list[Incomplete]
sigFlags: Incomplete
extras: Incomplete
extras: dict[Incomplete, Incomplete]
def __init__(self, canv, **kwds) -> None: ...
@property
def canv(self): ...
def fontRef(self, f): ...
def format(self, doc): ...
def canv(self) -> ReferenceType[Incomplete]: ...
def fontRef(self, f) -> str: ...
def format(self, doc) -> bytes: ...
def colorTuple(self, c): ...
def streamFillColor(self, c): ...
def streamStrokeColor(self, c): ...
def streamFillColor(self, c) -> str: ...
def streamStrokeColor(self, c) -> str: ...
def checkboxAP(
self,
key,
@@ -45,16 +55,16 @@ class AcroForm(PDFObject):
borderStyle: str = "solid",
size: int = 20,
dashLen: int = 3,
): ...
) -> PDFStream: ...
@staticmethod
def circleArcStream(size, r, arcs=(0, 1, 2, 3), rotated: bool = False): ...
def zdMark(self, c, size, ds, iFontName): ...
def circleArcStream(size, r, arcs=(0, 1, 2, 3), rotated: bool = False) -> str: ...
def zdMark(self, c, size, ds, iFontName) -> str: ...
def getRef(self, obj): ...
def getRefStr(self, obj): ...
def getRefStr(self, obj) -> str: ...
@staticmethod
def stdColors(t, b, f): ...
def stdColors(t, b, f) -> tuple[Incomplete, Incomplete, Incomplete]: ...
@staticmethod
def varyColors(key, t, b, f): ...
def varyColors(key, t, b, f) -> tuple[Incomplete, Incomplete, Incomplete]: ...
def checkForceBorder(
self, x, y, width, height, forceBorder, shape, borderStyle, borderWidth, borderColor, fillColor
) -> None: ...
@@ -101,7 +111,7 @@ class AcroForm(PDFObject):
relative: bool = False,
dashLen: int = 3,
) -> None: ...
def makeStream(self, width, height, stream, **D): ...
def makeStream(self, width, height, stream, **D) -> PDFStream: ...
def txAP(
self,
key,
@@ -123,8 +133,8 @@ class AcroForm(PDFObject):
I=[],
sel_bg: str = "0.600006 0.756866 0.854904 rg",
sel_fg: str = "0 g",
): ...
def makeFont(self, fontName): ...
) -> PDFStream: ...
def makeFont(self, fontName: str | None) -> tuple[str, str]: ...
def textfield(
self,
value: str = "",
@@ -144,10 +154,10 @@ class AcroForm(PDFObject):
forceBorder: bool = False,
relative: bool = False,
maxlen: int = 100,
fontName=None,
fontName: str | None = None,
fontSize=None,
dashLen: int = 3,
): ...
) -> None: ...
def listbox(
self,
value: str = "",
@@ -166,12 +176,12 @@ class AcroForm(PDFObject):
fieldFlags: str = "",
forceBorder: bool = False,
relative: bool = False,
fontName=None,
fontName: str | None = None,
fontSize=None,
dashLen: int = 3,
maxlen=None,
options=[],
): ...
) -> None: ...
def choice(
self,
value: str = "",
@@ -190,25 +200,136 @@ class AcroForm(PDFObject):
fieldFlags: str = "combo",
forceBorder: bool = False,
relative: bool = False,
fontName=None,
fontName: str | None = None,
fontSize=None,
dashLen: int = 3,
maxlen=None,
options=[],
): ...
def checkboxRelative(self, **kwds) -> None: ...
def radioRelative(self, **kwds) -> None: ...
def textfieldRelative(self, **kwds) -> None: ...
def listboxRelative(self, **kwds) -> None: ...
def choiceRelative(self, **kwds) -> None: ...
) -> None: ...
def checkboxRelative(
self,
*,
checked: bool = False,
buttonStyle: str = "check",
shape: str = "square",
fillColor=None,
borderColor=None,
textColor=None,
borderWidth: int = 1,
borderStyle: str = "solid",
size: int = 20,
x: int = 0,
y: int = 0,
tooltip=None,
name=None,
annotationFlags: str = "print",
fieldFlags: str = "required",
forceBorder: bool = False,
dashLen: int = 3,
) -> None: ...
def radioRelative(
self,
*,
value=None,
selected: bool = False,
buttonStyle: str = "circle",
shape: str = "circle",
fillColor=None,
borderColor=None,
textColor=None,
borderWidth: int = 1,
borderStyle: str = "solid",
size: int = 20,
x: int = 0,
y: int = 0,
tooltip=None,
name=None,
annotationFlags: str = "print",
fieldFlags: str = "noToggleToOff required radio",
forceBorder: bool = False,
dashLen: int = 3,
) -> None: ...
def textfieldRelative(
self,
*,
value: str = "",
fillColor=None,
borderColor=None,
textColor=None,
borderWidth: int = 1,
borderStyle: str = "solid",
width: int = 120,
height: int = 36,
x: int = 0,
y: int = 0,
tooltip=None,
name=None,
annotationFlags: str = "print",
fieldFlags: str = "",
forceBorder: bool = False,
maxlen: int = 100,
fontName: str | None = None,
fontSize=None,
dashLen: int = 3,
) -> None: ...
def listboxRelative(
self,
*,
value: str = "",
fillColor=None,
borderColor=None,
textColor=None,
borderWidth: int = 1,
borderStyle: str = "solid",
width: int = 120,
height: int = 36,
x: int = 0,
y: int = 0,
tooltip=None,
name=None,
annotationFlags: str = "print",
fieldFlags: str = "",
forceBorder: bool = False,
maxlen: int = 100,
fontName: str | None = None,
fontSize=None,
dashLen: int = 3,
) -> None: ...
def choiceRelative(
self,
*,
value: str = "",
fillColor=None,
borderColor=None,
textColor=None,
borderWidth: int = 1,
borderStyle: str = "solid",
width: int = 120,
height: int = 36,
x: int = 0,
y: int = 0,
tooltip=None,
name=None,
annotationFlags: str = "print",
fieldFlags: str = "",
forceBorder: bool = False,
maxlen: int = 100,
fontName: str | None = None,
fontSize=None,
dashLen: int = 3,
) -> None: ...
@property
def encRefStr(self): ...
def encRefStr(self) -> str: ...
class CBMark:
opNames: Incomplete
opCount: Incomplete
opNames: list[str]
opCount: tuple[int, ...]
ops: Incomplete
xmin: Incomplete
ymin: Incomplete
xmax: Incomplete
ymax: Incomplete
points: Incomplete
slack: Incomplete
def __init__(self, ops, points, bounds, slack: float = 0.05) -> None: ...
def scaledRender(self, size, ds: int = 0): ...
def scaledRender(self, size, ds: int = 0) -> str: ...
+19 -18
View File
@@ -1,23 +1,23 @@
from _typeshed import Incomplete
from typing import Final
from typing import Final, Literal
from reportlab.pdfbase import pdfmetrics
__version__: Final[str]
DISABLE_CMAP: bool
def findCMapFile(name): ...
def findCMapFile(name: str) -> str: ...
def structToPDF(structure): ...
class CIDEncoding(pdfmetrics.Encoding):
name: Incomplete
source: Incomplete
def __init__(self, name, useCache: int = 1) -> None: ...
source: str | None
def __init__(self, name, useCache: bool | Literal[0, 1] = 1) -> None: ...
def parseCMAPFile(self, name) -> None: ...
def translate(self, text): ...
def translate(self, text) -> list[Incomplete]: ...
def fastSave(self, directory) -> None: ...
def fastLoad(self, directory) -> None: ...
def getData(self): ...
def getData(self) -> dict[str, Incomplete]: ...
class CIDTypeFace(pdfmetrics.TypeFace):
def __init__(self, name) -> None: ...
@@ -25,27 +25,28 @@ class CIDTypeFace(pdfmetrics.TypeFace):
class CIDFont(pdfmetrics.Font):
faceName: Incomplete
face: Incomplete
face: CIDTypeFace
encodingName: Incomplete
encoding: Incomplete
encoding: CIDEncoding
fontName: Incomplete
name: Incomplete
isVertical: Incomplete
substitutionFonts: Incomplete
isVertical: bool
substitutionFonts: list[Incomplete]
def __init__(self, face, encoding) -> None: ...
def formatForPdf(self, text): ...
def stringWidth(self, text, size, encoding=None): ...
def formatForPdf(self, text) -> str: ...
def stringWidth(self, text, size, encoding=None) -> float: ...
def addObjects(self, doc) -> None: ...
class UnicodeCIDFont(CIDFont):
language: Incomplete
language: str
name: Incomplete
vertical: Incomplete
isHalfWidth: Incomplete
fontName: Incomplete
vertical: bool
isHalfWidth: bool
unicodeWidths: Incomplete
def __init__(self, face, isVertical: bool = False, isHalfWidth: bool = False) -> None: ...
def formatForPdf(self, text): ...
def stringWidth(self, text, size, encoding=None): ...
def __init__(self, face: str, isVertical: bool = False, isHalfWidth: bool = False) -> None: ...
def formatForPdf(self, text) -> str: ...
def stringWidth(self, text, size, encoding=None) -> float: ...
def precalculate(cmapdir) -> None: ...
def test() -> None: ...
+194 -173
View File
@@ -1,6 +1,9 @@
from _typeshed import Incomplete
from collections.abc import Mapping
from typing import Final
from abc import abstractmethod
from collections.abc import Callable, Iterable, Mapping
from typing import Any, Final, Literal, TypeVar, overload
_T = TypeVar("_T")
__version__: Final[str]
@@ -14,9 +17,9 @@ Pages: Final[str]
PDF_VERSION_DEFAULT: Final[tuple[int, int]]
PDF_SUPPORT_VERSION: Final[Mapping[str, tuple[int, int]]]
def pdfdocEnc(x): ...
def format(element, document, toplevel: int = 0): ...
def xObjectName(externalname): ...
def pdfdocEnc(x: str | _T) -> bytes | _T: ...
def format(element, document, toplevel: bool | Literal[0, 1] = 0): ...
def xObjectName(externalname: str) -> str: ...
formName = xObjectName
@@ -29,46 +32,53 @@ class NoEncryption:
class PDFObject: ...
class DummyDoc(PDFObject):
encrypt: Incomplete
encrypt: NoEncryption
class PDFDocument(PDFObject):
defaultStreamFilters: Incomplete
encrypt: Incomplete
encrypt: NoEncryption
objectcounter: int
shadingCounter: int
inObject: Incomplete
inObject: str | None
pageCounter: int
invariant: Incomplete
idToObjectNumberAndVersion: Incomplete
idToObject: Incomplete
idToOffset: Incomplete
numberToId: Incomplete
outline: Incomplete
info: Incomplete
fontMapping: Incomplete
delayedFonts: Incomplete
invariant: bool | Literal[0, 1]
idToObjectNumberAndVersion: dict[str, tuple[int, int]]
idToObject: dict[str, PDFObject]
idToOffset: dict[Incomplete, Incomplete]
numberToId: dict[int, str]
outline: PDFOutlines0 | PDFOutlines
Outlines: PDFOutlines0 | PDFOutlines
info: PDFInfo
fontMapping: dict[Incomplete, Incomplete]
delayedFonts: list[Incomplete]
def __init__(
self, dummyoutline: int = 0, compression=1, invariant=0, filename=None, pdfVersion=(1, 3), lang=None
self,
dummyoutline: bool | Literal[0, 1] | None = 0,
compression: bool | Literal[0, 1] | None = 1,
invariant: bool | Literal[0, 1] | None = 0,
filename=None,
pdfVersion=(1, 3),
lang=None,
) -> None: ...
compression: Incomplete
def setCompression(self, onoff) -> None: ...
def ensureMinPdfVersion(self, *keys) -> None: ...
compression: bool | Literal[0, 1] | None
def setCompression(self, onoff: bool | Literal[0, 1] | None) -> None: ...
def ensureMinPdfVersion(self, *keys: str) -> None: ...
def updateSignature(self, thing) -> None: ...
def ID(self): ...
def ID(self) -> bytes: ...
def SaveToFile(self, filename, canvas) -> None: ...
def GetPDFData(self, canvas): ...
def GetPDFData(self, canvas) -> bytes: ...
def inPage(self) -> None: ...
def inForm(self) -> None: ...
def getInternalFontName(self, psfontname): ...
def thisPageName(self): ...
def thisPageRef(self): ...
def getInternalFontName(self, psfontname: str): ...
def thisPageName(self) -> str: ...
def thisPageRef(self) -> PDFObjectReference: ...
def addPage(self, page) -> None: ...
def addForm(self, name, form) -> None: ...
def annotationName(self, externalname): ...
def annotationName(self, externalname) -> str: ...
def addAnnotation(self, name, annotation) -> None: ...
def refAnnotation(self, name): ...
def addShading(self, shading): ...
def addColor(self, cmyk): ...
def refAnnotation(self, name) -> PDFObjectReference: ...
def addShading(self, shading) -> str: ...
def addColor(self, cmyk) -> tuple[Incomplete, Incomplete]: ...
def setTitle(self, title) -> None: ...
def setAuthor(self, author) -> None: ...
def setSubject(self, subject) -> None: ...
@@ -76,36 +86,36 @@ class PDFDocument(PDFObject):
def setProducer(self, producer) -> None: ...
def setKeywords(self, keywords) -> None: ...
def setDateFormatter(self, dateFormatter) -> None: ...
def getAvailableFonts(self): ...
__accum__: Incomplete
def format(self): ...
def hasForm(self, name): ...
def getFormBBox(self, name, boxType: str = "MediaBox"): ...
def getXObjectName(self, name): ...
def xobjDict(self, formnames): ...
def getAvailableFonts(self) -> list[Incomplete]: ...
__accum__: PDFFile
def format(self) -> bytes: ...
def hasForm(self, name: str) -> bool: ...
def getFormBBox(self, name: str, boxType: str = "MediaBox"): ...
def getXObjectName(self, name: str) -> str: ...
def xobjDict(self, formnames: Iterable[str]) -> PDFDictionary: ...
def Reference(self, obj, name=None): ...
PDFtrue: str
PDFfalse: str
PDFnull: str
PDFtrue: Final = "true"
PDFfalse: Final = "false"
PDFnull: Final = "null"
class PDFText(PDFObject):
t: Incomplete
enc: Incomplete
enc: str
def __init__(self, t, enc: str = "utf-8") -> None: ...
def format(self, document): ...
def format(self, document) -> bytes: ...
def PDFnumber(n): ...
def PDFnumber(n: _T) -> _T: ...
class PDFString(PDFObject):
unicodeEncValid: bool
s: Incomplete
escape: Incomplete
enc: Incomplete
def __init__(self, s, escape: int = 1, enc: str = "auto") -> None: ...
def format(self, document): ...
s: str | bytes
escape: int
enc: str
def __init__(self, s: str | bytes | PDFString, escape: int = 1, enc: str = "auto") -> None: ...
def format(self, document) -> bytes: ...
def PDFName(data, lo="!", hi="~"): ...
def PDFName(data, lo="!", hi="~") -> str: ...
class PDFDictionary(PDFObject):
multiline: bool
@@ -115,38 +125,43 @@ class PDFDictionary(PDFObject):
def __getitem__(self, a): ...
def __contains__(self, a) -> bool: ...
def Reference(self, name, document) -> None: ...
def format(self, document, IND: bytes = b"\n "): ...
def copy(self): ...
def format(self, document, IND: bytes = b"\n ") -> bytes: ...
def copy(self) -> PDFDictionary: ...
def normalize(self) -> None: ...
class checkPDFNames:
names: Incomplete
names: list[str]
def __init__(self, *names) -> None: ...
def __call__(self, value): ...
def __call__(self, value: str) -> str | None: ...
def checkPDFBoolean(value): ...
@overload
def checkPDFBoolean(value: Literal["true"]) -> Literal["true"]: ...
@overload
def checkPDFBoolean(value: Literal["false"]) -> Literal["false"]: ...
@overload
def checkPDFBoolean(value: Any) -> None: ...
class CheckedPDFDictionary(PDFDictionary):
validate: Incomplete
def __init__(self, dict=None, validate=None) -> None: ...
validate: dict[str, Incomplete]
def __init__(self, dict=None, validate: dict[str, Incomplete] | None = None) -> None: ...
def __setitem__(self, name, value) -> None: ...
class ViewerPreferencesPDFDictionary(CheckedPDFDictionary):
validate: Incomplete
validate: dict[str, Incomplete]
class PDFStreamFilterZCompress:
pdfname: str
def encode(self, text): ...
def decode(self, encoded): ...
def encode(self, text) -> bytes: ...
def decode(self, encoded) -> bytes: ...
PDFZCompress: Incomplete
PDFZCompress: PDFStreamFilterZCompress
class PDFStreamFilterBase85Encode:
pdfname: str
def encode(self, text): ...
def decode(self, text): ...
def encode(self, text) -> str: ...
def decode(self, text) -> bytes: ...
PDFBase85Encode: Incomplete
PDFBase85Encode: PDFStreamFilterBase85Encode
class PDFStream(PDFObject):
__RefOnly__: int
@@ -154,67 +169,67 @@ class PDFStream(PDFObject):
content: Incomplete
filters: Incomplete
def __init__(self, dictionary=None, content=None, filters=None) -> None: ...
def format(self, document): ...
def format(self, document) -> bytes: ...
def teststream(content=None): ...
def teststream(content=None) -> PDFStream: ...
teststreamcontent: str
class PDFArray(PDFObject):
multiline: bool
sequence: Incomplete
sequence: list[Incomplete]
def __init__(self, sequence) -> None: ...
def References(self, document) -> None: ...
def format(self, document, IND: bytes = b"\n "): ...
def format(self, document, IND: bytes = b"\n ") -> bytes: ...
class PDFArrayCompact(PDFArray):
multiline: bool
class PDFIndirectObject(PDFObject):
__RefOnly__: int
name: Incomplete
name: str
content: Incomplete
def __init__(self, name, content) -> None: ...
def format(self, document): ...
def __init__(self, name: str, content) -> None: ...
def format(self, document) -> bytes: ...
class PDFObjectReference(PDFObject):
name: Incomplete
def __init__(self, name) -> None: ...
def format(self, document): ...
name: str
def __init__(self, name: str) -> None: ...
def format(self, document) -> bytes: ...
class PDFFile(PDFObject):
strings: Incomplete
write: Incomplete
strings: list[bytes]
write: Callable[[bytes], None]
offset: int
def __init__(self, pdfVersion=(1, 3)) -> None: ...
def __init__(self, pdfVersion: tuple[int, int] = (1, 3)) -> None: ...
def closeOrReset(self) -> None: ...
def add(self, s): ...
def format(self, document): ...
def add(self, s) -> int: ...
def format(self, document) -> bytes: ...
class PDFCrossReferenceSubsection(PDFObject):
firstentrynumber: Incomplete
idsequence: Incomplete
def __init__(self, firstentrynumber, idsequence) -> None: ...
def format(self, document): ...
def format(self, document) -> bytes: ...
class PDFCrossReferenceTable(PDFObject):
sections: Incomplete
sections: list[PDFCrossReferenceSubsection]
def __init__(self) -> None: ...
def addsection(self, firstentry, ids) -> None: ...
def format(self, document): ...
def format(self, document) -> bytes: ...
class PDFTrailer(PDFObject):
startxref: Incomplete
def __init__(self, startxref, Size=None, Prev=None, Root=None, Info=None, ID=None, Encrypt=None) -> None: ...
def format(self, document): ...
def format(self, document) -> bytes: ...
class PDFCatalog(PDFObject):
__Comment__: str
__RefOnly__: int
__Defaults__: Incomplete
__NoDefault__: Incomplete
__Defaults__: dict[str, str | None]
__NoDefault__: list[str]
__Refs__ = __NoDefault__
def format(self, document): ...
def format(self, document) -> bytes: ...
def showOutline(self) -> None: ...
def showFullScreen(self) -> None: ...
PageLayout: Incomplete
@@ -227,14 +242,14 @@ class PDFPages(PDFCatalog):
__Comment__: str
__RefOnly__: int
__Defaults__: Incomplete
__NoDefault__: Incomplete
__NoDefault__: list[str]
__Refs__: Incomplete
pages: Incomplete
def __init__(self) -> None: ...
def __getitem__(self, item): ...
def addPage(self, page) -> None: ...
Kids: Incomplete
Count: Incomplete
Kids: PDFArray
Count: int
def check_format(self, document) -> None: ...
class PDFPage(PDFCatalog):
@@ -242,13 +257,13 @@ class PDFPage(PDFCatalog):
Override_default_compilation: int
__RefOnly__: int
__Defaults__: Incomplete
__NoDefault__: Incomplete
__NoDefault__: list[str]
__Refs__: Incomplete
pagewidth: int
pageheight: int
stream: Incomplete
hasImages: int
compression: int
hasImages: bool | Literal[0, 1]
compression: bool | Literal[0, 1]
XObjects: Incomplete
Trans: Incomplete
def __init__(self) -> None: ...
@@ -268,19 +283,19 @@ class PDFPageLabels(PDFCatalog):
__comment__: Incomplete
__RefOnly__: int
__Defaults__: Incomplete
__NoDefault__: Incomplete
__NoDefault__: list[str]
__Refs__: Incomplete
labels: Incomplete
def __init__(self) -> None: ...
def addPageLabel(self, page, label) -> None: ...
Nums: Incomplete
def format(self, document): ...
def format(self, document) -> bytes: ...
class PDFPageLabel(PDFCatalog):
__Comment__: Incomplete
__RefOnly__: int
__Defaults__: Incomplete
__NoDefault__: Incomplete
__NoDefault__: list[str]
__convertible__: str
ARABIC: str
ROMAN_UPPER: str
@@ -299,9 +314,9 @@ DUMMYOUTLINE: str
class PDFOutlines0(PDFObject):
__Comment__: str
text: Incomplete
text: str
__RefOnly__: int
def format(self, document): ...
def format(self, document) -> bytes: ...
class OutlineEntryObject(PDFObject):
Title: Incomplete
@@ -312,11 +327,11 @@ class OutlineEntryObject(PDFObject):
First: Incomplete
Last: Incomplete
Count: Incomplete
def format(self, document): ...
def format(self, document) -> bytes: ...
class PDFOutlines(PDFObject):
mydestinations: Incomplete
ready: Incomplete
ready: int | None
counter: int
currentlevel: int
destinationnamestotitles: Incomplete
@@ -327,16 +342,19 @@ class PDFOutlines(PDFObject):
def __init__(self) -> None: ...
def addOutlineEntry(self, destinationname, level: int = 0, title=None, closed=None) -> None: ...
def setDestinations(self, destinationtree) -> None: ...
def format(self, document): ...
def format(self, document) -> bytes: ...
def setNames(self, canvas, *nametree) -> None: ...
def setNameList(self, canvas, nametree) -> None: ...
def translateNames(self, canvas, object): ...
first: Incomplete
last: Incomplete
count: int
def prepare(self, document, canvas) -> None: ...
def maketree(self, document, destinationtree, Parent=None, toplevel: int = 0): ...
def maketree(
self, document, destinationtree, Parent=None, toplevel: bool | Literal[0, 1] = 0
) -> tuple[Incomplete, Incomplete]: ...
def count(tree, closedict=None): ...
def count(tree, closedict=None) -> int: ...
class PDFInfo(PDFObject):
producer: Incomplete
@@ -348,64 +366,65 @@ class PDFInfo(PDFObject):
trapped: str
def __init__(self) -> None: ...
def digest(self, md5object) -> None: ...
def format(self, document): ...
def format(self, document) -> bytes: ...
def copy(self): ...
class Annotation(PDFObject):
defaults: Incomplete
required: Incomplete
permitted: Incomplete
def cvtdict(self, d, escape: int = 1): ...
def AnnotationDict(self, **kw): ...
def Dict(self) -> None: ...
def format(self, document): ...
required: tuple[str, ...]
permitted: tuple[str, ...]
def cvtdict(self, d: dict[str, Incomplete], escape: int = 1) -> dict[str, Incomplete]: ...
def AnnotationDict(self, **kw) -> PDFDictionary: ...
@abstractmethod
def Dict(self) -> PDFDictionary: ...
def format(self, document) -> bytes: ...
class FreeTextAnnotation(Annotation):
permitted: Incomplete
permitted: tuple[str, ...]
Rect: Incomplete
Contents: Incomplete
DA: Incomplete
otherkw: Incomplete
otherkw: dict[str, Incomplete]
def __init__(self, Rect, Contents, DA, **kw) -> None: ...
def Dict(self): ...
def Dict(self) -> PDFDictionary: ...
class LinkAnnotation(Annotation):
permitted: Incomplete
permitted: tuple[str, ...]
Border: Incomplete
Rect: Incomplete
Contents: Incomplete
Destination: Incomplete
otherkw: Incomplete
otherkw: dict[str, Incomplete]
def __init__(self, Rect, Contents, Destination, Border: str = "[0 0 1]", **kw) -> None: ...
def dummyDictString(self): ...
def Dict(self): ...
def dummyDictString(self) -> str: ...
def Dict(self) -> PDFDictionary: ...
class HighlightAnnotation(Annotation):
permitted: Incomplete
permitted: tuple[str, ...]
Rect: Incomplete
Contents: Incomplete
otherkw: Incomplete
otherkw: dict[str, Incomplete]
QuadPoints: Incomplete
Color: Incomplete
def __init__(self, Rect, Contents, QuadPoints, Color=[0.83, 0.89, 0.95], **kw) -> None: ...
def cvtdict(self, d, escape: int = 1): ...
def Dict(self): ...
def cvtdict(self, d: dict[str, Incomplete], escape: int = 1) -> dict[str, Incomplete]: ...
def Dict(self) -> PDFDictionary: ...
class TextAnnotation(HighlightAnnotation):
permitted: Incomplete
permitted: tuple[str, ...]
def __init__(self, Rect, Contents, **kw) -> None: ...
def Dict(self): ...
def Dict(self) -> PDFDictionary: ...
def rect_to_quad(Rect): ...
def rect_to_quad(Rect) -> list[Incomplete]: ...
class PDFRectangle(PDFObject):
def __init__(self, llx, lly, urx, ury) -> None: ...
def format(self, document): ...
def format(self, document) -> bytes: ...
class PDFDate(PDFObject):
dateFormatter: Incomplete
def __init__(self, ts=None, dateFormatter=None) -> None: ...
def format(self, doc): ...
def format(self, doc) -> bytes: ...
class Destination(PDFObject):
representation: None
@@ -413,7 +432,7 @@ class Destination(PDFObject):
name: Incomplete
fmt: Incomplete
def __init__(self, name) -> None: ...
def format(self, document): ...
def format(self, document) -> bytes: ...
def xyz(self, left, top, zoom) -> None: ...
def fit(self) -> None: ...
def fitb(self) -> None: ...
@@ -431,13 +450,13 @@ class PDFDestinationXYZ(PDFObject):
zoom: Incomplete
left: Incomplete
def __init__(self, page, left, top, zoom) -> None: ...
def format(self, document): ...
def format(self, document) -> bytes: ...
class PDFDestinationFit(PDFObject):
typename: str
page: Incomplete
def __init__(self, page) -> None: ...
def format(self, document): ...
def format(self, document) -> bytes: ...
class PDFDestinationFitB(PDFDestinationFit):
typename: str
@@ -447,7 +466,7 @@ class PDFDestinationFitH(PDFObject):
page: Incomplete
top: Incomplete
def __init__(self, page, top) -> None: ...
def format(self, document): ...
def format(self, document) -> bytes: ...
class PDFDestinationFitBH(PDFDestinationFitH):
typename: str
@@ -457,7 +476,7 @@ class PDFDestinationFitV(PDFObject):
page: Incomplete
left: Incomplete
def __init__(self, page, left) -> None: ...
def format(self, document): ...
def format(self, document) -> bytes: ...
class PDFDestinationFitBV(PDFDestinationFitV):
typename: str
@@ -470,7 +489,7 @@ class PDFDestinationFitR(PDFObject):
right: Incomplete
top: Incomplete
def __init__(self, page, left, bottom, right, top) -> None: ...
def format(self, document): ...
def format(self, document) -> bytes: ...
class PDFResourceDictionary(PDFObject):
ProcSet: Incomplete
@@ -483,7 +502,7 @@ class PDFResourceDictionary(PDFObject):
def basicFonts(self) -> None: ...
def setColorSpace(self, colorsUsed) -> None: ...
def setShading(self, shadingUsed) -> None: ...
def format(self, document): ...
def format(self, document) -> bytes: ...
class PDFType1Font(PDFObject):
__RefOnly__: int
@@ -491,7 +510,7 @@ class PDFType1Font(PDFObject):
Type: str
Subtype: str
local_attributes: Incomplete
def format(self, document): ...
def format(self, document) -> bytes: ...
class PDFTrueTypeFont(PDFType1Font):
Subtype: str
@@ -504,21 +523,21 @@ class PDFFormXObject(PDFObject):
Contents: Incomplete
stream: Incomplete
Resources: Incomplete
hasImages: int
compression: int
hasImages: bool | Literal[0, 1]
compression: bool | Literal[0, 1]
lowerx: Incomplete
lowery: Incomplete
upperx: Incomplete
uppery: Incomplete
def __init__(self, lowerx, lowery, upperx, uppery) -> None: ...
def setStreamList(self, data) -> None: ...
def BBoxList(self): ...
def format(self, document): ...
def BBoxList(self) -> list[Incomplete]: ...
def format(self, document) -> bytes: ...
class PDFPostScriptXObject(PDFObject):
content: Incomplete
def __init__(self, content=None) -> None: ...
def format(self, document): ...
def format(self, document) -> bytes: ...
class PDFImageXObject(PDFObject):
name: Incomplete
@@ -529,84 +548,86 @@ class PDFImageXObject(PDFObject):
streamContent: str
mask: Incomplete
def __init__(self, name, source=None, mask=None) -> None: ...
def loadImageFromA85(self, source): ...
def loadImageFromJPEG(self, imageFile): ...
def loadImageFromRaw(self, source): ...
def loadImageFromA85(self, source) -> None: ...
def loadImageFromJPEG(self, imageFile) -> bool: ...
def loadImageFromRaw(self, source) -> None: ...
def loadImageFromSRC(self, im) -> None: ...
def format(self, document): ...
def format(self, document) -> bytes: ...
class PDFSeparationCMYKColor:
cmyk: Incomplete
def __init__(self, cmyk) -> None: ...
def value(self): ...
def value(self) -> PDFArrayCompact: ...
class PDFFunction(PDFObject):
defaults: Incomplete
required: Incomplete
permitted: Incomplete
def FunctionDict(self, **kw): ...
def Dict(self, document) -> None: ...
def format(self, document): ...
required: tuple[str, ...]
permitted: tuple[str, ...]
def FunctionDict(self, **kw) -> PDFDictionary: ...
@abstractmethod
def Dict(self, document) -> PDFDictionary: ...
def format(self, document) -> bytes: ...
class PDFExponentialFunction(PDFFunction):
defaults: Incomplete
required: Incomplete
permitted: Incomplete
required: tuple[str, ...]
permitted: tuple[str, ...]
C0: Incomplete
C1: Incomplete
N: Incomplete
otherkw: Incomplete
otherkw: dict[str, Incomplete]
def __init__(self, C0, C1, N, **kw) -> None: ...
def Dict(self, document): ...
def Dict(self, document) -> PDFDictionary: ...
class PDFStitchingFunction(PDFFunction):
required: Incomplete
permitted: Incomplete
required: tuple[str, ...]
permitted: tuple[str, ...]
Functions: Incomplete
Bounds: Incomplete
Encode: Incomplete
otherkw: Incomplete
otherkw: dict[str, Incomplete]
def __init__(self, Functions, Bounds, Encode, **kw) -> None: ...
def Dict(self, document): ...
def Dict(self, document) -> PDFDictionary: ...
class PDFShading(PDFObject):
required: Incomplete
permitted: Incomplete
def ShadingDict(self, **kw): ...
def Dict(self, document) -> None: ...
def format(self, document): ...
required: tuple[str, ...]
permitted: tuple[str, ...]
def ShadingDict(self, **kw) -> PDFDictionary: ...
@abstractmethod
def Dict(self, document) -> PDFDictionary: ...
def format(self, document) -> bytes: ...
class PDFFunctionShading(PDFShading):
required: Incomplete
permitted: Incomplete
required: tuple[str, ...]
permitted: tuple[str, ...]
Function: Incomplete
ColorSpace: Incomplete
otherkw: Incomplete
otherkw: dict[str, Incomplete]
def __init__(self, Function, ColorSpace, **kw) -> None: ...
def Dict(self, document): ...
def Dict(self, document) -> PDFDictionary: ...
class PDFAxialShading(PDFShading):
required: Incomplete
permitted: Incomplete
required: tuple[str, ...]
permitted: tuple[str, ...]
Coords: Incomplete
Function: Incomplete
ColorSpace: Incomplete
otherkw: Incomplete
otherkw: dict[str, Incomplete]
def __init__(self, x0, y0, x1, y1, Function, ColorSpace, **kw) -> None: ...
def Dict(self, document): ...
def Dict(self, document) -> PDFDictionary: ...
class PDFRadialShading(PDFShading):
required: Incomplete
permitted: Incomplete
required: tuple[str, ...]
permitted: tuple[str, ...]
Coords: Incomplete
Function: Incomplete
ColorSpace: Incomplete
otherkw: Incomplete
otherkw: dict[str, Incomplete]
def __init__(self, x0, y0, r0, x1, y1, r1, Function, ColorSpace, **kw) -> None: ...
def Dict(self, document): ...
def Dict(self, document) -> PDFDictionary: ...
class XMP(PDFStream):
def __init__(self, path=None, creator=None) -> None: ...
def makeContent(self, doc): ...
# Param name is changed from the base class:
def format(self, doc): ...
def format(self, doc) -> bytes: ...
+35 -30
View File
@@ -1,39 +1,44 @@
from _typeshed import Incomplete
from typing import Literal
from reportlab.pdfbase.pdfdoc import PDFObject
from reportlab.pdfbase.pdfdoc import PDFDictionary, PDFObject, PDFStream, PDFString
from reportlab.pdfbase.pdfpattern import PDFPattern, PDFPatternIf
def textFieldAbsolute(canvas, title, x, y, width, height, value: str = "", maxlen: int = 1000000, multiline: int = 0): ...
def textFieldRelative(canvas, title, xR, yR, width, height, value: str = "", maxlen: int = 1000000, multiline: int = 0): ...
def buttonFieldAbsolute(canvas, title, value, x, y, width: float = 16.7704, height: float = 14.907): ...
def buttonFieldRelative(canvas, title, value, xR, yR, width: float = 16.7704, height: float = 14.907): ...
def textFieldAbsolute(
canvas, title, x, y, width, height, value: str = "", maxlen: int = 1000000, multiline: bool | Literal[0, 1] = 0
) -> None: ...
def textFieldRelative(
canvas, title, xR, yR, width, height, value: str = "", maxlen: int = 1000000, multiline: bool | Literal[0, 1] = 0
) -> None: ...
def buttonFieldAbsolute(canvas, title, value, x, y, width: float = 16.7704, height: float = 14.907) -> None: ...
def buttonFieldRelative(canvas, title, value, xR, yR, width: float = 16.7704, height: float = 14.907) -> None: ...
def selectFieldAbsolute(canvas, title, value, options, x, y, width, height) -> None: ...
def selectFieldRelative(canvas, title, value, options, xR, yR, width, height): ...
def getForm(canvas): ...
def selectFieldRelative(canvas, title, value, options, xR, yR, width, height) -> None: ...
def getForm(canvas) -> AcroForm: ...
class AcroForm(PDFObject):
fields: Incomplete
fields: list[PDFPattern]
def __init__(self) -> None: ...
def textField(
self, canvas, title, xmin, ymin, xmax, ymax, value: str = "", maxlen: int = 1000000, multiline: int = 0
self, canvas, title, xmin, ymin, xmax, ymax, value: str = "", maxlen: int = 1000000, multiline: bool | Literal[0, 1] = 0
) -> None: ...
def selectField(self, canvas, title, value, options, xmin, ymin, xmax, ymax) -> None: ...
def buttonField(self, canvas, title, value, xmin, ymin, width: float = 16.7704, height: float = 14.907) -> None: ...
def format(self, document): ...
def format(self, document) -> bytes: ...
FormPattern: Incomplete
FormPattern: list[str | list[str] | PDFString | PDFPatternIf]
def FormFontsDictionary(): ...
def FormResources(): ...
def FormFontsDictionary() -> PDFDictionary: ...
def FormResources() -> PDFPattern: ...
ZaDbPattern: Incomplete
FormResourcesDictionaryPattern: Incomplete
FORMFONTNAMES: Incomplete
EncodingPattern: Incomplete
PDFDocEncodingPattern: Incomplete
ZaDbPattern: list[str]
FormResourcesDictionaryPattern: list[str | list[str]]
FORMFONTNAMES: dict[str, str]
EncodingPattern: list[str | list[str]]
PDFDocEncodingPattern: list[str]
def FormFont(BaseFont, Name): ...
def FormFont(BaseFont, Name) -> PDFPattern: ...
FormFontPattern: Incomplete
FormFontPattern: list[str | list[str]]
def resetPdfForm() -> None: ...
def TextField(
@@ -50,10 +55,10 @@ def TextField(
R: int = 0,
G: int = 0,
B: float = 0.627,
multiline: int = 0,
): ...
multiline: bool | Literal[0, 1] = 0,
) -> PDFPattern: ...
TextFieldPattern: Incomplete
TextFieldPattern: list[str | list[str]]
def SelectField(
title,
@@ -69,13 +74,13 @@ def SelectField(
R: int = 0,
G: int = 0,
B: float = 0.627,
): ...
) -> PDFPattern: ...
SelectFieldPattern: Incomplete
SelectFieldPattern: list[str | list[str]]
def ButtonField(title, value, xmin, ymin, page, width: float = 16.7704, height: float = 14.907): ...
def ButtonField(title, value, xmin, ymin, page, width: float = 16.7704, height: float = 14.907) -> PDFPattern: ...
ButtonFieldPattern: Incomplete
ButtonFieldPattern: list[str | list[str] | PDFString]
def buttonStreamDictionary(width: float = 16.7704, height: float = 14.907): ...
def ButtonStream(content, width: float = 16.7704, height: float = 14.907): ...
def buttonStreamDictionary(width: float = 16.7704, height: float = 14.907) -> PDFDictionary: ...
def ButtonStream(content, width: float = 16.7704, height: float = 14.907) -> PDFStream: ...
@@ -1,7 +1,8 @@
from _typeshed import Incomplete, StrOrBytesPath
from typing import Final
from typing import Final, Literal
from reportlab.lib.rl_accel import unicode2T1 as unicode2T1
from reportlab.pdfbase.pdfdoc import PDFDictionary
__version__: Final[str]
standardFonts: Incomplete
@@ -24,25 +25,25 @@ class TypeFace:
requiredEncoding: str
builtIn: int
def __init__(self, name) -> None: ...
def getFontFiles(self): ...
def findT1File(self, ext: str = ".pfb"): ...
def getFontFiles(self) -> list[Incomplete]: ...
def findT1File(self, ext: str = ".pfb") -> str | None: ...
def bruteForceSearchForFile(fn, searchPath=None): ...
def bruteForceSearchForAFM(faceName): ...
def bruteForceSearchForAFM(faceName) -> str | None: ...
class Encoding:
name: Incomplete
frozen: int
frozen: Literal[0, 1]
baseEncodingName: Incomplete
vector: Incomplete
vector: tuple[Incomplete, ...]
def __init__(self, name, base=None) -> None: ...
def __getitem__(self, index): ...
def __setitem__(self, index, value) -> None: ...
def freeze(self) -> None: ...
def isEqual(self, other): ...
def isEqual(self, other) -> bool: ...
def modifyRange(self, base, newNames) -> None: ...
def getDifferences(self, otherEnc): ...
def makePDFObject(self): ...
def getDifferences(self, otherEnc) -> list[Incomplete]: ...
def makePDFObject(self) -> PDFDictionary | str: ...
standardT1SubstitutionFonts: Incomplete
@@ -54,6 +55,7 @@ class Font:
shapable: bool
def __init__(self, name, faceName, encName, substitutionFonts=None) -> None: ...
def stringWidth(self, text: str | bytes, size: float, encoding: str = "utf8") -> float: ...
widths: list[int]
def addObjects(self, doc) -> None: ...
PFB_MARKER: Final[str]
@@ -66,20 +68,20 @@ class EmbeddedType1Face(TypeFace):
pfbFileName: Incomplete
requiredEncoding: Incomplete
def __init__(self, afmFileName, pfbFileName) -> None: ...
def getFontFiles(self): ...
def getFontFiles(self) -> list[Incomplete]: ...
def addObjects(self, doc): ...
def registerTypeFace(face) -> None: ...
def registerEncoding(enc) -> None: ...
def registerFontFamily(family, normal=None, bold=None, italic=None, boldItalic=None) -> None: ...
def registerFont(font) -> None: ...
def getTypeFace(faceName): ...
def getEncoding(encName): ...
def getTypeFace(faceName) -> TypeFace: ...
def getEncoding(encName) -> Encoding: ...
def findFontAndRegister(fontName: str) -> Font: ...
def getFont(fontName: str) -> Font: ...
def getAscentDescent(fontName: str, fontSize: float | None = None): ...
def getAscent(fontName: str, fontSize: float | None = None): ...
def getDescent(fontName: str, fontSize: float | None = None): ...
def getAscentDescent(fontName: str, fontSize: float | None = None) -> tuple[float, float]: ...
def getAscent(fontName: str, fontSize: float | None = None) -> float: ...
def getDescent(fontName: str, fontSize: float | None = None) -> float: ...
def getRegisteredFontNames() -> list[Incomplete]: ...
def stringWidth(text: str | bytes, fontName: str, fontSize: float, encoding: str = "utf8") -> float: ...
def dumpFontData() -> None: ...
@@ -1,18 +1,19 @@
from _typeshed import Incomplete
from collections.abc import Generator
from collections.abc import Iterator
from typing_extensions import Self
from reportlab.pdfbase.pdfdoc import PDFObject
class PDFPattern(PDFObject):
__RefOnly__: int
pattern: Incomplete
arguments: Incomplete
arguments: dict[str, Incomplete]
def __init__(self, pattern_sequence, **keywordargs) -> None: ...
def __setitem__(self, item, value) -> None: ...
def __getitem__(self, item): ...
def eval(self, L) -> Generator[Incomplete, None, None]: ...
def format(self, document): ...
def clone(self): ...
def __setitem__(self, item: str, value) -> None: ...
def __getitem__(self, item: str): ...
def eval(self, L) -> Iterator[bytes]: ...
def format(self, document) -> bytes: ...
def clone(self) -> Self: ...
class PDFPatternIf:
cond: Incomplete
@@ -1,15 +1,16 @@
from typing import Final
from _typeshed import Incomplete
from typing import Final, Literal
__version__: Final[str]
def makeA85Image(filename, IMG=None, detectJpeg: bool = False): ...
def makeRawImage(filename, IMG=None, detectJpeg: bool = False): ...
def cacheImageFile(filename, returnInMemory: int = 0, IMG=None): ...
def makeA85Image(filename, IMG=None, detectJpeg: bool = False) -> list[Incomplete] | None: ...
def makeRawImage(filename, IMG=None, detectJpeg: bool = False) -> list[Incomplete] | None: ...
def cacheImageFile(filename, returnInMemory: bool | Literal[0, 1] = 0, IMG=None): ...
def preProcessImages(spec) -> None: ...
def cachedImageExists(filename): ...
def readJPEGInfo(image): ...
def cachedImageExists(filename) -> Literal[0, 1]: ...
def readJPEGInfo(image) -> tuple[Incomplete, Incomplete, Incomplete, Incomplete] | None: ...
class _fusc:
def __init__(self, k, n) -> None: ...
def encrypt(self, s): ...
def decrypt(self, s): ...
def encrypt(self, s) -> str: ...
def decrypt(self, s) -> str: ...
@@ -1,24 +1,23 @@
from _typeshed import Incomplete
from typing import NamedTuple
__all__ = ["RL_Codecs"]
class StdCodecData(NamedTuple):
exceptions: Incomplete
rexceptions: Incomplete
exceptions: dict[int, int | None] | None
rexceptions: dict[int, int | None] | None
class ExtCodecData(NamedTuple):
baseName: Incomplete
exceptions: Incomplete
rexceptions: Incomplete
baseName: str
exceptions: dict[int, int | None] | None
rexceptions: dict[int, int | None] | None
class RL_Codecs:
def __init__(self) -> None: ...
@staticmethod
def register() -> None: ...
@staticmethod
def add_dynamic_codec(name, exceptions, rexceptions) -> None: ...
def add_dynamic_codec(name: str, exceptions, rexceptions) -> None: ...
@staticmethod
def remove_dynamic_codec(name) -> None: ...
def remove_dynamic_codec(name: str) -> None: ...
@staticmethod
def reset_dynamic_codecs() -> None: ...
+62 -58
View File
@@ -1,5 +1,6 @@
from _typeshed import Incomplete, ReadableBuffer, StrOrBytesPath
from typing import Final, NamedTuple
from collections.abc import Sequence
from typing import Final, Literal, NamedTuple
from typing_extensions import Self
from weakref import WeakKeyDictionary
@@ -30,62 +31,64 @@ GF_UNSCALED_COMPONENT_OFFSET: Final = 4096
def TTFOpenFile(fn: StrOrBytesPath) -> tuple[StrOrBytesPath,]: ...
class TTFontParser:
ttfVersions: Incomplete
ttcVersions: Incomplete
ttfVersions: tuple[int, ...]
ttcVersions: tuple[int, ...]
fileKind: str
validate: Incomplete
validate: bool | Literal[0, 1]
subfontNameX: bytes
def __init__(self, file, validate: int = 0, subfontIndex: int = 0) -> None: ...
ttcVersion: Incomplete
numSubfonts: Incomplete
subfontOffsets: Incomplete
def __init__(self, file, validate: bool | Literal[0, 1] = 0, subfontIndex: int = 0) -> None: ...
ttcVersion: int
numSubfonts: int
subfontOffsets: list[int]
def readTTCHeader(self) -> None: ...
def getSubfont(self, subfontIndex) -> None: ...
numTables: Incomplete
searchRange: Incomplete
entrySelector: Incomplete
rangeShift: Incomplete
table: Incomplete
tables: Incomplete
def getSubfont(self, subfontIndex: int) -> None: ...
numTables: int
searchRange: int
entrySelector: int
rangeShift: int
table: dict[Incomplete, Incomplete]
tables: list[Incomplete]
def readTableDirectory(self) -> None: ...
version: Incomplete
def readHeader(self): ...
version: int
def readHeader(self) -> bool: ...
filename: Incomplete
def readFile(self, f) -> None: ...
def checksumTables(self) -> None: ...
def checksumFile(self) -> None: ...
def get_table_pos(self, tag): ...
def seek(self, pos) -> None: ...
def skip(self, delta) -> None: ...
def seek_table(self, tag, offset_in_table: int = 0): ...
def read_tag(self): ...
def get_chunk(self, pos, length): ...
def read_uint8(self): ...
def read_ushort(self): ...
def read_ulong(self): ...
def read_short(self): ...
def get_ushort(self, pos): ...
def get_ulong(self, pos): ...
def get_table_pos(self, tag) -> tuple[Incomplete, Incomplete]: ...
def seek(self, pos: int) -> None: ...
def skip(self, delta: int) -> None: ...
def seek_table(self, tag, offset_in_table: int = 0) -> int: ...
def read_tag(self) -> str: ...
def get_chunk(self, pos: int, length: int) -> bytes: ...
def read_uint8(self) -> int: ...
def read_ushort(self) -> int: ...
def read_ulong(self) -> int: ...
def read_short(self) -> int: ...
def get_ushort(self, pos: int) -> int: ...
def get_ulong(self, pos: int) -> int: ...
def get_table(self, tag): ...
class TTFontMaker:
tables: Incomplete
tables: dict[Incomplete, Incomplete]
def __init__(self) -> None: ...
def add(self, tag, data) -> None: ...
def makeStream(self): ...
def makeStream(self) -> bytes: ...
class CMapFmt2SubHeader(NamedTuple):
firstCode: Incomplete
entryCount: Incomplete
idDelta: Incomplete
idRangeOffset: Incomplete
firstCode: int
entryCount: int
idDelta: int
idRangeOffset: int
class TTFNameBytes(bytes):
ustr: Incomplete
def __new__(cls, b, enc: str = "utf8"): ...
def __new__(cls, b, enc: str = "utf8") -> Self: ...
class TTFontFile(TTFontParser):
def __init__(self, file, charInfo: int = 1, validate: int = 0, subfontIndex: int = 0) -> None: ...
def __init__(
self, file, charInfo: bool | Literal[0, 1] = 1, validate: bool | Literal[0, 1] = 0, subfontIndex: int | str | bytes = 0
) -> None: ...
name: Incomplete
familyName: Incomplete
styleName: Incomplete
@@ -108,21 +111,21 @@ class TTFontFile(TTFontParser):
charWidths: Incomplete
hmetrics: Incomplete
glyphPos: Incomplete
def extractInfo(self, charInfo: int = 1): ...
def makeSubset(self, subset): ...
def extractInfo(self, charInfo: bool | Literal[0, 1] = 1) -> None: ...
def makeSubset(self, subset: Sequence[Incomplete]) -> bytes: ...
FF_FIXED: Incomplete
FF_SERIF: Incomplete
FF_SYMBOLIC: Incomplete
FF_SCRIPT: Incomplete
FF_NONSYMBOLIC: Incomplete
FF_ITALIC: Incomplete
FF_ALLCAP: Incomplete
FF_SMALLCAP: Incomplete
FF_FORCEBOLD: Incomplete
FF_FIXED: Final = 1
FF_SERIF: Final = 2
FF_SYMBOLIC: Final = 4
FF_SCRIPT: Final = 8
FF_NONSYMBOLIC: Final = 32
FF_ITALIC: Final = 64
FF_ALLCAP: Final = 65536
FF_SMALLCAP: Final = 131072
FF_FORCEBOLD: Final = 262144
class TTFontFace(TTFontFile, pdfmetrics.TypeFace):
def __init__(self, filename, validate: int = 0, subfontIndex: int = 0) -> None: ...
def __init__(self, filename, validate: bool | Literal[0, 1] = 0, subfontIndex: int | str | bytes = 0) -> None: ...
def getCharWidth(self, code): ...
def addSubsetObjects(self, doc, fontname, subset): ...
@@ -135,9 +138,9 @@ class TTFont:
namePrefix: str
nextCode: int
internalName: Incomplete
frozen: int
frozen: bool | Literal[0, 1]
subsets: Incomplete
def __init__(self, asciiReadable=None, ttf=None) -> None: ...
def __init__(self, asciiReadable: bool | Literal[0, 1] | None = None, ttf=None) -> None: ...
fontName: str
face: TTFontFace
@@ -147,14 +150,14 @@ class TTFont:
self,
name: str,
filename,
validate: int = 0,
subfontIndex: int = 0,
asciiReadable: int | None = None,
validate: bool | Literal[0, 1] = 0,
subfontIndex: int | str | bytes = 0,
asciiReadable: bool | Literal[0, 1] | None = None,
shapable: bool = True,
) -> None: ...
def stringWidth(self, text, size, encoding: str = "utf8"): ...
def splitString(self, text, doc, encoding: str = "utf-8"): ...
def getSubsetInternalName(self, subset, doc): ...
def stringWidth(self, text, size, encoding: str = "utf8") -> float: ...
def splitString(self, text, doc, encoding: str = "utf-8") -> list[tuple[int, bytes]]: ...
def getSubsetInternalName(self, subset, doc) -> str: ...
def addObjects(self, doc) -> None: ...
@property
def hbFace(self) -> Incomplete | None: ...
@@ -178,7 +181,8 @@ class ShapeData(NamedTuple):
class ShapedStr(str):
def __new__(cls, s, shapeData: ShapeData | None = None) -> Self: ...
def __radd__(self, other) -> Self: ...
def __add__(self, other) -> ShapedStr: ...
def __radd__(self, other) -> ShapedStr: ...
def shapeStr(s: str, fontName: str, fontSize: float, force: bool = False): ...
def freshTTFont(ttfn, ttfpath, **kwds) -> TTFont: ...