I hadn't thought about this solution!
Thanks, @frederik!
newPage("A4Landscape")
box_w, box_h = width()-100, height()-100
box_x, box_y = 50, 50
txt = FormattedString()
txt.fontSize(90)
txt.align("center")
txt.append("LOOOOOOOOOOOOOOONG STRING\n"*30)
txt_w = textSize(txt)[0]
txt_h = textSize(txt)[1]
width_ratio = box_w/txt_w
height_ratio = box_h/txt_h
sf = min(width_ratio , height_ratio, 1)
scale(sf)
textBox(txt, (box_x/sf, box_y/sf, box_w/sf, box_h/sf))