Dev.to WebDev 🛠 Dev 👁 0 📖 5 min read

Computing US Architectural Print Scales, Sheet-Fit Matrices, and Ruler Conversions in Pure TypeScript

A floor plan exported to PDF looks clean on a laptop screen until someone sends it to a FedEx plotter or home laser printer and puts a triangular architectural scale ruler against the paper. If the drawing was exported w

A floor plan exported to PDF looks clean on a laptop screen until someone sends it to a FedEx plotter or home laser printer and puts a triangular architectural scale ruler against the paper. If the drawing was exported without subtracting border margins and the title block height — or if the printer driver silently applied "Fit to Page" (94% scaling) — every 1/4" = 1'-0" wall on the page reads 7" short in the field.

When we built the interactive Floor Plan Print Scale Calculator inside PlanCaliber, a browser-based 2D/3D floor plan and vector CAD studio, we implemented a deterministic TypeScript module (src/lib/cad/scaleCalc.ts) that solves sheet-fit matrices across US Letter, Tabloid (11" x 17"), ARCH C (18" x 24"), and ARCH D (24" x 36"), auto-picks the largest standard architectural scale that fits cleanly, and converts real-world feet-and-inches to ruler fractions (nearest 1/16"). Here is the exact math.

1. Modeling Real Printable Sheet Envelopes (Not Raw Paper Dimensions)

The most common print-scale bug is dividing a building footprint by the sheet's outer paper dimensions (17" x 11" for Tabloid or 36" x 24" for ARCH D). Real CAD sheets always reserve outer plotting margins (typically 0.5" on all four edges) plus a horizontal title block strip along the bottom:

export const PAPER_SIZES: readonly PaperSheetSpec[] = [
  { id: 'letter',  name: 'US Letter (8.5" x 11")',        shortName: 'US Letter',    widthIn: 11, heightIn: 8.5, marginIn: 0.5, titleBlockIn: 0.75 },
  { id: 'tabloid', name: 'Tabloid / ANSI B (11" x 17")',  shortName: 'Tabloid 11x17', widthIn: 17, heightIn: 11,  marginIn: 0.5, titleBlockIn: 0.9  },
  { id: 'arch_c',  name: 'ARCH C (18" x 24")',            shortName: 'ARCH C 18x24',  widthIn: 24, heightIn: 18,  marginIn: 0.5, titleBlockIn: 1.25 },
  { id: 'arch_d',  name: 'ARCH D (24" x 36")',            shortName: 'ARCH D 24x36',  widthIn: 36, heightIn: 24,  marginIn: 0.5, titleBlockIn: 1.5  }
] as const;

export const ARCH_SCALES: readonly ArchScaleSpec[] = [
  { id: '1/8',  label: '1/8" = 1\'-0"',  inchesPerFoot: 0.125,  ratio: '1:96' },
  { id: '3/16', label: '3/16" = 1\'-0"', inchesPerFoot: 0.1875, ratio: '1:64' },
  { id: '1/4',  label: '1/4" = 1\'-0"',  inchesPerFoot: 0.25,   ratio: '1:48' },
  { id: '3/8',  label: '3/8" = 1\'-0"',  inchesPerFoot: 0.375,  ratio: '1:32' },
  { id: '1/2',  label: '1/2" = 1\'-0"',  inchesPerFoot: 0.5,    ratio: '1:24' }
] as const;

Subtracting marginIn * 2 horizontally and marginIn * 2 + titleBlockIn vertically yields the true net printable viewport for each sheet:

Sheet Outer Landscape Size Net Printable Viewport Max Footprint at 1/4" = 1'-0" Max Footprint at 1/8" = 1'-0"
US Letter 11.0" x 8.5" 10.0" x 6.75" 40' x 27' 80' x 54'
Tabloid (11x17) 17.0" x 11.0" 16.0" x 9.10" 64' x 36.4' 128' x 72.8'
ARCH C (18x24) 24.0" x 18.0" 23.0" x 15.75" 92' x 63' 184' x 126'
ARCH D (24x36) 36.0" x 24.0" 35.0" x 21.50" 140' x 86' 280' x 172'

That explains why a standard 48' x 32' single-story home (1,536 sq ft) prints cleanly at 1/4" = 1'-0" on Tabloid 11x17 (12.0" x 8.0" drawn inside 16.0" x 9.10" — 75% width and 88% height utilization), whereas the exact same drawing overflows US Letter by 2.0" in width and 1.25" in depth.

2. Finding the Largest Standard Scale That Fits Without Clipping

Because ARCH_SCALES is sorted strictly ascending by inchesPerFoot (0.125 up to 0.5), finding the largest legible architectural scale that fits inside a sheet's printable envelope is a single deterministic scan with a 1e-6 floating-point guard:

export function findLargestFittingScale(
  widthFt: number,
  depthFt: number,
  sheet: PaperSheetSpec
): ArchScaleSpec | null {
  const printableW = sheet.widthIn - sheet.marginIn * 2;
  const printableH = sheet.heightIn - sheet.marginIn * 2 - sheet.titleBlockIn;
  let best: ArchScaleSpec | null = null;
  for (const scale of ARCH_SCALES) {
    const drawnW = widthFt * scale.inchesPerFoot;
    const drawnH = depthFt * scale.inchesPerFoot;
    if (drawnW <= printableW + 1e-6 && drawnH <= printableH + 1e-6) {
      best = scale;
    }
  }
  return best;
}

For our 48' x 32' house on US Letter (10.0" x 6.75" net viewport), findLargestFittingScale rejects 1/4" = 1'-0" (12.0" x 8.0") and immediately recommends 3/16" = 1'-0" (9.0" x 6.0" drawn — fits with 1.0" horizontal and 0.75" vertical breathing room for exterior dimension strings).

3. Formatting Paper Measurements to Nearest 1/16" and Real Measurements to 1/4"

Contractors reading a print with a standard US tape measure or ruler do not want 3.666667" — they want 3 11/16". Using Euclid's greatest common divisor (gcd) reduces every sixteenth cleanly:

function gcd(a: number, b: number): number {
  let x = Math.abs(a);
  let y = Math.abs(b);
  while (y !== 0) {
    const t = y;
    y = x % y;
    x = t;
  }
  return x || 1;
}

export function formatNearestSixteenth(inches: number): string {
  const safe = Math.max(0, Number.isFinite(inches) ? inches : 0);
  const totalSixteenths = Math.round(safe * 16);
  const whole = Math.floor(totalSixteenths / 16);
  const rem = totalSixteenths % 16;
  if (rem === 0) return `${whole}"`;
  const d = gcd(rem, 16);
  const num = rem / d;
  const den = 16 / d;
  return whole > 0 ? `${whole} ${num}/${den}"` : `${num}/${den}"`;
}

And the bidirectional conversions (realToPaper and paperToReal) stay exact across all five architectural scales:

export function realToPaper(feet: number, inches: number, scaleId: ArchScaleId): RealToPaperResult {
  const scale = getArchScale(scaleId);
  const totalFeet = clampDimension(feet, 0, 2000) + clampDimension(inches, 0, 11.99) / 12;
  const paperInches = totalFeet * scale.inchesPerFoot;
  return {
    totalFeet,
    paperInches,
    paperFraction: formatNearestSixteenth(paperInches),
    paperMm: paperInches * 25.4
  };
}

export function paperToReal(paperInches: number, scaleId: ArchScaleId): PaperToRealResult {
  const scale = getArchScale(scaleId);
  const safePaperIn = clampDimension(paperInches, 0, 200);
  const totalFeet = safePaperIn / scale.inchesPerFoot;
  const totalInches = totalFeet * 12;
  return {
    paperInches: safePaperIn,
    totalFeet,
    totalInches,
    formattedFtIn: formatRealFeetInches(totalInches)
  };
}

Worked examples:

  • Real -> Paper: A 14'-8" (14.6667 ft) living-room wall at 1/4" = 1'-0" measures 3.6667" -> 3 11/16" (93.1 mm) on paper.
  • Paper -> Real: Measuring 3.625" (3 5/8") on a 1/4" = 1'-0" drawing yields 14.5 ft -> 14'-6". Measuring 2.75" (2 3/4") on a 3/16" = 1'-0" drawing yields 14.6667 ft -> 14'-8".

4. Embedding Exact PDF Page Points (72 pt = 1 inch) & Avoiding "Fit to Page"

In PDF coordinate space (pdf-lib), 1 inch equals exactly 72 PostScript points:

  • Tabloid (17" x 11" landscape) = 1224 pt x 792 pt
  • ARCH C (24" x 18" landscape) = 1728 pt x 1296 pt
  • ARCH D (36" x 24" landscape) = 2592 pt x 1728 pt

At 1/4" = 1'-0", every real-world foot maps to 0.25 * 72 = 18.0 PDF points (1.5 pt per real inch). Always print vector PDFs at 100% / Actual Size (never "Fit to Printable Area"), and include a graphic scale bar right inside the title block so anyone on site can verify physical print accuracy with a pocket tape measure in two seconds.

Try the Scale Calculator & Vector Blueprint Export Studio

Test your building's exact footprint across US Letter, Tabloid 11x17, ARCH C, and ARCH D, or export true-scale vector sheets directly from your browser:

Drafting in 2D/3D and running all architectural scale, stair, egress, garage, and kitchen/bath clearance checks are free in your browser with no account required. Clean unwatermarked vector PDFs (A-101 + M-101), 2400px PNG, and SVG start at $9 one-time ($19 once for the full 5-sheet PDF set, layered AutoCAD R12 .DXF, 3D .OBJ, and .CSV takeoff) with a 14-day instant refund policy. (PlanCaliber generates preliminary space-planning drawings — always verify physical scale bars on printed sheets and field-verify all dimensions on site before construction.)

📰 Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.