Printing to a printer

by Solitaire (Login Solitaire1)
S

I wrote the following program over 10 years ago, for printing a document of several pages to an LPT printer. Don't know if it applies to your present situation, but maybe this can give you some hints:

==========================================================================
DIM N AS INTEGER, t AS INTEGER, j AS INTEGER, sentence AS STRING
DIM wrongflag AS INTEGER, pp AS INTEGER, row AS INTEGER, page AS INTEGER
CONST FALSE = 0, TRUE = NOT FALSE: wrongflag = FALSE
CLS   'Prints multiple pages with page numbers; ejects each page
PRINT "Number of lines to a page vary for each printer."
PRINT "Default for inkjet printers is 61, dot matrix is 65."
INPUT "Enter number of lines to a page for your printer:  ", pp
INPUT "Enter number of items to list:  ", N
ON ERROR GOTO continue
LPRINT TAB(30); "THIS IS THE HEADING"; TAB(70); "Page 1"
IF wrongflag = TRUE THEN
    wrongflag = FALSE
    PRINT : BEEP
    PRINT "Printer error.  Printer not connected "
    PRINT "or incompatible with software."
    END
END IF
LPRINT
sentence$ = "This is a sample line printout."
row = 2: page = 1
FOR t = 1 TO N
    row = row + 1
    LPRINT t; TAB(10); sentence$
    IF N > pp AND row = pp THEN
        row = 4
        page = page + 1
        LPRINT CHR$(12)
        LPRINT TAB(30); "NEW PAGE HEADING"; TAB(70); "Page"; page
        LPRINT
    END IF
NEXT t
FOR j = row TO pp  'ejects paper from printer
    LPRINT
NEXT j
END

continue:
wrongflag = TRUE
RESUME NEXT

Posted on Jul 12, 2012, 8:53 AM

Respond to this message   

Return to Index