Skip to content

Scaling/size issues of radio buttons with shapes "circle" and "square" #23

@nico-benz-lci

Description

@nico-benz-lci

When using canvas.acroForm I get some problems with the shape "circle" compared to shape "square". The circle shape seems to scale differently with different sizes than square shape. Circle also behaves weirdly with all button styles except "circle". See the MWE or attached file:

from reportlab.pdfgen import canvas
from reportlab.lib.pagesizes import letter

c = canvas.Canvas("radios.pdf", pagesize=letter)

sizes = [40, 20, 10]

style = "cross"

c.drawString(30, 650, "Too big at size=40:")
c.acroForm.radio(name="radio1", value="v1", x=30, y=600, size=sizes[0], shape="circle", buttonStyle=style)
c.acroForm.radio(name="radio1", value="v2", x=80, y=600, size=sizes[0], shape="square", buttonStyle=style)

c.drawString(30, 550, "Even at size=20:")
c.acroForm.radio(name="radio2", value="v1", x=30, y=500, size=sizes[1], shape="circle", buttonStyle=style)
c.acroForm.radio(name="radio2", value="v2", x=80, y=500, size=sizes[1], shape="square", buttonStyle=style)

c.drawString(30, 450, "Too small at size=10:")
c.acroForm.radio(name="radio3", value="v1", x=30, y=400, size=sizes[2], shape="circle", buttonStyle=style)
c.acroForm.radio(name="radio3", value="v2", x=80, y=400, size=sizes[2], shape="square", buttonStyle=style)

c.save()

radios.pdf

At size 40, "circle" seems to scale to double the correct size and at size 10 only to half of the correct size. 20 seems to be the sweet spot where everything is working properly. This is (incidentally?) also the base value for size of radio buttons.

Am I missing something here or is this a bug in scaling? If so, how can I fix this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions