Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need a Printer/Tester
#10
You're not seeing what I'm saying.   Try this:

Code: (Select All)
$COLOR:32
$RESIZE:SMOOTH
'Resize is so we can drag/resize the screen so it fits on a monitor
PrintScreen = _NEWIMAGE(850, 1100, 32) 'to represent an 8.5" x 11" sheet of paper
SCREEN PrintScreen
f& = _LOADFONT("arial.ttf", 18)
_FONT f&
'File$ = _OPENFILEDIALOG$("Choose file to Print", _CWD$, "*.*", "Any File")
file$ = "temp.txt"
OPEN file$ FOR BINARY AS #1
IF _FILEEXISTS(file$) = 0 THEN SYSTEM


DIM A_long_line AS STRING
FOR i = 1 TO 500
A_long_line = A_long_line + CHR$(INT(RND * 26 + 65))
NEXT
A_long_line = A_long_line + CHR$(13) + CHR$(10)
FOR i = 1 TO 50
PUT #1, , A_long_line
NEXT
SEEK #1, 1





CLS , White, PrintScreen
COLOR Black, 0
height = INT(_HEIGHT / _FONTHEIGHT(f&) - 3)
page = 1
fname$ = MID$(file$, 1, _INSTRREV(file$, ".") - 1)
PRINT: PRINT
DO
LINE INPUT #1, temp$
nline = nline + 1
PRINT nline; temp$
IF CSRLIN >= height THEN 'we probably scrolled the page. Rip off this sheet of paper and start a new page!
'_PRINTIMAGE PrintScreen
_SAVEIMAGE fname$ + STR$(page) + ".PNG", PrintScreen
page = page + 1
'SLEEP 'A break so we can see which page we just printed
CLS , White, PrintScreen
PRINT: PRINT
END IF
LOOP UNTIL EOF(1)
'_PRINTIMAGE PrintScreen
_SAVEIMAGE fname$ + STR$(page) + ".PNG", PrintScreen
SLEEP
CLOSE
CLS , White, PrintScreen
PRINT "Files ready"

   

Notice how the top of that first line is cut off? The last line on the page was too long for the page and, as such, it caused the screen to scroll up.

THAT's what the PCOPY undoes and then moves that line to the next page for us.
Reply


Messages In This Thread
Need a Printer/Tester - by SMcNeill - 06-03-2024, 11:08 PM
RE: Need a Printer/Tester - by bplus - 06-04-2024, 12:11 AM
RE: Need a Printer/Tester - by SMcNeill - 06-04-2024, 02:23 AM
RE: Need a Printer/Tester - by bplus - 06-04-2024, 09:02 AM
RE: Need a Printer/Tester - by bplus - 06-04-2024, 09:20 AM
RE: Need a Printer/Tester - by JRace - 06-04-2024, 03:13 AM
RE: Need a Printer/Tester - by bplus - 06-04-2024, 10:01 AM
RE: Need a Printer/Tester - by SMcNeill - 06-04-2024, 10:17 AM
RE: Need a Printer/Tester - by bplus - 06-04-2024, 10:28 AM
RE: Need a Printer/Tester - by SMcNeill - 06-04-2024, 10:53 AM
RE: Need a Printer/Tester - by SpriggsySpriggs - 06-04-2024, 11:12 AM
RE: Need a Printer/Tester - by bplus - 06-04-2024, 11:20 AM
RE: Need a Printer/Tester - by SMcNeill - 06-04-2024, 11:30 AM
RE: Need a Printer/Tester - by SpriggsySpriggs - 06-04-2024, 06:22 PM
RE: Need a Printer/Tester - by bplus - 06-04-2024, 07:11 PM



Users browsing this thread: 17 Guest(s)