Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using LPrint and _Printimage together
#1
I'm struggling with sending some colored text to my printer. The wiki seems to suggest that this can be done using Lprint and _Printimage together but I'm getting error messages. Here is the simplest example of what I'm going -

Code: (Select All)
$Color:32
Cls , _RGB(255, 255, 255)
Screen _NewImage(640, 900)

Words$ = "Hello World"
PrintText
LPrint
LPrint

Sub PrintText
    LPrint
    LPrint
    Color Red
   _printimage words$

END SUB
I'm guessing here but it would seem _printimage does not work in Screen 0 and it would also appear that _printimage is looking for a numeric value rather than a string value, which means it's looking a page number or its looking for an image number?

I'm also wondering if the Color Red call would go before the LPrint and not after the LPrint as I have it here?

Thanks
Reply
#2
Try this very simple demo, and see if it helps explain the steps to do what you're trying to do:



Code: (Select All)
$Color:32
Screen _NewImage(850, 1100, 32) 'Create a page which scales nicely to 8.5 x 11 -- which is the standard print page
'in this case, I'm scaling x100 for 850 x 1100 in size.
'and I'm running in 32-bit color as you used the Color:32 statement above it


Cls , White 'now set that screen to being white, so it matches a sheet of paper.
'With paper, we print colored in on a standard white background usually.
'change this background if you're using color paper so you can see what stands out and is readable,
'if you want/need.


'Now print everything which you'd like to appear on that page on the screen

_PrintMode _KeepBackground 'I don't want to print black background on my white pages.
Color Red
Locate 10, 10: Print "Hello World"
Color Gold
Locate 20, 15: Print "My name is STEVE!!"
Color Blue
Locate 15, 20: Print "I am AMAZING!!!"

Sleep 'A sleep statement so you can preview what the page will look like before we send it to the printer

_PrintImage 0 'print the visible screen to the default system printer

Sleep 'another pause so we can grab our physical handout and compare it to what the screen looks like.

End 'And now we're done!
Reply
#3
Wow for some reason I got it in my head that LPrint didn't even work in QB64. I've got to try it out.

If I am printing a .bas source and the line is longer than 80 chars, is the next line the next line in program or the end of the line that didn't fit 80 char width?
b = b + ...
Reply
#4
LPRINT just prints black text on whatever paper you have.  It doesn't do images, page feeds, colors, or anything else.   It's just for a quick print of black text on white paper (such as perhaps printing a text file).

As for Wordwrap, I have no idea, as I haven't actually used LPRINT in ages due to it's limitations.  I'd rather print to the screen, format it and make it look like I want -- images, colors, and all -- and then simply _PrintImage that screen off.
Reply
#5
I'm getting a error from my printer Steve. It won't print the document. Things seem to freeze on the computer screen while the printer is dealing with the code sent to it. Takes a little while before the error message and then the computer screen unfreezes. I can't seem to find what it's objecting to in the code. I thought LPrint and _Printimage had to be used together. I misread the wiki. 

Thanks for that code and remarks. I'm going to play with it some more and see what my Epson is having trouble with.
Reply
#6
@Dimster the lprint for qB64 needs a uSB port, the epsons I remember use serial or parallel not usb.
b = b + ...
Reply
#7
Hi b : the epson is the ET-3850 series, it is wireless and I use LPrint all the time with it. Just trying to add some color to some of the text info I'm sending to the printer.
Reply
#8
@dimster ok have you tried steves demo yet? no need for lprint btw i've been creating forms and calendars, printing with fonts... without any need for lprint, it's just creating your page in an imagehandle that could be the screen or setup up in a _dest workarea for _printimage to use.
b = b + ...
Reply
#9
Hi b - I'm still messing with Steve's example using _Printimage. Ya, I've have seen some of your work with printing fonts. I'm typically using Lprint for a quick dump of either a print out of the code on my screen or a quick dump of the results of a program run that appears on my screen. Using the search and change feature I can change every Print to an LPrint and back again. Saves me a lot of coding time to build in the code to print do the same thing without Lprint. In fact, and I may have mentioned this before a while ago, I'd love to have a L? option.
Reply
#10
As an update to the error I was receiving from my printer using Steve's code - SOLVED - turns out it was simple matter of commenting out that second "Sleep" in the code. Obviously the Epson took exception to Sleeping on the job.
Reply




Users browsing this thread: 1 Guest(s)