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
  • 1 reply
  • 45 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 .

 

    1 reply

    m1b
    Community Expert
    Community Expert
    April 21, 2026

    The algorithm could be like this:

    1. Calculate the ratio of frame heights. First frame is 1 (no measurement needed), all subsequent frames ratio = 1 divided by its height. Call this variable S1, S2 etc.
    2. Work out the currentTotalWidth. W1*S1 + W2*S2 + W3*S3 … + GAP * frame count -1.
    3. Work out the total scale factor required so that the currentTotalWidth == desiredWidth, which is the page width minus left and right margins. Formula is: 
      SCALE = desiredWidth divided by currentTotalWidth.
    4. Scale each frame like this:
      scale frame 1 by S1*SCALE,
      frame 2 by S2*SCALE,
      frame 3 by S3*SCALE, etc.
    5. Then position them, starting on the left margin position, and frame 2 would be at W1+GAP, and frame 3 would be at W2+GAP, etc. Position vertical so all frames top matches frame 1.
    dublove
    dubloveAuthor
    Legend
    April 21, 2026

    Hi ​@m1b 

    I’ll look into it when I have a chance. Right now, I’m just specifying a height (like 60 mm), then dragging the cells after tiling them and using the alignment and distribution features to adjust them.

    Regarding that post about aligning the bottom of a table continuation, could you take another look? I’ve provided a new example.
    Thanks.