Solved

Setting Printer Margins

Posted on 1997-04-23
1
280 Views
Last Modified: 2013-11-20
When I print a document, MFC changes the origion of the device context to the printable area of a page.  The problem is I can't figure out what this origion is.  Point (0, 0) doesn't refer to the top, left corner of the page.  I've tried using all the CDC Mapping Functions, GetWindowOrg(), GetViewportOrg(), etc, to determine what the origion is set at but they don't appear to return the correct value.
0
Comment
Question by:blaster
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 1

Accepted Solution

by:
jmmougeolle earned 100 total points
ID: 1301175
In the CView::OnBeginPrinting(CDC *pDC, CPrintInfo * pInfo)

you could retrieve the margin values from the CDC::Escape method, calling it in that way:

      CPoint      ptPageStart;
      pDC->Escape( GETPRINTINGOFFSET,
                                        0, NULL,
                                        (LPSTR) &ptPageStart);

GetWindowOrg, and GetViewportOrg, don't take in account this margine, and are only referring to the drawable Area.

In that way, the 0,0 origin corresponds to the marginX, marginY point from the Left Top Paper Corner (If you don't change the MapMode)

0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question