RosettaCodeData/Task/Pinstripe-Printer/Liberty-BASIC/pinstripe-printer.basic
2023-07-01 13:44:08 -04:00

49 lines
1.1 KiB
Text

nomainwin
'paperW = 8.5 ' for US letter paper
'paperH = 11
paperW = 8.2677165 ' for A4 paper
paperH = 11.6929134
dpi= 300
prompt "Enter your printer DPI" +chr$( 13) + "(300 is OK for laser one, 360 likely for inkjet)"; dpi
w = paperW *dpi 'pixel size of paper
h = paperH *dpi
graphicbox #main.gr, 0, 0, 300, 300 'picture could be bigger
open "Pinstripe/Printer" for window as #main
#main "trapclose [quit]"
#main.gr "autoresize" 'now we can maximize window with picture
#main.gr "down"
#main.gr "horizscrollbar on 0 "; w -300 'so we can scroll it
#main.gr "vertscrollbar on 0 "; h -300
#main.gr "place 0 0"
#main.gr "color white"
#main.gr "boxfilled "; w; " ";h
#main.gr "color black"
#main.gr "backcolor black"
for i = 0 to int( paperH)
ww = i + 1
yy =( i + 1) * dpi
if yy > h then yy = h
for x = ww to w step ww * 2 'start with white strip
x1 = x + ww
if x1 >= w then x1 = w
#main.gr "place "; x; " "; i * dpi
#main.gr "boxfilled "; x1; " "; yy
next
next
#main.gr "flush"
#main.gr "print "; w
wait
[quit]
close #main
end