Back to Knowledege base

Setting Up and Using Alignment Pages

Ensuring correct positioning for pre-printed stationery and labels

Understanding Alignment Pages

Alignment pages help ensure:

  • Pre-printed forms align correctly
  • Labels print in correct positions
  • Continuous feed paper positioned properly

Before printing production jobs on special media, Xi-Text can print test patterns allowing operators to verify alignment.

When to Use Alignment

Use alignment for:

  • Pre-printed invoice forms
  • Address labels (especially continuous feed)
  • Letterhead with specific print zones
  • Multi-part forms
  • Any media requiring precise positioning

Skip alignment for:

  • Plain paper
  • Simple text documents
  • PostScript/PDF that handles positioning

Configuring Alignment

Alignment configured in printer setup files using align keyword:

bash

# In /usr/spool/printers/ptr1/invoice

# Specify alignment file
align=.invoice-align

Alignment file location:

Relative paths taken from printer directory:

/usr/spool/printers/ptr1/.invoice-align

Absolute paths also supported:

bash

align=/usr/local/xitext/alignments/invoice.align

Creating Alignment Files

Alignment file contains test pattern to print:

Simple Box Pattern

bash

# /usr/spool/printers/ptr1/.invoice-align

# Create test boxes showing print area
+--------+--------+--------+--------+
|        |        |        |        |
|   1    |   2    |   3    |   4    |
|        |        |        |        |
+--------+--------+--------+--------+
|        |        |        |        |
|   5    |   6    |   7    |   8    |
|        |        |        |        |
+--------+--------+--------+--------+

Invoice Number: _______________
Date: _______________
Amount: _______________

Label Sheet Pattern

bash

# /usr/spool/printers/ptr1/.label-align

# 3x8 label sheet alignment

[1 ]  [2 ]  [3 ]
[4 ]  [5 ]  [6 ]
[7 ]  [8 ]  [9 ]
[10]  [11]  [12]
[13]  [14]  [15]
[16]  [17]  [18]
[19]  [20]  [21]
[22]  [23]  [24]

Form with Specific Fields

bash

# /usr/spool/printers/ptr1/.letterhead-align

                    Company Name Here
                    123 Main Street
                    City, State ZIP


Dear Customer,

This is a test alignment page.

X marks the position:  X


Signature line: ________________________

The Alignment Process

When printer started with alignment configured:

  1. Xi-Text sends docstart string (if any)
  2. Xi-Text sends alignment file contents
  3. Any configured filter processes the alignment file
  4. Xi-Text sends docend string (if any)
  5. Printer enters a/w oper state
  6. Display shows N/A (Not Aligned) marker

Operator then:

  • Examines printed alignment page
  • Checks if printing correctly positioned
  • Approves or rejects alignment

Approving Alignment

If alignment correct:

bash

# Command line
spok ptr1

# In spq: 'y'

Result:

  • N/A marker removed
  • Printer transitions to Idle
  • Production jobs begin printing
  • Alignment not required again until printer restarted

Rejecting Alignment

If alignment incorrect:

bash

# Command line
spnok ptr1

# In spq: 'n'

Result:

  • Alignment page prints again
  • Printer returns to a/w oper state
  • N/A marker remains
  • Operator can adjust media and retry

Common reasons to reject:

  • Paper not loaded squarely
  • Continuous feed paper not properly aligned
  • Label sheet shifted
  • Wrong paper type loaded

Adjusting Between Rejections

After rejecting alignment:

  1. Access printer physically
  2. Adjust paper position
  3. Check paper alignment guides
  4. Reload paper if necessary
  5. Approve next alignment attempt

Alternative: Executable Alignment

Instead of file, execute command to generate alignment:

bash

# In setup file
execalign=/usr/local/bin/generate-invoice-align

Environment variables available:

bash

SPOOLJOB   # Job number of next job to print
SPOOLHOST  # Hostname if remote job, otherwise empty

Example executable alignment script:

bash

#!/bin/bash
# /usr/local/bin/generate-invoice-align

# Generate dynamic alignment based on next job
echo "Alignment Test"
echo "Next job: $SPOOLJOB"
echo ""
echo "+--------+--------+"
echo "|        |        |"
echo "|   A    |   B    |"
echo "|        |        |"
echo "+--------+--------+"

Make executable:

bash

chmod +x /usr/local/bin/generate-invoice-align

Setup File Integration

Full example with alignment:

bash

# /usr/spool/printers/ptr1/invoice

# Device (could be in .device instead)
device=/dev/lp0

# Alignment file for invoices
align=.invoice-align

# Setup string
setup="^[[&l0O^[[&l8D^[[&l66F"

# No banner for invoices
nobanner

# Log each invoice printed
logfile=invoice-log

Bypassing Alignment

To skip alignment after printer started:

If operator confident alignment correct without testing:

bash

# In spq, with printer in a/w oper state
# Press 'y' to approve without examining page
# Confirmation requested - press 'Y' to confirm

To reinstate alignment requirement:

If printer idle and alignment bypassed:

bash

# In spq, select idle printer
# Press 'n'
# Confirmation requested - press 'Y'
# Next start will require alignment

Troubleshooting Alignment

Alignment File Not Found

Symptom:

Printer starts without printing alignment, goes directly to Idle.

Cause:

Alignment file doesn't exist or inaccessible.

Solution:

bash

# Check file exists
ls -l /usr/spool/printers/ptr1/.invoice-align

# If missing, create it
vi /usr/spool/printers/ptr1/.invoice-align

# Ensure readable by spooler user
chmod 644 /usr/spool/printers/ptr1/.invoice-align
chown spooler /usr/spool/printers/ptr1/.invoice-align

Alignment Page Doesn't Print

Symptom:

Printer enters a/w oper state but nothing printed.

Possible causes:

  • Alignment file empty
  • Printer offline
  • Device communication issue

Solution:

bash

# Check file has content
cat /usr/spool/printers/ptr1/.invoice-align

# Check printer communication
echo "test" > /dev/lp0

Alignment Prints Garbled

Symptom:

Alignment page prints but garbled or incorrect format.

Possible causes:

  • Filter processing alignment inappropriately
  • Wrong escape sequences for printer
  • Alignment file contains binary data

Solution:

Alignment goes through configured filter. If filter inappropriate:

bash

# Create separate setup file without filter
# Copy invoice setup
cp /usr/spool/printers/ptr1/invoice \
   /usr/spool/printers/ptr1/invoice-nofilter

# Edit to remove filter line
vi /usr/spool/printers/ptr1/invoice-nofilter

# Use for alignment testing

Can't Approve Alignment

Symptom:

'y' command doesn't work, printer stays in a/w oper.

Possible causes:

  • Wrong printer selected in spq
  • Permission issue

Solution:

bash

# Verify printer state
splist ptr1
# Should show: a/w oper with N/A marker

# Approve from command line
spok ptr1

Best Practices

Create clear alignment patterns:

Use obvious visual markers that are easy to judge.

Document alignment procedure:

Provide operators with instructions for each special form type.

Test alignment thoroughly:

Use actual production forms for alignment testing, not plain paper.

Save successful setup:

Once alignment working correctly, document paper loading procedure.

Use consistent media:

Same brand/type of labels/forms for predictable results.

Consider automatic alignment:

For high-volume production, invest in printers with automatic alignment capabilities.

Example: Complete Invoice Setup with Alignment

bash

# /usr/spool/printers/ptr1/.device
device=/dev/lp0
baud=9600

# /usr/spool/printers/ptr1/invoice
# Invoice form printing

# Alignment file
align=.invoice-align

# Setup for invoice printing
setup="^[[&l0O^[[&l8D^[[&l66F"

# Start each invoice
docstart="^[[&l1H"

# End each invoice
docend="^L"

# No banner
nobanner

# Log invoices
logfile=invoice-log

# /usr/spool/printers/ptr1/.invoice-align
# Alignment test pattern
+------------------+
| INVOICE          |
| Number: ______   |
|                  |
| Date: ______     |
|                  |
| Amount: ______   |
+------------------+

Procedure:

  1. Load invoice forms in printer
  2. Start printer: spstart ptr1
  3. Alignment page prints
  4. Check positioning of test pattern vs form fields
  5. If correct: spok ptr1
  6. If incorrect: spnok ptr1, adjust paper, repeat
  7. Once approved, production invoices print correctly
Using the System Log File for Diagnostics
Understanding spshed_reps and how to access it