PI.PIO - jedimatt42/tipi GitHub Wiki

PI.PIO special file

Print to PDF

Overview

TIPI supports printing to an alternative printer device via standard OPEN, WRITE, CLOSE operations.

We are used to dot-matrix line printers that provide instant feedback as it prints. Usually there will be no user feedback on the screen of the TI while it is printing.

With TIPI, printing builds a print-spool file. Conversion to PDF typically happens once the TI software closes the PI.PIO device. At this stage, the close operation will take a bit of time, as it then converts to a PDF.

PI.PIO supports Epson ESC/P printing. It supports 9 pin, 24 pin, and color features.

When printing text, it uses a SIEMENS font.

The EPSON to PDF conversion is a slightly modified version of RetroPrinter.com open source PrinterToPDF software. My modifications are available here: https://github.com/jedimatt42/PrinterToPDF

Options

Like Texas Instruments PIO device, there are a number options to control printing behavior:

  • .CR - Do not add carriage-return and linefeed automatically to the end of each WRITE record
  • .LF - Do not add linefeed automatically to the end of each WRITE record. A carriage-return may still be added if .CR is not specified. If .CR is specified, .LF is unnecessary.
  • .NU - archaic - Adds 6 nulls 0x00 to the end of line after the carriage-return or carriage-return + linefeed to allow time for printer to move the print head.

Additionally, to support international printing:

  • .A4 - Set paper size to standard A4 paper. If not specified, the paper size is US Letter.
  • .SP - Spool continuation. If the device name includes the .SP option, then the spool is continued for the next open operation and conversion to PDF does not occur until close occurs for a PI.PIO opened without the .SP option.

Accessing the PDFs

The PDF will be generated in a Windows file-share hosted by the Raspberry PI, typically named \\\\TIPI\\PDFS. Each print job will produce a separate PDF.

PDF files will be named for the timestamp when the spool was opened. If the .A4 option was specified, then there will be an _a4 addendum to the file name.

Examples:

print_2020_01_04_T09_27_20.pdf
print_2020_01_04_T09_16_34_a4.pdf

Spool Continuation

Some programs open, and close the printer device multiple times while printing. This was of no consequence for dot-matrix printers. For PDF conversion, the PDF document is defined by the life of the spool.

Most programs are well behaved on the TI. There was no real consequence to keeping the printer open while processing other files, unless they needed more VDP RAM. TI-Writer and TI-Artist are known to not need this option.

So, for example, certificate 99 is one such program that requires closing the printer device a few times during the print job.

To get around this, you specify the printer device as PI.PIO.CR.SP. When no previous spool is still open, this will create a new spool. As the program opens and closes the device, it will accumulate the output into this same spool. When the program is complete, the spool will still be available.

To finalize the spool and convert to a PDF, you will then have to go into TI BASIC and open and close the device without the .SP option.

OPEN #1:"PI.PIO"
CLOSE #1

At this point the PDF conversion will take place, and close will return when conversion is complete.

Since version 1.43