473,566 Members | 2,784 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Printing: preview perfect, printout misaligned

Tim
Hi,

I have created some code for printing a column report. The default page size
is 850 x 1100, which is correct. The print preview looks perfect. The data
is positioned exactly where it should be. (centered)

When I go to print however, the data is shifted to the right. About a
margin's worth. I set the margins at 50 and it looks like it is at 100.

I checked the code and the starting X position is at 50. So why is it
printing misaligned?

Can anyone offer any suggestions? I am printing on an 8.5 X 11 sheet of
paper on a laser printer. I have tried it on a different printer with the
same results.

Thanks

Tim
Nov 17 '05 #1
2 2190
Tim,
You have encountered the 'hard' margins of the printer. Basically the
drawing area on the printer is starting at the top/left hard margin instead
of the paper's top left when output is to the printer. Search for
GetHardMargins in microsoft.publi c.dotnet.framew ork.drawing to find a
function to load these margins. You can then compensate for this by calling
TranslateTransf orm on the Graphics with the negative of the margin values
and things will work the same.
If you can't find the code (or can only find a VB.NET versioin) I can
post it here again.

Ron Allen
"Tim" <ti*@home.com > wrote in message
news:JJ******** ***********@new s20.bellglobal. com...
Hi,

I have created some code for printing a column report. The default page
size is 850 x 1100, which is correct. The print preview looks perfect. The
data is positioned exactly where it should be. (centered)

When I go to print however, the data is shifted to the right. About a
margin's worth. I set the margins at 50 and it looks like it is at 100.

I checked the code and the starting X position is at 50. So why is it
printing misaligned?

Can anyone offer any suggestions? I am printing on an 8.5 X 11 sheet of
paper on a laser printer. I have tried it on a different printer with the
same results.

Thanks

Tim

Nov 17 '05 #2
Tim
Thanks Ron,

I am looking into it now. I have found some code and I am trying it out...

Tim

"Ron Allen" <rallen@_nospam _src-us.com> wrote in message
news:Oj******** *****@TK2MSFTNG P11.phx.gbl...
Tim,
You have encountered the 'hard' margins of the printer. Basically the
drawing area on the printer is starting at the top/left hard margin
instead of the paper's top left when output is to the printer. Search for
GetHardMargins in microsoft.publi c.dotnet.framew ork.drawing to find a
function to load these margins. You can then compensate for this by
calling TranslateTransf orm on the Graphics with the negative of the margin
values and things will work the same.
If you can't find the code (or can only find a VB.NET versioin) I can
post it here again.

Ron Allen
"Tim" <ti*@home.com > wrote in message
news:JJ******** ***********@new s20.bellglobal. com...
Hi,

I have created some code for printing a column report. The default page
size is 850 x 1100, which is correct. The print preview looks perfect.
The data is positioned exactly where it should be. (centered)

When I go to print however, the data is shifted to the right. About a
margin's worth. I set the margins at 50 and it looks like it is at 100.

I checked the code and the starting X position is at 50. So why is it
printing misaligned?

Can anyone offer any suggestions? I am printing on an 8.5 X 11 sheet of
paper on a laser printer. I have tried it on a different printer with the
same results.

Thanks

Tim


Nov 17 '05 #3

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

Similar topics

10
4945
by: Mario | last post by:
Hello all, I'm trying hard to make possible to print some simple text from python to the default printer using wxPython, after days of internet searches I found this page: http://wiki.wxpython.org/index.cgi/Printing but is impossible to use this script even if I do exactly as said there. I think the script is buggy or I am not able to use it,...
5
3321
by: Stefania Scott | last post by:
I am trying to print a word document from Access. The code I've written works well in my computer but does not in the one were it is needed. Here the piece of code: 'doc path strObjectPath = "P:\2004worksheets\IIS_WS.doc" Set oWord = New Word.Application oWord.Documents.Add (strObjectPath) oWord.PrintOut
3
2391
by: David | last post by:
Hello, hope someone can help. I have a request to print word .doc check lists with selected records in Access for surgery procedure cards. I have hyperlinked the word doc's to a field in each record, but do not know how to write the code to open the word doc and print it. I assume this code should be put in the list box print button. As you...
0
1495
by: Karthik | last post by:
Well I am coding an application using C# for my company which requires multiple printing of Crystal Report Docs & Word Docs, at a specific Printer of the installed Printers in the network, at a specific tray and some more settings too. since I'm trying with the network printer I've installed a local driver using the local port as suggested by...
8
9597
by: Tinus | last post by:
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...
4
2065
by: scorpion53061 | last post by:
I have my Word document being created in a seperate thread. THe applicaiton is not visible. The end user can choose to view the document upon completion or just have it print. Viewing is fine. If htey choose to "just print it" it seems ot ignore this command:
3
5045
by: =?Utf-8?B?QnJpYW4gQ29vaw==?= | last post by:
Is there a way to force printing in black and white programatically?
3
6532
by: franc sutherland | last post by:
Hi, Is there a way to make a report print out more than once using the VBA code behind a button, without having to put the code in multiple times? I want to print out the same report four times, with page 1 of 4 through to 4 of 4 in the footer. Can anyone help?
0
2828
it0ny
by: it0ny | last post by:
Hi guys, thanks I am fairly new to this forum so I hope I chose the right place to post this question. I try to make my program printout a deposit's report. I created a class to store the printing printing data and the actual database data in a recordset. the class looks like this: Public Class BRPDD 'Balance Report PrintingDocument Data ...
0
7666
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...
0
7888
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7644
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...
0
7951
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...
0
6260
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5213
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...
0
3643
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...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
925
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.