i have never had to implement printing in any program i have written so i dont really know what may be possible. suppose i have 3 editboxes that a user has to input x and y coordinates and then based on those coordinates will position a bitmap somewhere that doesnt need to be visible with the necked eye.

I need to find a way to print out the x and y coordinates and the bitmaps without printing out anything else such as the main window. so the only thing printed out on my paper is the x and y coordinates and the bitmap that is at the x and y coordinates on the paper. hope this isnt too confusing.
Posted on 2003-05-10 14:20:06 by smurf
Well, there seems to be a new found interest in that much maligned peripheral these days :grin:

NaN has a good post on printing , essentially it's just another device context that you can draw whatever you want (subject to capabilities) into. So I'm assuming it would be the same as drawing it into any DC but with a bit more setup. Somebody should really do a good tutorial on printing (I know I've said this before)
Posted on 2003-05-10 14:27:44 by donkey
Afternoon, smurf.

This isn't a tutorial, however if you read your docs on printing, you should be able to figure it out.

Basically, you draw onto a printer dc, just like you'd draw onto a window dc.

This means that you use TextOut for drawing text, and bitbltting for drawing bitmaps.

Posted on 2003-05-10 20:49:17 by Scronty
donkey: thanks for the link

Scronty: i really appreciate the example. the source code has been really helpful.
Posted on 2003-05-11 05:58:29 by smurf
Afternoon, Smurf.

Here's a rough update to the previous proggy.

This one prints out a bitmap as well.

The code is still a bit rough, however if you have any questions, just ask them here.

Note that, since a monitor and a printer are *very* different devices, what gets printed out will *not* be exactly the same size as what you see on your monitor.

Also: you mentioned that you want to print out X/Y coords and a bitmap *at* those coords.
That is exactly what this updated proggy does.
It may not be clear to viewers of the printed document where the bitmap actually is (in relation to anything else printed on the document).

If this is for printing out information in a graphical/statistical form, then I'd suggest you do the normal thing and actually draw/print some rulers/axis/coord information as well.

Posted on 2003-05-18 19:09:47 by Scronty
works great!:)

thanks again Scronty.
Posted on 2003-05-18 21:33:23 by smurf
Anyone have a clue as to why Scronty's code wont print out the same on different printers. The size of the text and bmp are the same but placement on the paper is offset just a little on each printer i tested it on (about an 1/8th of an inch).
Posted on 2003-05-24 22:09:58 by smurf
Afternoon, smurf.

I had another look at the stuff after your PM, however all seems well.

Are you sure it's not something to do with the individual printers themselves?

Try printing a few words from MS Word on each printer and see if they're printed in the *exact* same locations upon the pages.

Posted on 2003-05-24 23:16:01 by Scronty

I had tested that prior to my post with text printed from microsoft word and notepad. The text do not line up and is offset a little.... about an 1/8 of an inch to the top and left. I made sure the paper was in each printer exactly like it should be to make the tests accurate.
Posted on 2003-05-24 23:49:35 by smurf
You can't trust a printer for registration. Verticle repeatability seems pretty good; horizonal is harder. There is also angular.

Repeatability on one laser printer seems to be within 10 mils. If you want to use another printer, you have to start over from scratch.
Posted on 2003-05-25 05:12:53 by eet_1024
eet_1024: thats what i wasnt really looking forward to hearing. based on testing of different printers it must be true.

i was able to use the api SetWindowOrgEx to shift the axes of the logical point which aligned the printer output to work with what i was doing. i guess i need to test each printer i plan on using for differences in alignment and compensate with the SetWindowOrgEx api.

thanks again Scronty for time spent.
Posted on 2003-05-26 21:23:52 by smurf
I have a hard time buying into this entirely. The entire concept of the Windows Driver is to negate this situation. I will however agree if the driver doesnt follow standards set by Microsoft, then the output result will be based on ineffective data.

Smurf, i get the feeling your rushed on this. I am still happy to help you if i can, but you gotta give me some time (say to this weekend or something). Im crazy overworked at the moment (and burnt out at night ~ like now).

Posted on 2003-05-26 21:28:30 by NaN
NaN: i do need help figuring this out but im in no rush. you have helped me out many times in the past and i am in no way hurt over the fact you have no time to help out right now. ill post my source code in a few days and whenever you get a chance to browse it let me know.
Posted on 2003-05-26 21:58:55 by smurf