Skip to main content
dublove
Legend
April 16, 2026
Question

How to tile multiple objects at equal intervals but with varying widths to fit the page layout?

  • April 16, 2026
  • 0 replies
  • 12 views

The graphics are of different sizes, but I want to fill the page with 3mm spacing between them. They only need to be the same height, not the same width.
No code needed—just give me a suggested algorithm.
For example, if the page width is 170;

// Spacing
var csp=3;
// Number of columns
var cn=2
w1+w2+w3+3*2=170
h1=h2=h3;

But since both the height and width are unknown, does this mean I have to keep trying different values?

If that really doesn't work, I think allowing the last shape to be cropped might be easier to implement.

Do I need to loop multiple times to scale?
This feels really slow.

Thank you .