Skip to content

Repository files navigation

TileWright

Slice a large-format PDF sewing pattern into print-at-home pages — without destroying the size layers.

License: MIT Tests No dependencies Offline JavaScript

English · Deutsch


Every generic poster tiler quietly ruins a sewing pattern. They tile the page fine — and drop the layers, so your customer can no longer switch off every size but their own. The file looks correct and is useless for the one thing it was made for.

TileWright is a tiler that understands that.

▶ Use it now — ax1zz.github.io/tilewright (no sign-up, no upload, works offline)

TileWright tiling a graded bodice pattern: the sheet grid laid over the real page, four size layers detected, four blank sheets automatically skipped

Live preview with the sheet grid over the actual pattern. Here it found four size layers, and worked out that four of the six sheets are empty paper — so the job is two sheets, not six.

A tiled output sheet: label A1, page counter, the four graded size lines, dashed trim line and a "joins A2" hint on the shared edge

An output sheet. Grid label, page counter, the graded sizes still on their own layers, dashed red trim line and a "joins A2" hint on the shared edge. Pages 1 and 2 of the output are the scale-check page and the assembly map.

Why this exists

This is not a hypothetical itch. Pattern designers say it out loud:

"Inkscape is a great program for creating sewing patterns but it has one major limitation; You can only export a single page as a PDF." — Titchy Threads

"There are many ways to create a tiled PDF pattern. Here's how I do it in Inkscape... work-arounds for some of the bugs I've run into." — Grow Your Own Clothes

"Wie teile ich ein fertiges Schnittmuster in A4-Seiten auf, damit meine Kunden es zuhause bequem auf A4 ausdrucken können?" (How do I split a finished pattern into A4 pages so my customers can print it at home?) — Kreativlabor Berlin, whose answer is a manual Illustrator artboard workflow, and who sells a book about it.

And layers are not a nicety — the community's own designer guidelines require them:

"Size layers are required. Being able to turn off sizes to just project the size(s) we need is key... but all layers in 'top level', no nesting of layers, because not all pdf readers can access nested layers." — Projector file recommendations for designers

TileWright flattens layer order to top level for exactly this reason.

The bug everything else has

Tiling a PDF means embedding the page as a Form XObject. When you do that:

survives?
/OC marked content in the content stream ✅ yes
the OCG dictionaries themselves ✅ yes
/OCProperties in the document catalog ❌ dropped

Without that last entry, every PDF reader stops showing the layers panel. The sizes are still in the file; nobody can reach them.

TileWright reads the optional-content configuration off your source, then rebuilds it on the output — remapping the copied OCG references, preserving their order and their default on/off state, and flattening nested groups to top level.

This is asserted, not assumed. test/layers.test.js contains a regression test that reproduces the naive failure and proves the fix.

What you get

Drop in a PDF. Get back:

  • Your pattern as vectors — never rasterised. These files get cut against; line fidelity is dimensional accuracy.
  • Working layers, in the original order, with the original visibility.
  • A print-scale check page — a 10 cm square and a 4 in bar, both exact. If they measure wrong, the printer is scaling and the pattern will not fit together.
  • An assembly map so the sewist knows the layout before they start taping.
  • Per-sheet furniture — grid label (A1, B2…), page counter, dashed trim lines, shaded overlap band, edge match triangles, and "joins B2" hints on every shared edge.
  • Blank sheets skipped (in the browser app), because pattern pieces are irregular and the corners are usually empty paper.

Install

There is nothing to install. Pick whichever suits you.

1. Single file, offline, forever

Download dist/tilewright.html and open it. That's the whole program — 2.3 MB, no server, no npm, no CDN, no build step. It will still work in five years on a laptop with the wi-fi off.

2. From source

git clone https://github.com/Ax1zz/tilewright.git
cd tilewright
open index.html          # or: python3 -m http.server 8000

3. Command line

node cli.js pattern-a0.pdf                       # -> pattern-a0.tiled.pdf
node cli.js pattern-a0.pdf -p Letter -v 0.5 -u in
node cli.js pattern-a0.pdf --info                # inspect without tiling
for f in patterns/*.pdf; do node cli.js "$f" -p A4 -q; done
  Options
    -o, --out <file>       output path        (default: <input>.tiled.pdf)
    -p, --paper <size>     A0..A5, Letter, Legal, Tabloid, or WxH  (default: A4)
        --landscape        rotate the output paper
    -v, --overlap <n>      glue margin        (default: 15)
    -m, --margin <n>       printer margin     (default: 0)
    -u, --unit <u>         mm | cm | in | pt  (default: mm)
    -s, --scale <n>        scale the pattern  (default: 1)
        --page <n>         source page, 1-based
        --no-calibration   omit the print-scale check page
        --no-map           omit the assembly map
        --no-marks         omit trim lines, shading and match marks
    -i, --info             report the file and exit

4. As a library

const tiler = require('./src/tiler.js');

const result = await tiler.tile(pdfBytes, {
  paper: 'A4', overlap: 15, unit: 'mm', scale: 1,
});

console.log(result.emitted, 'sheets');
console.log(result.layers.names);   // ['Size 34', 'Size 36', ...]
fs.writeFileSync('out.pdf', result.bytes);

Privacy

Your unreleased patterns are your livelihood. TileWright never uploads them. There is no server, no telemetry, no analytics, and no network call of any kind — the single-file build has zero external references, and the build script fails if any sneak in.

How it compares

layers survive exports a shareable file vector sewing furniture price platform
TileWright yes yes yes yes free any browser + CLI
Acrobat "Poster" print no no — prints only yes no $15/mo Win/Mac
Docuslice no yes yes (since 6/2026) no $9.99 web/desktop
PosteRazor no yes no — raster only no free Win/Mac/Linux
PDFStitcher n/a yes yes n/a free desktop
Titchy Threads Inkscape Generator partial yes yes some paid Windows only
Seamly2D / Valentina layout n/a yes yes some free only from inside its own app

PDFStitcher is listed because it is excellent and frequently recommended — but it performs the reverse operation, assembling tiles back into one A0 sheet. The two tools are complements, not competitors.

Known limitations

Stated plainly, because a tool that lies about its edges is worse than one with edges:

  • Blank-sheet skipping is browser-only. It works by sampling the rendered page, which needs a canvas. The CLI emits every sheet in the grid. On a pattern with a lot of empty corner, the CLI will produce pages you can throw away — check the assembly map.
  • PDF input only. No SVG importer yet. Every design tool worth using exports PDF, so this buys a lot of robustness for a small cost.
  • Page 1 by default in the browser. Multi-page sources are detected and flagged; use the CLI's --page N to pick another.
  • /Producer says pdf-lib. The vendored library rewrites that field on every save with no way to opt out. TileWright identifies itself in /Creator instead.
  • Encrypted PDFs are opened with ignoreEncryption. If a file is genuinely password-protected, remove the password first.

Roadmap

  • Content-bounding-box detection in Node so the CLI can skip blank sheets too
  • A dedicated projector / Beamerdatei mode (thicker lines, calibration grid)
  • SVG input
  • A0 copyshop output with automatic piece nesting
  • Publish to npm as tilewright

Development

node test/run.js                     # 57 tests, no dependencies
node examples/make-sample-pattern.js # regenerate the layered fixture
node build.js                        # rebuild dist/tilewright.html

The core (units, grid, tiler, layers) is environment-agnostic ES5 and runs identically in Node and the browser. pdf-lib and pdf.js are vendored rather than installed, so the repository is self-contained.

See SPEC.md for the design rationale and CONTRIBUTING.md to help.

License

MIT — see LICENSE.

Vendored: pdf-lib (MIT) and pdf.js (Apache-2.0), in vendor/.

About

Slice a large-format PDF sewing pattern into print-at-home pages without destroying the size layers. Browser + CLI, zero install, fully offline.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages