I'm at a loss... Printing and margins?

  • Thread starter Thread starter Tinus
  • Start date Start date
T

Tinus

Hello all,

Because you have been so helpfull the last couple of times, I thought after
testing and wasting more than 20 pages (and google-ling for 3 days :-( ). I
would ask you again for your help.

The problem is this:
If I print a rectangle which begins at (0,0) and the margins are also set to
0 (l:0, t:0, r:0, b:0) then it prints fine (ok, not quite because 0,0 is
inside the none printable area but I corrected for that by checking to see
if the margins are inside the non printable are and if so then correcting
for that otherwise I use the MarginBounds from the PrintEventArgs).

Now when I set the margins (using the PageSetupDialog) to e.g.: 1" (l:1",
t:1", r:1", b:1") then it prints incorrectly. The margin on the left and top
are almost double the size I specified: 1.75". And no, the non printable are
is not 0.75", it is only 0.2".

However if I set the margins to 1" but the rectangle x,y to 0,0 then the
print out is correct. The left and top margin are exactly 1".

So, for now I also have the rectangle set to (0, 0, MarginBounds.Width,
MarginBounds.Height) and the document comes out fine but the downside of
that is that the PrintPreview is incorrect (starts always on the upper left
corner: 0,0 which is obvious).

Hopefully someone here can help me again. I have a feeling I'm overlooking
something.
BTW: In MS Word a document with margins set to 1" (or something else) are
printed perfectly and is also correctly shown in the Print Preview. I.o.w.
my printer is not broken...

Thank you in advance!

With regards,
Tinus
- The Netherlands -
 
You could try getting the MarginBounds from the PrintPageEventArgs and
pass that to your printing logic.

private void printDocument1_PrintPage(object sender,
System.Drawing.Printing.PrintPageEventArgs e)
{
...
e.MarginBounds,
...
}

Regards,
Jeff
 
Tinus,

I faced the same situation like you have here.
I have posted a work around that worked for me.

do a search "How to print in full page without margins". Go to the last
message posted by me. I just posted it so it would take at least 5 minutes to
show up there.

Thanks,
Judge
 
Back
Top