473,398 Members | 2,120 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

page margin setting

Hi, I am using framework 1.0 to implement a printing
method. The page margins I set won't show correctly on my
print out. The code is:
PageSettings pset=new PageSettings();
pset.Margins =new Margins(10,10,100,100);
printDoc.DefaultPageSettings=pset;

I have seen some explaination about
PrintDocument.OriginAtMargins property. But I am not
using the Framework 1.1. Is this the reason that the page
margins are not correct? Is there a way to implement this
in Framework 1.0?
Thanks.

Holly
Nov 15 '05 #1
1 3752
Holly,
If you are using Framework V1.0 you will have to PInvoke GetDeviceCaps
and retrieve the 'hard margins' of the printer and then compensate for those
when you draw to the printer (I normally just call Graphics.Translate by the
appropriate amounts). A quick a dirty check to see if you are drawing to
the printer vs. a PrintPreviewDialog is to check the VisibleClipBounds. If
this is smaller than the page size you are most likely drawing to the
printer. If you'd like I have some C# code that calls GetDeviceCaps and
returns the page margins. Note that on some printers, mainly inkjets, you
may have to scale the output to get it the same as output to a laser.
Also the margins you are specifying may be too small for the printer as
0.1 inches is outside the printable area on a lot of printers.

Ron Allen
"Holly" <ho*****@mindrenewingmedia.com> wrote in message
news:01****************************@phx.gbl...
Hi, I am using framework 1.0 to implement a printing
method. The page margins I set won't show correctly on my
print out. The code is:
PageSettings pset=new PageSettings();
pset.Margins =new Margins(10,10,100,100);
printDoc.DefaultPageSettings=pset;

I have seen some explaination about
PrintDocument.OriginAtMargins property. But I am not
using the Framework 1.1. Is this the reason that the page
margins are not correct? Is there a way to implement this
in Framework 1.0?
Thanks.

Holly

Nov 15 '05 #2

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

Similar topics

2
by: Jourik Feenstra | last post by:
I'm trying to write a javascript function that 'slides' a page a bit down by retreiving the current top-margin of the body, and then setting it to the old margin + 50px extra.. The problem here...
2
by: Tristan Miller | last post by:
Greetings. I have a two-column web layout, where the first column is just the regular body text with a "marign-right" of 16em, and the second column is an "absolute"-positioned div with a width...
0
by: Nathan | last post by:
Hi, I seem to having a peculiar problem with the display of odd and even pages in XSL-FO. Here is a small background of the problem. My xsl stylesheet mentions my fo:layout-master-set as ...
9
by: Veerle | last post by:
Hi, I would like to divide the whole of my html page in 4 equal rectangles using only div tags in my html. The result should look a bit like this site:...
2
by: Yelena Kaplun | last post by:
Hi, I'm trying to customize print settings while streaming HTML content into Excel. I'm using ASP.NET 1.1 and Excel 2003. While some printer settings like Margins are working correctly, I cannot...
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
2
by: silverbob | last post by:
I have been writing web pages for years using these attributes to the body tag: <body bgcolor=#FFFFFF marginwidth=0 leftmargin=0 marginheight=0 topmargin=0> I'm now attempting to bring my...
8
by: JT | last post by:
Hi, I have done a fair amount of style editing inline in ASP. I'm now using VS 2005 with a standard web project (not Web Application Project). This is my first foray into CSS in a style sheet...
0
by: =?Utf-8?B?V2FubmFiZQ==?= | last post by:
I am creating a webpage and opening it as a Word document. Problem is that as I create one of the questions, some of the text is not appearing in the document as it should. As I step through it, I...
9
by: =?Utf-8?B?Sm9obiBCYWlsZXk=?= | last post by:
I have a ASP .Net page that allows moving around items on the page through javascript. This page works fine in IE. In FireFox however, I have found that if the page is using XHTML 1.0...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...
0
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...
0
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,...

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.