def __init__(self): super(Canvas, self).__init__() # initialize operators self.canvas_operators = [ # color SetCMYKNonStroking(), SetCMYKStroking(), SetColorNonStroking(self), SetColorStroking(self), SetGrayNonStroking(), SetGrayStroking(), SetRGBNonStroking(), SetRGBStroking(), # compatibility BeginCompatibilitySection(), EndCompatibilitySection(), # marked content BeginMarkedContent(), BeginMarkedContentWithPropertyList(), EndMarkedContent(), # state ModifyTransformationMatrix(), PopGraphicsState(), PushGraphicsState(), SetLineWidth(), # text BeginTextObject(), EndTextObject(), MoveTextPosition(), MoveTextPositionSetLeading(), MoveToNextLineShowText(), MoveToNextLine(), SetCharacterSpacing(), SetFontAndSize(), SetHorizontalScaling(), SetSpacingMoveToNextLineShowText(), SetTextLeading(), SetTextMatrix(), SetTextRenderingMode(), SetTextRise(), SetWordSpacing(), ShowText(), ShowTextWithGlyphPositioning(), # xobject Do(), ] # compatibility mode self.in_compatibility_section = False # set initial graphics state self.graphics_state = CanvasGraphicsState() # canvas tag hierarchy is (oddly enough) not considered to be part of the graphics state self.marked_content_stack = [] # set graphics state stack self.graphics_state_stack = []
def invoke(self, canvas: "Canvas", operands: List[AnyPDFType] = []): SetWordSpacing().invoke(canvas, [operands[0]]) SetCharacterSpacing().invoke(canvas, [operands[1]]) MoveToNextLineShowText().invoke(canvas, [operands[2]])