Printer?

BlitzPlus Forums/BlitzPlus Programming/Printer?

WillKoh2(Posted 2003) [#1]
Can I communicate with the printer through Blitz?


semar(Posted 2003) [#2]
Yes, in a basic way. See Code Archive.


GfK(Posted 2003) [#3]
There's a printer DLL over on the blitzcoder showcase.


Kuron(Posted 2003) [#4]
Since this is under "2D Graphics". I will jump in. If you just want to print a graphic, there is absolutely no need for a DLL... See my post (had a different account and name then): http://www.blitzbasic.co.nz/bbs/posts.php?topic=19427

That method will work with any version of Blitz...


WillKoh(Posted 2003) [#5]
Well, that basic method only prints with the standard font and by default lines. I want to use fonts and warping of text at specific locations. A printer can do all kinds of things with text without pixelizing it, I happend to know.


GfK(Posted 2003) [#6]
A printer can do all kinds of things with text without pixelizing it, I happend to know.
No. Printers can't manipulate text at all. It only prints what your PC tells it to print.

How come you have two accounts?


WillKoh(Posted 2003) [#7]
I lost my password but remembered it. you're righ printers don't really manipulate text, but they can print it in odd ways without rastering. Think of printing WordArt..


Andy_A(Posted 2003) [#8]
WillKoh,

In order to do "WordArt" like printing you will have to perform ALL effects to bitmap before printing, OR you will have to store all graphics information in vectors.

When you send an image or text to the printer, Windows performs a rasterization vectors (similar to drawing them in memory to a bitmap!) which changes the vectors to raster line information that your printer can understand and use for the output.

TrueType fonts are just a collection of filled in Bezier curves that look like alphanumeric characters. Because these curves can be scaled (just like vectors), the rasterized output is produced at the resolution of your printer and are very well formed (high resolution + anti-aliasing = no jaggies).

When you send bitmap information, scaling is performed in memory using bilinear scaling routines. This is not perfect but looks much better than directly scaling a 320x200 image to say 1024x768 (which definitely looks 'chunky').

These functions can be accessed through gdi32.dll, the problem is Blitz cannot access "CallBack" functions (which are what the printer routines are), because Blitz cannot pass or receive a null pointer.

Unless someone writes a DLL that accesses gdi32.dll printer functions, stick to the method Semar and White Eagle mentioned.

Regards,

Andy


Kanati(Posted 2003) [#9]
That's my dll over there on blitzcoder... There's the old version for BlitzBasic and then there's the userlib for Blitz3D and Blitz+.

It should handle most simple printing chores for you. It does different fonts, graphics primitives, and bitmaps. It handles things pretty much like VB does. You set up a page, tell it what to print and where... and then end the page. It's then sent to the printer. I've used it to create D&D player character sheets and such with player portraits and such.

And of course it's FREE! :)

Kanati


Andy_A(Posted 2003) [#10]
Kanati,

Two things,

1) Where the link?

2) Does your dll allow scaling of bitmaps, adjusting margins, and page orientation?

Andy


WillKoh(Posted 2003) [#11]
OK, so all that printers write is rasterized in hi-res <i>before</i> sent? Well, what I ment then is that I wanted vector as a middle-hand, despite not really understanding the formulas involved, i know vectors are good for smoothing. These printer DLLs mentioned, do they draw fonts from vector? (as is normally the case). Do they support warping?


Andy_A(Posted 2003) [#12]
The middle-ware that you want for warping, between your app and the printer, is something you'll have to program.

The gdi32.dll only prints pre-defined TrueType characters.


Kanati(Posted 2003) [#13]
Scaling of bitmaps, yes. margins and page orientation... (thinking... been a while) don't think so.

Warping of text... Nope. But I think I do allow printing text at odd angles.

Just go to www.blitzcoder.com and do a search in the showcase for printer userlib. If you can't find it I'll post the link here.


AndyBoy_UK(Posted 2004) [#14]
Sorry to drag up an old post but it is apropriate to what I am after.

I just tried to download this from Blitzcoder but the link is broken.

I have sent you a PM over there Kanati but not sure if you still use that username and password.

Does anyone know the new link (or a link to a new version if this one has been superceeded)?

Cheers
Andy


elias_t(Posted 2004) [#15]
Hi.

I have thrown a little dll together following some tutorials from the internet.

Source is there and I compiled it with devc++ 4.9.8.5.

It should find the default printer and print 3 lines
[normal,bold and italic].

It is in a simple form but you can evolve it easy to a userlib.

http://telias.free.fr/temp/print.dll.zip

Bye.


jfk EO-11110(Posted 2004) [#16]
Thanks Elias! Could I also send plain Ascii to the printer this way? eg. escape sequences?


Kanati(Posted 2004) [#17]
AndyBoy... new userlib is nearing completion. Uses VB runtimes though... I don't think I still have the old userlib and it is probable that I'm not going to rework it. I'm hoping this new one will be much better than the old one though. The code is done, barring some beta testing, but I have to do the documentation for it (again). I'm hoping for a late weekend release.

Kanati