Who the document is between / Window envelope address
Positioning an address so it shows through an envelope window
An addressee block placed at an exact position on the page so it lines up with the cut-out in a standard window envelope when the sheet is folded.
Why this block is harder than it looks
This is the only block in any document whose position is dictated by a physical object rather than by the design. The window is at a fixed offset from the edge of the envelope, the sheet is folded at fixed points, and therefore the address has to sit inside a rectangle measured from the corner of the paper in millimetres. Nothing about it is relative: not to the margin, not to the header, not to what came before it. And the tolerance is real, because the sheet moves inside the envelope, so the block has to sit comfortably inside the window rather than exactly filling it.
The decisions that make it work
Reasons rather than a description of the code. Each of these is a choice that has a wrong answer, and the wrong answer is usually the default.
- Position it absolutely from the top-left corner of the page in millimetres, and take the offsets from the envelope maker's specification for the envelope you are actually buying.
- Leave a margin of at least 3mm inside the window on every side, because the folded sheet slides. A block that exactly fills the window shows a clipped letter as soon as it shifts.
- Cap the block height and the number of lines. Five lines is the practical limit for most windows, so long addresses have to be condensed rather than allowed to grow.
- Keep everything else out of the window rectangle, including any background tint or rule, or it shows through and the address competes with it.
- Set the type large enough to read through a window at arm's length: 10pt or more, with generous line height, and no light grey.
- Verify against the real envelope and the real printer, folded, once. Everything else about this block is arithmetic, and the arithmetic is only as good as the specification you took it from.
The fragment
Markup and the CSS it needs, and nothing else. It expects a document that already has a page rule and a base stylesheet, so paste it into one rather than opening it on its own.
<address class="window-addr">
<span class="line">Wynne and Hall Ltd</span>
<span class="line">Unit 4, Callow Works</span>
<span class="line">Bridge Street</span>
<span class="line">Sheffield S3 8NP</span>
</address>
<style>
@page { size: A4; margin: 20mm; }
.window-addr {
position: absolute;
/* measured from the corner of the sheet, not from the margin box */
left: 20mm;
top: 45mm;
width: 85mm;
height: 25mm; /* the window is 90 x 30, leaving room to shift */
overflow: hidden;
font-style: normal;
font-size: 10.5pt;
line-height: 1.4;
}
.window-addr .line { display: block; }
</style>What breaks when it is built the obvious way
Measuring from the margin box instead of from the paper. The margin is a design decision and somebody will change it, at which point every letter in the run misses the window, and the failure is only visible after the envelopes are stuffed.
How to prove it survived pagination
Print one, fold it the way the machine or the person will fold it, and put it in the actual envelope. There is no substitute and it takes a minute. Then shift the sheet as far as it can move inside the envelope and confirm the whole address is still visible at both extremes.
Where it sits in a finished document
This page is one block. The document it belongs to has a page rule, a base stylesheet, a header and everything else around it, and repeating all of that here would make thirty pages that say the same thing. The business letter template is a complete file with this block already in it, so take that and change the fragment rather than assembling one from parts. The property doing most of the work here is covered on its own page, with the support caveats that belong there rather than here.
Frequently asked
Will this fragment work on its own?
Not as a whole document. It has no page rule, no margins and no base type, because those belong to the document rather than to the block, and duplicating them in every fragment would mean thirty copies to keep in step. Paste it into a template that already has them.
Why does it look right in a browser and wrong in the PDF?
Because a browser window is one continuous surface and a document is a stack of fixed rectangles. Nothing in a scrolling view exercises a page boundary, so every break rule in the fragment is inert until the content is paginated. Render the real thing with enough content to cross two or three boundaries, then look.
Do I need a special option on the render request for this?
No. Everything on this page is CSS and markup, which is your side of the boundary. What the render has to give you is a real page size with real margins, and after that the layout is decided by the stylesheet.
Other parts of a document
The blocks that sit next to this one, and one from the next group along so you are not sealed inside a single kind of problem.
A contact block where the long email address does not break the layout
Phone, email, reference number and website, usually set small under a name or in a footer, and usually the block that overflows first.
A delivery details block with dates, carrier and terms
Dispatch date, expected arrival, carrier, consignment reference and delivery terms, gathered into one block near the top of a despatch document.
A block of reference numbers that survives being quoted back
Purchase order number, contract reference, project code, job number and whatever else both parties use to match this document to their own records.
Payment terms and due date that cannot be missed or misread
The line that says when the money is due and what happens if it is not, which is short, easy to write and easy to place somewhere nobody reads.
Business letter, as a complete file
The whole document with this block already in place, ready to copy and change.
margin (in @page) in paged output
The property carrying the weight here, with its real support status.
Every part of a document
The full list, grouped by the kind of problem the block poses.
Paste the fragment into the playground inside a page rule and see what it does at a real page size. That is the only way any of this gets confirmed.