473,857 Members | 2,042 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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.Wi dth,
MarginBounds.He ight) 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 -
Nov 17 '05 #1
8 9658
You could try getting the MarginBounds from the PrintPageEventA rgs and
pass that to your printing logic.

private void printDocument1_ PrintPage(objec t sender,
System.Drawing. Printing.PrintP ageEventArgs e)
{
...
e.MarginBounds,
...
}

Regards,
Jeff

*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #2
Never mind. I see that you already tried this.

Regards,
Jeff

*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #3
Tinus,
I normally find the Hard Margins of the printer and then do a
TranslateTransf orm on the resulting graphics to get the drawing area setup
so that I can specify actual page coordinates. I check to see if the page
is being sent to the printer by checking to see if the
VisibleClipBoun ds.Height of the Graphics is less than the physical page
height and only then apply the transform. I've written some code to get the
HardMargins of the printer using PInvoke on GetDeviceCaps. You can probably
find it in the archives of microsoft.publi c.dotnet.framew ork.drawing or if
you can't find it I can post it for you. Assuming you have the code to get
hard margins the following works to do the transform if required.
--------------------------------------------------------------------------------------------------
// this is inside a PrintPage call -- all the stock items are setup in
OnBeginPrint
IntPtr hDc = ev.Graphics.Get Hdc();
ev.Graphics.Rel easeHdc(hDc);
float left = 0.0f, right = 0.0f, top = 0.0f, bottom = 0.0f;
PrintUtils.GetH ardMargins(hDc. ToInt32(), ref left, ref top, ref right,
ref bottom);
if (ev.Graphics.Vi sibleClipBounds .Height < 1100.0f)
{
ev.Graphics.Tra nslateTransform (-left, -top);
}
else
{
m_color = true; // printing to screen
ev.Graphics.Tex tRenderingHint =
System.Drawing. Text.TextRender ingHint.AntiAli asGridFit;
}
--------------------------------------------------------------------------------------------------
Note that in FW 2.0 you can get this information using properties of the
Graphics including if the printing is being done to a PrintPreview without
all these calls.
Let me know if you need the GetHardMargins code.
Ron Allen
"Tinus" <no************ ****@xxx.karsse meijer.com.noad v.xxx> wrote in message
news:uA******** ******@TK2MSFTN GP15.phx.gbl...
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.Wi dth,
MarginBounds.He ight) 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 -

Nov 17 '05 #4
Ron,
Thank you. I already found and using your GetDeviceCaps code. Works
perfectly.
The problem is that I have to set the upper left corner always to 0,0 even
when I set the upper corner margin to 1" I need to use 0,0. If I print with
margins set to 1" and the rectangle area to (0,0, MarginBounds.Wi th,
MarginBounds.He ight) then the actual printout is perfect (nice margin of 1"
on top and left side). However the Print Preview is incorrect -> displaying
the graphics in the upper most left corner (due to the 0,0 of the
rectangle).

So to solve this I need to check wether I'm in PrintPreview or I'm actually
printing it to the Printer, correct? So this is a bug or something? And I'm
not doing anything wrong?

WHat is the best way to know if I'm drawing to the actual Printer or to the
Print Preview?

Thank you,
Tinus

"Ron Allen" <rallen@_nospam _src-us.com> wrote in message
news:%2******** *******@TK2MSFT NGP15.phx.gbl.. .
Tinus,
I normally find the Hard Margins of the printer and then do a
TranslateTransf orm on the resulting graphics to get the drawing area setup
so that I can specify actual page coordinates. I check to see if the page
is being sent to the printer by checking to see if the
VisibleClipBoun ds.Height of the Graphics is less than the physical page
height and only then apply the transform. I've written some code to get
the HardMargins of the printer using PInvoke on GetDeviceCaps. You can
probably find it in the archives of
microsoft.publi c.dotnet.framew ork.drawing or if you can't find it I can
post it for you. Assuming you have the code to get hard margins the
following works to do the transform if required.
--------------------------------------------------------------------------------------------------
// this is inside a PrintPage call -- all the stock items are setup in
OnBeginPrint
IntPtr hDc = ev.Graphics.Get Hdc();
ev.Graphics.Rel easeHdc(hDc);
float left = 0.0f, right = 0.0f, top = 0.0f, bottom = 0.0f;
PrintUtils.GetH ardMargins(hDc. ToInt32(), ref left, ref top, ref right,
ref bottom);
if (ev.Graphics.Vi sibleClipBounds .Height < 1100.0f)
{
ev.Graphics.Tra nslateTransform (-left, -top);
}
else
{
m_color = true; // printing to screen
ev.Graphics.Tex tRenderingHint =
System.Drawing. Text.TextRender ingHint.AntiAli asGridFit;
}
--------------------------------------------------------------------------------------------------
Note that in FW 2.0 you can get this information using properties of the
Graphics including if the printing is being done to a PrintPreview without
all these calls.
Let me know if you need the GetHardMargins code.
Ron Allen
"Tinus" <no************ ****@xxx.karsse meijer.com.noad v.xxx> wrote in
message news:uA******** ******@TK2MSFTN GP15.phx.gbl...
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.Wi dth,
MarginBounds.He ight) 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 -


Nov 17 '05 #5
So, please let me explain in more detail what is hapening....

Page Setup: all Margins set to 1"
The e.MarginBounds. Left = 100 pixels
The e.MarginBounds. Top = 100 pixels

If I now print a Rectangle using(e.MarginB ounds.Left, ...Top, ...Width,
....Height) then the actual printed margin is +/- 1.8" (so almost double the
size set using the Page Setup dialog).

Using Rons GetDeviceCaps I get a HardMarginLeft: 11 pixels and Top: 13
pixels. So that can not be the problem: 0.8" is not 11 pixels;

If I however set the Margins again to 1" using the PageSetupDialog but draw
a Rectangle using (0, 0, e.MarginBounds. Width, ...Height) then the printout
is correct -> margins on the paper are 1" all around. However the Print
Preview is incorrect showing the draw rectangle in the upper left most
corner due to the (0,0) coordinate.

Hope someone knows what I'm doing wrong :-(

Thanks,
Tinus

"Ron Allen" <rallen@_nospam _src-us.com> wrote in message
news:%2******** *******@TK2MSFT NGP15.phx.gbl.. .
Tinus,
I normally find the Hard Margins of the printer and then do a
TranslateTransf orm on the resulting graphics to get the drawing area setup
so that I can specify actual page coordinates. I check to see if the page
is being sent to the printer by checking to see if the
VisibleClipBoun ds.Height of the Graphics is less than the physical page
height and only then apply the transform. I've written some code to get
the HardMargins of the printer using PInvoke on GetDeviceCaps. You can
probably find it in the archives of
microsoft.publi c.dotnet.framew ork.drawing or if you can't find it I can
post it for you. Assuming you have the code to get hard margins the
following works to do the transform if required.
--------------------------------------------------------------------------------------------------
// this is inside a PrintPage call -- all the stock items are setup in
OnBeginPrint
IntPtr hDc = ev.Graphics.Get Hdc();
ev.Graphics.Rel easeHdc(hDc);
float left = 0.0f, right = 0.0f, top = 0.0f, bottom = 0.0f;
PrintUtils.GetH ardMargins(hDc. ToInt32(), ref left, ref top, ref right,
ref bottom);
if (ev.Graphics.Vi sibleClipBounds .Height < 1100.0f)
{
ev.Graphics.Tra nslateTransform (-left, -top);
}
else
{
m_color = true; // printing to screen
ev.Graphics.Tex tRenderingHint =
System.Drawing. Text.TextRender ingHint.AntiAli asGridFit;
}
--------------------------------------------------------------------------------------------------
Note that in FW 2.0 you can get this information using properties of the
Graphics including if the printing is being done to a PrintPreview without
all these calls.
Let me know if you need the GetHardMargins code.
Ron Allen
"Tinus" <no************ ****@xxx.karsse meijer.com.noad v.xxx> wrote in
message news:uA******** ******@TK2MSFTN GP15.phx.gbl...
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.Wi dth,
MarginBounds.He ight) 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 -


Nov 17 '05 #6
Tinus,
I check for in PrintPreview by using the check on
VisibleClipBoun ds.Height in the previous code I sent. When this height is
less than the height of the page which is hardwired at 11" in my example I
then translate the Graphics so that the output origin is at 0,0 on the page.
My example is using the default 100dpi setting for device coordinates.
I don't normally change the document margins or do any drawing using
OriginAtMargins . I just translate the Graphics appropriately and then draw
in absolute coordinates so that if I specify 0.5"/0.5" that is where the
point will be located. For devices with smaller print areas like some
inkjet printers I also scale the output so that the whole output will fit in
the printable area.

Ron Allen
"Tinus" <no************ ****@xxx.karsse meijer.com.noad v.xxx> wrote in message
news:Oj******** ******@TK2MSFTN GP09.phx.gbl...
Ron,
Thank you. I already found and using your GetDeviceCaps code. Works
perfectly.
The problem is that I have to set the upper left corner always to 0,0 even
when I set the upper corner margin to 1" I need to use 0,0. If I print
with margins set to 1" and the rectangle area to (0,0, MarginBounds.Wi th,
MarginBounds.He ight) then the actual printout is perfect (nice margin of
1" on top and left side). However the Print Preview is incorrect ->
displaying the graphics in the upper most left corner (due to the 0,0 of
the rectangle).

So to solve this I need to check wether I'm in PrintPreview or I'm
actually printing it to the Printer, correct? So this is a bug or
something? And I'm not doing anything wrong?

WHat is the best way to know if I'm drawing to the actual Printer or to
the Print Preview?

Thank you,
Tinus

"Ron Allen" <rallen@_nospam _src-us.com> wrote in message
news:%2******** *******@TK2MSFT NGP15.phx.gbl.. .
Tinus,
I normally find the Hard Margins of the printer and then do a
TranslateTransf orm on the resulting graphics to get the drawing area
setup so that I can specify actual page coordinates. I check to see if
the page is being sent to the printer by checking to see if the
VisibleClipBoun ds.Height of the Graphics is less than the physical page
height and only then apply the transform. I've written some code to get
the HardMargins of the printer using PInvoke on GetDeviceCaps. You can
probably find it in the archives of
microsoft.publi c.dotnet.framew ork.drawing or if you can't find it I can
post it for you. Assuming you have the code to get hard margins the
following works to do the transform if required.
--------------------------------------------------------------------------------------------------
// this is inside a PrintPage call -- all the stock items are setup in
OnBeginPrint
IntPtr hDc = ev.Graphics.Get Hdc();
ev.Graphics.Rel easeHdc(hDc);
float left = 0.0f, right = 0.0f, top = 0.0f, bottom = 0.0f;
PrintUtils.GetH ardMargins(hDc. ToInt32(), ref left, ref top, ref right,
ref bottom);
if (ev.Graphics.Vi sibleClipBounds .Height < 1100.0f)
{
ev.Graphics.Tra nslateTransform (-left, -top);
}
else
{
m_color = true; // printing to screen
ev.Graphics.Tex tRenderingHint =
System.Drawing. Text.TextRender ingHint.AntiAli asGridFit;
}
--------------------------------------------------------------------------------------------------
Note that in FW 2.0 you can get this information using properties of the
Graphics including if the printing is being done to a PrintPreview
without all these calls.
Let me know if you need the GetHardMargins code.
Ron Allen

------------------snip-------------------------------
Nov 17 '05 #7
Thanks,

I got it now. I do a (e.Graphics.Vis ibleClipBounds. Height <
e.PageSettings. PaperSize.Heigh t) check. If true then I'm drawing to the
actual printer, if false I'm drawing to the Print Preview.

If I'm drawing to the Print Preview then I set the left and top margin to
e.MarginBounds (corrected for HardMargins) and if I'm drawing to the actual
Printer I set the left to (e.MarginBounds .Left >=
margins.HardMar ginLeft)?(0):(m argins.HardMarg in) and the top to
(e.MarginBounds .Top >= margins.HardMar ginTop)?(0):(ma rgins.HardMargi nTop).

The above works (Preview and actual Print are correct) but I still think
it's a little bit strange :-(

Thanks again Ron!

Tinus

"Ron Allen" <rallen@_nospam _src-us.com> wrote in message
news:um******** ******@TK2MSFTN GP09.phx.gbl...
Tinus,
I check for in PrintPreview by using the check on
VisibleClipBoun ds.Height in the previous code I sent. When this height is
less than the height of the page which is hardwired at 11" in my example I
then translate the Graphics so that the output origin is at 0,0 on the
page. My example is using the default 100dpi setting for device
coordinates.
I don't normally change the document margins or do any drawing using
OriginAtMargins . I just translate the Graphics appropriately and then
draw in absolute coordinates so that if I specify 0.5"/0.5" that is where
the point will be located. For devices with smaller print areas like some
inkjet printers I also scale the output so that the whole output will fit
in the printable area.

Ron Allen
"Tinus" <no************ ****@xxx.karsse meijer.com.noad v.xxx> wrote in
message news:Oj******** ******@TK2MSFTN GP09.phx.gbl...
Ron,
Thank you. I already found and using your GetDeviceCaps code. Works
perfectly.
The problem is that I have to set the upper left corner always to 0,0
even when I set the upper corner margin to 1" I need to use 0,0. If I
print with margins set to 1" and the rectangle area to (0,0,
MarginBounds.Wi th, MarginBounds.He ight) then the actual printout is
perfect (nice margin of 1" on top and left side). However the Print
Preview is incorrect -> displaying the graphics in the upper most left
corner (due to the 0,0 of the rectangle).

So to solve this I need to check wether I'm in PrintPreview or I'm
actually printing it to the Printer, correct? So this is a bug or
something? And I'm not doing anything wrong?

WHat is the best way to know if I'm drawing to the actual Printer or to
the Print Preview?

Thank you,
Tinus

"Ron Allen" <rallen@_nospam _src-us.com> wrote in message
news:%2******** *******@TK2MSFT NGP15.phx.gbl.. .
Tinus,
I normally find the Hard Margins of the printer and then do a
TranslateTransf orm on the resulting graphics to get the drawing area
setup so that I can specify actual page coordinates. I check to see if
the page is being sent to the printer by checking to see if the
VisibleClipBoun ds.Height of the Graphics is less than the physical page
height and only then apply the transform. I've written some code to get
the HardMargins of the printer using PInvoke on GetDeviceCaps. You can
probably find it in the archives of
microsoft.publi c.dotnet.framew ork.drawing or if you can't find it I can
post it for you. Assuming you have the code to get hard margins the
following works to do the transform if required.
--------------------------------------------------------------------------------------------------
// this is inside a PrintPage call -- all the stock items are setup
in OnBeginPrint
IntPtr hDc = ev.Graphics.Get Hdc();
ev.Graphics.Rel easeHdc(hDc);
float left = 0.0f, right = 0.0f, top = 0.0f, bottom = 0.0f;
PrintUtils.GetH ardMargins(hDc. ToInt32(), ref left, ref top, ref right,
ref bottom);
if (ev.Graphics.Vi sibleClipBounds .Height < 1100.0f)
{
ev.Graphics.Tra nslateTransform (-left, -top);
}
else
{
m_color = true; // printing to screen
ev.Graphics.Tex tRenderingHint =
System.Drawing. Text.TextRender ingHint.AntiAli asGridFit;
}
--------------------------------------------------------------------------------------------------
Note that in FW 2.0 you can get this information using properties of the
Graphics including if the printing is being done to a PrintPreview
without all these calls.
Let me know if you need the GetHardMargins code.
Ron Allen

------------------snip-------------------------------

Nov 17 '05 #8
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

"Tinus" wrote:
So, please let me explain in more detail what is hapening....

Page Setup: all Margins set to 1"
The e.MarginBounds. Left = 100 pixels
The e.MarginBounds. Top = 100 pixels

If I now print a Rectangle using(e.MarginB ounds.Left, ...Top, ...Width,
....Height) then the actual printed margin is +/- 1.8" (so almost double the
size set using the Page Setup dialog).

Using Rons GetDeviceCaps I get a HardMarginLeft: 11 pixels and Top: 13
pixels. So that can not be the problem: 0.8" is not 11 pixels;

If I however set the Margins again to 1" using the PageSetupDialog but draw
a Rectangle using (0, 0, e.MarginBounds. Width, ...Height) then the printout
is correct -> margins on the paper are 1" all around. However the Print
Preview is incorrect showing the draw rectangle in the upper left most
corner due to the (0,0) coordinate.

Hope someone knows what I'm doing wrong :-(

Thanks,
Tinus

"Ron Allen" <rallen@_nospam _src-us.com> wrote in message
news:%2******** *******@TK2MSFT NGP15.phx.gbl.. .
Tinus,
I normally find the Hard Margins of the printer and then do a
TranslateTransf orm on the resulting graphics to get the drawing area setup
so that I can specify actual page coordinates. I check to see if the page
is being sent to the printer by checking to see if the
VisibleClipBoun ds.Height of the Graphics is less than the physical page
height and only then apply the transform. I've written some code to get
the HardMargins of the printer using PInvoke on GetDeviceCaps. You can
probably find it in the archives of
microsoft.publi c.dotnet.framew ork.drawing or if you can't find it I can
post it for you. Assuming you have the code to get hard margins the
following works to do the transform if required.
--------------------------------------------------------------------------------------------------
// this is inside a PrintPage call -- all the stock items are setup in
OnBeginPrint
IntPtr hDc = ev.Graphics.Get Hdc();
ev.Graphics.Rel easeHdc(hDc);
float left = 0.0f, right = 0.0f, top = 0.0f, bottom = 0.0f;
PrintUtils.GetH ardMargins(hDc. ToInt32(), ref left, ref top, ref right,
ref bottom);
if (ev.Graphics.Vi sibleClipBounds .Height < 1100.0f)
{
ev.Graphics.Tra nslateTransform (-left, -top);
}
else
{
m_color = true; // printing to screen
ev.Graphics.Tex tRenderingHint =
System.Drawing. Text.TextRender ingHint.AntiAli asGridFit;
}
--------------------------------------------------------------------------------------------------
Note that in FW 2.0 you can get this information using properties of the
Graphics including if the printing is being done to a PrintPreview without
all these calls.
Let me know if you need the GetHardMargins code.
Ron Allen
"Tinus" <no************ ****@xxx.karsse meijer.com.noad v.xxx> wrote in
message news:uA******** ******@TK2MSFTN GP15.phx.gbl...
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.Wi dth,
MarginBounds.He ight) 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 -



Nov 17 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
4865
by: Jody Gelowitz | last post by:
I am having a problem with printing selected pages. Actually, the problem isn't with printing selected pages as it is more to do with having blank pages print for those pages that have not been selected. For example, if I were to have 5 pages with every second page printing, I would get the following results: Page 1 = Print OK Page 2 = Blank Page 3 = Print OK Page 4 = Blank
0
2304
by: Programatix | last post by:
Hi, I am working on the PrintDocument, PrintDialog, PageSetupDialog and PrintPreviewControl components of Visual Studio .NET 2003. My developement machine is running Windows XP. There are some problems I encountered while using them. Please note that, the Regional and Language setting on my machine is using "Metric" measurement system (where the default is "US"). In this case, the measurement unit is "milimeters" and not "inches".
0
2133
by: Programatix | last post by:
Hi, I am working on the PrintDocument, PrintDialog, PageSetupDialog and PrintPreviewControl components of Visual Studio .NET 2003. My developement machine is running Windows XP. There are some problems I encountered while using them. Please note that, the Regional and Language setting on my machine is using "Metric" measurement system (where the default is "US"). In this case, the measurement unit is "milimeters" and not "inches".
5
2168
by: Mr. B | last post by:
This is driving me NUTZ!!! I've been screwing around on this for a week now. And I have tried to find examples similar to what I have (nada). Got lots of streaming a TXT file... bah! I am really stuck here (probably the ol' Not seeing the tree cause of the forest thingy). But I just can not get this to work. The following is my Test example code. Just needs a Button1 on a blank Form. Add in PrintDocument1, PrintPreviewDialog1,...
2
3476
by: qumpus | last post by:
My program right now generates USPS style shipping label using System.Drawing.Graphics. It works fine except that the printer prints really slowly. I want to make my program take advantage of true type fonts. So I assume it's possible to send Font Type and the text to the printer, and the printer should digest and print faster. Still, barcode info needs to be sent as an image. When I print fifty copies of the same label it prints really...
4
14100
by: iwdu15 | last post by:
can anybody help me print from a rich text box? i tried the way they showed on the MSDN web page, but it did not work. I am using VB.net 2003...any help would be appreciated
3
31985
by: D Witherspoon | last post by:
No matter what I do the default paper size is always either A3 or 11 by 8.5 .. Here is the code. Dim dlg As DialogResult pd.DocumentName = "Weld Image" Dim pkPaperSize As New Printing.PaperSize("sdfgsfdg", 850, 1100)
7
2758
by: tm | last post by:
I am trying to print a form using the following code, everything works fine but the margins are not acted upon. What I am I doing wrong? Private Sub CaptureScreen() Dim myGraphics As Graphics = Me.CreateGraphics() Dim s As Size = Me.Size memoryImage = New Bitmap(s.Width, s.Height, myGraphics) Dim memoryGraphics As Graphics = Graphics.FromImage(memoryImage)
8
9035
by: Frank Rizzo | last post by:
I am trying to print huge images (much bigger than target paper). I try and use e.PageSettings.HardMarginX and e.PageSettings.HardMarginY in the PrintDocument's PrintPage event to try and determine the maximum area that I can print on. However, the edge of the image invariably gets cut off, as if the HardMargin info is wrong. I posted the code below as I can't understand what I am doing wrong. Is information in e.PageSettings reliable?...
0
9923
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
9767
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10807
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10394
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7104
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5774
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5967
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4592
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4190
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.