Hi Tom,
If we use this code
Dim p As New PrinterSettings()
For Each s As String In PrinterSettings.InstalledPrinters
p.PrinterName = s
MsgBox(p.DefaultPageSettings.PrintableArea.ToString)
Next
we will get each printer's default settings.
and if use
p.DefaultPageSettings.Margins.ToString
then this will give margins we can see in the print preview.
So if printer's default physical margin is 0 then we will not get any
difference between print preview and the printed page.
But if printer's default left physical margin is 17 (hundredth of inch) then
it will add extra 0.17 inch (0.43 cm) in addition to the left margin that we
set for the report.
--
Osmotion Blue
:
Mark ha scritto:
Hi Tom,
Thanks for reply
Using the code u sent sets the margins that we can see in print preview but
the physical margins of printer will be added to this margins. So I need to
change printer's physical margins by VB coding.
make sure to set the also the right page size. There is no such a thing
like
"margins are added".
Another problem is that I am creating PrintDocument object but I am using
report viewer's print button to display print dialogue. I do not have any
idea how to handle this type of situation.
Never used report viewer. Be more specific: someone else may help you
Any idea?
--
Osmotion Blue
:
You can use the margin property of
PrintDocument.DefaultPageSettings
PrintDocument.DefaultPageSettings.Margins.Top = ...
(hundredths of an inch)
PrintDocument.DefaultPageSettings.Margins.Bottom = ...
PrintDocument.DefaultPageSettings.Margins.Left = ...
PrintDocument.DefaultPageSettings.Margins.Right = ...
(Imports System.Drawing.Printing)
http://msdn2.microsoft.com/en-us/library/system.drawing.printing.margins_members(d=ide).aspx
-tom
Mark ha scritto:
Hi,
I am creating application in VB 2005. and when I print report it adds extra
0.45 cm margin on left and top, and the reason for this is physical margins
of printer.
Is it possible to change printer's physical margins using VB coding?
Cheers