Skip to content

Page.insert_box:If the text has too many characters, it will not be displayed completely. #3107

@LittleMoDel

Description

@LittleMoDel

Description of the bug

t1 = "text with rotate = 0.can't see me",Can't display...

import fitz

doc = fitz.open()  # new or existing PDF
page = doc.new_page()  # new page, or choose doc[n]

# write in this overall area
rect = fitz.Rect(100, 100, 300, 150)

# partition the area in 4 equal sub-rectangles
CELLS = fitz.make_table(rect, cols=4, rows=1)

t1 = "text with rotate = 0.can't see me"  # these texts we will written
t2 = "text with rotate = 90."
t3 = "text with rotate = 180."
t4 = "text with rotate = 270."
text = [t1, t2, t3, t4]
red = fitz.pdfcolor["red"]  # some colors
gold = fitz.pdfcolor["gold"]
blue = fitz.pdfcolor["blue"]

shape = page.new_shape()  # create Shape
for i in range(len(CELLS[0])):
    shape.draw_rect(CELLS[0][i])  # draw rectangle
    shape.insert_textbox(
        CELLS[0][i], text[i], fontname="hebo", color=blue, rotate=90 * i
    )

shape.finish(width=0.3, color=red, fill=gold)
shape.commit()  # write all stuff to the page
doc.save("D:/tst/xxx.pdf")

How to reproduce the bug

image

PyMuPDF version

1.23.19

Operating system

Windows

Python version

3.11

Metadata

Metadata

Assignees

No one assigned

    Labels

    not a bugnot a bug / user error / unable to reproduce

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions