(06-04-2024, 02:23 AM)SMcNeill Wrote: @bplus give this a shot:
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
File$ = _OPENFILEDIALOG$("Choose file to Print", _CWD$, "*.*", "Any File")
OPEN File$ FOR BINARY AS #1
IF _FILEEXISTS(File$) = 0 THEN SYSTEM
CLS , White, PrintScreen
COLOR Black, 0
height = INT(_HEIGHT / _FONTHEIGHT - 3)
DO
LINE INPUT #1, temp$
PCOPY 0, 1
PRINT temp$
IF CSRLIN >= height THEN 'we probably scrolled the page. Rip off this sheet of paper and start a new page!
PCOPY 1, 0
_PRINTIMAGE PrintScreen
SLEEP 'A break so we can see which page we just printed
CLS , White, PrintScreen
PRINT temp$
END IF
LOOP UNTIL EOF(1)
CLOSE
I'm thinking the only real change you needed to make was to fix the _HEIGHT issue. I'd failed to / _FontHeight, which means the page scrolled itself to death before printing and going to the next page.
i had to add something on end to get the last and partial page printed, then i made this sucker more interesting ;-))
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")
Open File$ For Binary As #1
If _FileExists(File$) = 0 Then System
Cls , White, PrintScreen
Color Black, 0
height = Int(_Height / _FontHeight(f&) - 3)
page = 1
fname$ = Mid$(File$, _InStrRev(File$, "/") + 1)
Do
Line Input #1, temp$
PCopy 0, 1
Print temp$
If CsrLin >= height Then 'we probably scrolled the page. Rip off this sheet of paper and start a new page!
PCopy 1, 0
'_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 temp$
End If
Loop Until EOF(1)
PCopy 1, 0
_SaveImage fname$ + Str$(page) + ".PNG", PrintScreen
Close
Cls , White, PrintScreen
Print "Files ready"
sample file:
b = b + ...