NewPage

From Br Wiki
Jump to: navigation, search
NEWPAGE

The NewPage internal function returns a character which, when printed, causes the printer to do a form feed or the screen to clear.

Comments and Examples

00010 PRINT NEWPAGE
00020 PRINT BELL,NEWPAGE,"ERROR"
00030 PRINT #255: NEWPAGE

Line 10 erases the screen. Line 20 sounds the tone, clears the screen and prints the message ERROR at the bottom of the screen. Line 30 advances the printer to the top of the next page (sends a character for FORM FEED). NEWPAGE also resets internal line counting variables (see Technical Considerations below in this section).

The NEWPAGE function no longer outputs a carriage return to display files when used in the following form:

PRINT #255: NEWPAGE

Previously, NEWPAGE would output both the newpage character (FF-chr$(12)) and a carriage return (CR - chr$(13)) character. The carriage return has been removed because some printers were using it to move the paper up an extra line, or they weren't recognizing the escape sequences that followed it. Be aware that this may affect printed or spooled reports.

Related Functions

Other special functions used mainly in PRINT are BELL and TAB(X). Also, the KREC(N) function for display files will count the number of output lines since the last NEWPAGE was issued.

Technical Considerations

  1. NEWPAGE also zeroes the internal line counter used by the PAGEOFLOW error condition to perform page breaks. This counter can be displayed or printed with the KREC(N) function. For example, KREC(255) tells how many lines of output have been sent to the printer since the last NEWPAGE was issued.
  2. In an unformatted PRINT statement, when NEWPAGE precedes the TAB(X) function, the TAB function will appear to be off by one column because the character for NEWPAGE appears in the output buffer, but not on the screen or printer. Avoid using NEWPAGE (or BELL) before TAB in an unformatted PRINT statement. One remedy is to use one PRINT statement for NEWPAGE (and BELL) and another for the TAB function and other output.