Click here to Skip to main content
14,331,485 members
Rate this:
Please Sign up or sign in to vote.
See more:
Anyone have any suggestions on how to print one character per page? I'm trying to print numbers: 00 - 99. I am using drawstring to meet this need. However, when the numbers print they are cut off at the knees, meaning only a portion of the number is printed. I have my margins set to zero, and the text is positioned to print at position 0,0. By adjusting the font size, I can get the numbers to actually appear on the page, but at that point they are too small and fail to meet my needs. I've also tried overloading the drawstring method and sending a RectangleF object, same results.
Posted
Comments
OriginalGriff 23-Nov-10 14:34pm
   
Answer updated.

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Could be several things:
1) Does your printer support zero margins? Can it print that close to all four edges?
2) Have you tried the same size, but different fonts? Bear in mind that fonts can leave space for descenders on "g", "y" and so forth, so the "bottom" of the character may not be at the bottom of your page.
3) What happens if you use print preview, rather than a printer driver?

BTW: If you are trying to print 00 to 99, one character per page, just concentrate on 0 to 9, and print twenty copies...

"Yes, the printer supports zero margins and I am setting the margins to zero as the object is being created. The easiest way to see what I am seeing is to drop a label control onto a windows form, set the font size to 700 and the margins to zero, set the text to 83...leave all other properties at the default. You will most likely have to stretch the form so that the entire label is displayed. The way the label has shifted the characters to the right and down is what I am seeing. When I print, the bottom portion of the label is being chopped off...when I send the label...sending just straight text renders the same outcome."

So... Looking at it from the POV of the label: what you are trying to do is print a string, consisting of a two character word, in a space which can only hold one of them. The label goes:
"I think I want to move this word to the next line"

"Oops! That doesn't fit either. I'll split it, and move the end bit"

"Bugger! It's on a different page. That part of the word should be on the same page, or it'll bugger up my pagination. I'll move it back."

"Sod it - it doesn't fit there either. I give up - you sort it out"

Don't do it. Try it with single characters. A label with "8". Print. a label with "3". Print. You will find it works better.
   
v2
Comments
OriginalGriff 23-Nov-10 14:18pm
   
The OP posted:
"Yes, the printer supports zero margins and I am setting the margins to zero as the object is being created. The easiest way to see what I am seeing is to drop a label control onto a windows form, set the font size to 700 and the margins to zero, set the text to 83...leave all other properties at the default. You will most likely have to stretch the form so that the entire label is displayed. The way the label has shifted the characters to the right and down is what I am seeing. When I print, the bottom portion of the label is being chopped off...when I send the label...sending just straight text renders the same outcome."
meago 23-Nov-10 14:49pm
   
I apologize for the confusion. I need to print two numbers on a single 8.5 x 11 sheet of paper with the numbers filling the paper. I have plenty of realestate on the paper, but as you can see in the label example I mentioned a couple of posts back, the numbers are shifted to the right and shifted down. If I can stop the shifting then the problem will most likely be resolved. I have my margins set to zero, so I can only assume that it has something to do with the font padding the area around the numbers. At first I thought perhaps it was due to a true-type font, so I turned to a non-true-type font, but I see the same results. I know I can resolve this by using C and just going straight to the printer, but I know there's a way to do it in C#...I just have to find it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100