Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
nico-benz-lci opened this issue Sep 30, 2022 · 1 comment

Comments

@nico-benz-lci
Copy link

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?

@timobrembeck
Copy link

This repository is only a mirror and not maintained by the reportlab team.
Please describe your issue here if your problem still persists:
https://groups.google.com/g/reportlab-users

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants