Printing - positioning problem
-
Hello. Printing again. The problem is how to position printer in order to get somehow precise output. For example: How to draw a frame which is equally distant from the edges of a page?, or how to draw division lines: vertical and horizontal in such a way that they divide an a4 page into two parts (more or less equal parts)? At this time beeing I obtained less precise results (still,something is wrong) while using GetDeviceCaps & PHYSICALWIDTH(HEIGHT), PHYSICALOFFSETX(Y), but it produces different outputs (more or less accurate), depending on a printer (hp 1220 and 690). PS. I have also used the pInfo->m_rectDraw rect but, it didn't print out the boundaries (the rectangle was to large to fit the printable area). PLEASE, anyone able to help ?
-
Hello. Printing again. The problem is how to position printer in order to get somehow precise output. For example: How to draw a frame which is equally distant from the edges of a page?, or how to draw division lines: vertical and horizontal in such a way that they divide an a4 page into two parts (more or less equal parts)? At this time beeing I obtained less precise results (still,something is wrong) while using GetDeviceCaps & PHYSICALWIDTH(HEIGHT), PHYSICALOFFSETX(Y), but it produces different outputs (more or less accurate), depending on a printer (hp 1220 and 690). PS. I have also used the pInfo->m_rectDraw rect but, it didn't print out the boundaries (the rectangle was to large to fit the printable area). PLEASE, anyone able to help ?
It will be different depending on the selected printer and the resolution selected on it. You size to the printers parameters. Using GetDeviceCaps gives you all you need to calculate your graphic size or text formating. HORZSIZE Width, in millimeters, of the physical screen. VERTSIZE Height, in millimeters, of the physical screen. NUMFONTS Number of device-specific fonts. Use printer matched fonts if possible (though most are good anyway). ASPECTX Relative width of a device pixel used for line drawing. ASPECTY Relative height of a device pixel used for line drawing. ASPECTXY Diagonal width of the device pixel used for line drawing PHYSICALWIDTH For printing devices: the width of the physical page, in device units. For example, a printer set to print at 600 dpi on 8.5"x11" paper has a physical width value of 5100 device units. Note that the physical page is almost always greater than the printable area of the page, and never smaller. PHYSICALHEIGHT For printing devices: the height of the physical page, in device units. For example, a printer set to print at 600 dpi on 8.5"x11" paper has a physical height value of 6600 device units. Note that the physical page is almost always greater than the printable area of the page, and never smaller. PHYSICALOFFSETX For printing devices: the distance from the left edge of the physical page to the left edge of the printable area, in device units. For example, a printer set to print at 600 dpi on 8.5"x11" paper, that cannot print on the leftmost 0.25" of paper, has a horizontal physical offset of 150 device units. PHYSICALOFFSETY For printing devices: the distance from the top edge of the physical page to the top edge of the printable area, in device units. For example, a printer set to print at 600 dpi on 8.5"x11" paper, that cannot print on the topmost 0.5" of paper, has a vertical physical offset of 300 device units If your using the CPrintDialog then LPDEVMODE GetDevMode( ) will get you all the information you want in one go. But the point is, that you must scale to printed page in much the same way as you do for the screen and each of its modes. Experiment with the DEVMODE structure, what you will find is that you can scale text/graphics by the pel size, so that with a function such as (xpos-ypos in mm or points) PrintMyTextOnPaperAndBanLongFunctionNamesToo(xpos,ypos,LPCTSTR Text) You can get accurate printing to 1/10th mm We do it for the joy of seeing the users struggle.