Welcome to WinForumz.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Print Preview=GOOD, Printout=BAD

 
   Win 2000/NT/98/ME (Home) -> Print RSS
Next:  REGISTRY MECHANIC?????  
Author Message
Devin Dow

External


Since: Oct 15, 2005
Posts: 1



(Msg. 1) Posted: Sat Oct 15, 2005 3:17 pm
Post subject: Print Preview=GOOD, Printout=BAD
Archived from groups: microsoft>public>dotnet>general, others (more info?)

Print Preview looks perfect, but the Printout is cut off (extends off
the page).

Has anyone else experienced this? A3 paper size seems to exacerbate the
problem.

I can't believe it because the same code is executed with the same exact
values when Printing and doing Print Preview.

I've seen something like this in old Win32 programming caused by bad
Printer Drivers, but that does not seem to be the case here.


Devin Dow
Router Solutions Incorporated
Devin.Dow RemoveThis @rsi-inc.com

 >> Stay informed about: Print Preview=GOOD, Printout=BAD 
Back to top
Login to vote
Ron Allen

External


Since: Oct 17, 2005
Posts: 3



(Msg. 2) Posted: Mon Oct 17, 2005 8:58 am
Post subject: Re: Print Preview=GOOD, Printout=BAD [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Devin,
My guess would be that you are seeing the effect of the printer's 'hard
margins'. Using FW 1.x the origin of the print area for print preview is
0,0 of the bitmap but for the printer it is x,y where x and y are the
printer's hard margins respectively. You can search for GetHardMargins in
this ng to see some code to get around this. This is basically PInvoke on
GetDeviceCaps to get the margins followed by a TranslateTransform on the
Graphics.
I normally check to see if this needs to be done by checking the
VisibleClipBounds for the Graphics and do the transform if the Height/Width
of this is less than the page size.

If you can't find the actual code reply here and I'll post it again
(C#). If you are using VB.Net look in microsoft.public.dotnet.languages.vb
for a translation.

Ron Allen

"Devin Dow" <Devin.Dow.DeleteThis@rsi-inc.com> wrote in message
news:ehBaVYd0FHA.3812@TK2MSFTNGP09.phx.gbl...
> Print Preview looks perfect, but the Printout is cut off (extends off the
> page).
>
> Has anyone else experienced this? A3 paper size seems to exacerbate the
> problem.
>
> I can't believe it because the same code is executed with the same exact
> values when Printing and doing Print Preview.
>
> I've seen something like this in old Win32 programming caused by bad
> Printer Drivers, but that does not seem to be the case here.
>
>
> Devin Dow
> Router Solutions Incorporated
> Devin.Dow.DeleteThis@rsi-inc.com
>
>

 >> Stay informed about: Print Preview=GOOD, Printout=BAD 
Back to top
Login to vote
Jason Newell

External


Since: May 16, 2005
Posts: 2



(Msg. 3) Posted: Tue Oct 18, 2005 4:10 pm
Post subject: Re: Print Preview=GOOD, Printout=BAD [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Ron,

If you don't mind, will you go ahead and post your code. I think I
might be needing to do something similar in the next few weeks and it
may save me some time. Thanks a lot.

Jason Newell


Ron Allen wrote:
> Devin,
> My guess would be that you are seeing the effect of the printer's 'hard
> margins'. Using FW 1.x the origin of the print area for print preview is
> 0,0 of the bitmap but for the printer it is x,y where x and y are the
> printer's hard margins respectively. You can search for GetHardMargins in
> this ng to see some code to get around this. This is basically PInvoke on
> GetDeviceCaps to get the margins followed by a TranslateTransform on the
> Graphics.
> I normally check to see if this needs to be done by checking the
> VisibleClipBounds for the Graphics and do the transform if the Height/Width
> of this is less than the page size.
>
> If you can't find the actual code reply here and I'll post it again
> (C#). If you are using VB.Net look in microsoft.public.dotnet.languages.vb
> for a translation.
>
> Ron Allen
>
> "Devin Dow" <Devin.Dow.TakeThisOut@rsi-inc.com> wrote in message
> news:ehBaVYd0FHA.3812@TK2MSFTNGP09.phx.gbl...
>
>>Print Preview looks perfect, but the Printout is cut off (extends off the
>>page).
>>
>>Has anyone else experienced this? A3 paper size seems to exacerbate the
>>problem.
>>
>>I can't believe it because the same code is executed with the same exact
>>values when Printing and doing Print Preview.
>>
>>I've seen something like this in old Win32 programming caused by bad
>>Printer Drivers, but that does not seem to be the case here.
>>
>>
>>Devin Dow
>>Router Solutions Incorporated
>>Devin.Dow@rsi-inc.com
>>
>>
>
>
>
 >> Stay informed about: Print Preview=GOOD, Printout=BAD 
Back to top
Login to vote
Ron Allen

External


Since: Oct 17, 2005
Posts: 3



(Msg. 4) Posted: Fri Oct 21, 2005 9:04 am
Post subject: Re: Print Preview=GOOD, Printout=BAD [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Jason,
Here is the code. Modify as desired. NOTE: I took out a lot of <summary>
blocks that make the constants compile without warnings. They just said the
same thing as the comments at the end.
====================snip=======================
namespace RLA.GetCaps
{
using System;
using System.Runtime.InteropServices;


/// <summary>
/// GetDeviceCaps and associated calls/values
/// </summary>
/// <remarks>
/// Use as desired. No warranties implied.
/// RLA 7/3/2002
/// </remarks>
public class GetDevCaps
{
#region "Device Parameters"
/* Device Parameters for GetDeviceCaps() */

public static short DRIVERVERSION = 0; // Device driver version
public static short TECHNOLOGY = 2; // Device classification
public static short HORZSIZE = 4; // Horizontal size in
millimeters
public static short VERTSIZE = 6; // Vertical size in millimeters
public static short HORZRES = 8; // Horizontal width in pixels
public static short VERTRES = 10; // Vertical height in pixels
public static short BITSPIXEL = 12; // Number of bits per pixel
public static short PLANES = 14; // Number of planes
public static short NUMBRUSHES = 16; // Number of brushes the device
has
public static short NUMPENS = 18; // Number of pens the device
has
public static short NUMMARKERS = 20; // Number of markers the device
has
public static short NUMFONTS = 22; // Number of fonts the device
has
public static short NUMCOLORS = 24; // Number of colors the device
supports
public static short PDEVICESIZE = 26; // Size required for device
descriptor
public static short CURVECAPS = 28; // Curve capibilities
public static short LINECAPS = 30; // Line capibilities
public static short POLYGONALCAPS = 32; // Polygonal capibilities
public static short TEXTCAPS = 34; // Text capibilities
public static short CLIPCAPS = 36; // Clipping capibilities
public static short RASTERCAPS = 38; // Bitblt capibilities
public static short ASPECTX = 40; // Length of the X leg
public static short ASPECTY = 42; // Length of the Y leg
public static short ASPECTXY = 44; // Length of the hypotenuse
public static short PHYSICALWIDTH = 110; // Physical Width in device
units
public static short PHYSICALHEIGHT = 111; // Physical Height in device
units
public static short PHYSICALOFFSETX = 112; // Physical Printable Area x
margin
public static short PHYSICALOFFSETY = 113; // Physical Printable Area y
margin
public static short SCALINGFACTORX = 114; // Scaling factor x
public static short SCALINGFACTORY = 115; // Scaling factor y
#endregion
public static float TwipsPerInch = 1440.0f;
public static float InchesPerTwip = 1.0f / TwipsPerInch;
public static float PointsPerInch = 72.0f;
public static float InchesPerPoint = 1.0f / PointsPerInch;

/// <summary>
/// Call the GetDeviceCaps Win32 method
/// </summary>
[DllImport("gdi32.dll")]
public static extern Int16 GetDeviceCaps(
[In] [MarshalAs (UnmanagedType.U4)] int hDc,
[In] [MarshalAs (UnmanagedType.U2)] Int16 funct);


/// <summary>
/// Return the device 'hard' margins for the passed in
/// Device Context handle. Return data in 1/100ths inch
/// </summary>
/// <param name="hDc">Input handle</param>
/// <param name="left">output left margin in 1/100ths inch</param>
/// <param name="top">output top margin in 1/100ths inch</param>
/// <param name="right">output right margin in 1/100ths inch</param>
/// <param name="bottom">output bottom margin in 1/100ths inch</param>
public static void GetHardMargins(int hDc, ref float left, ref float top,
ref float right, ref float bottom)
{
float offx = Convert.ToSingle(GetDeviceCaps(hDc, PHYSICALOFFSETX));
float offy = Convert.ToSingle(GetDeviceCaps(hDc, PHYSICALOFFSETY));;
float resx = Convert.ToSingle(GetDeviceCaps(hDc, HORZRES));
float resy = Convert.ToSingle(GetDeviceCaps(hDc, VERTRES));
float hsz = Convert.ToSingle(GetDeviceCaps(hDc, HORZSIZE))/25.4f; //
screen width in inches
float vsz = Convert.ToSingle(GetDeviceCaps(hDc, VERTSIZE))/25.4f; //
screen height in inches
float ppix = resx/hsz;
float ppiy = resy/vsz;
left = (offx/ppix) * 100.0f;
top = (offy/ppix) * 100.0f;
bottom = top + (vsz * 100.0f);
right = left + (hsz * 100.0f);
}
}
}
========================snip==========================
"Jason Newell" <nospam.DeleteThis@nospam.com> wrote in message
news:euZIihC1FHA.3820@TK2MSFTNGP10.phx.gbl...
> Ron,
>
> If you don't mind, will you go ahead and post your code. I think I might
> be needing to do something similar in the next few weeks and it may save
> me some time. Thanks a lot.
>
> Jason Newell
>
>
> Ron Allen wrote:
>> Devin,
>> My guess would be that you are seeing the effect of the printer's
>> 'hard margins'. Using FW 1.x the origin of the print area for print
>> preview is 0,0 of the bitmap but for the printer it is x,y where x and y
>> are the printer's hard margins respectively. You can search for
>> GetHardMargins in this ng to see some code to get around this. This is
>> basically PInvoke on GetDeviceCaps to get the margins followed by a
>> TranslateTransform on the Graphics.
>> I normally check to see if this needs to be done by checking the
>> VisibleClipBounds for the Graphics and do the transform if the
>> Height/Width of this is less than the page size.
>>
>> If you can't find the actual code reply here and I'll post it again
>> (C#). If you are using VB.Net look in
>> microsoft.public.dotnet.languages.vb for a translation.
>>
>> Ron Allen
>>
------------------snip==============
 >> Stay informed about: Print Preview=GOOD, Printout=BAD 
Back to top
Login to vote
Jason Newell

External


Since: May 16, 2005
Posts: 2



(Msg. 5) Posted: Fri Oct 21, 2005 11:42 am
Post subject: Re: Print Preview=GOOD, Printout=BAD [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Ron,

Thank you very much. I saved your code and will evaluate it when I get
to the printing part of my application. Thanks again!

Jason Newell


Ron Allen wrote:
> Jason,
> Here is the code. Modify as desired. NOTE: I took out a lot of <summary>
> blocks that make the constants compile without warnings. They just said the
> same thing as the comments at the end.
> ====================snip=======================
> namespace RLA.GetCaps
> {
> using System;
> using System.Runtime.InteropServices;
>
>
> /// <summary>
> /// GetDeviceCaps and associated calls/values
> /// </summary>
> /// <remarks>
> /// Use as desired. No warranties implied.
> /// RLA 7/3/2002
> /// </remarks>
> public class GetDevCaps
> {
> #region "Device Parameters"
> /* Device Parameters for GetDeviceCaps() */
>
> public static short DRIVERVERSION = 0; // Device driver version
> public static short TECHNOLOGY = 2; // Device classification
> public static short HORZSIZE = 4; // Horizontal size in
> millimeters
> public static short VERTSIZE = 6; // Vertical size in millimeters
> public static short HORZRES = 8; // Horizontal width in pixels
> public static short VERTRES = 10; // Vertical height in pixels
> public static short BITSPIXEL = 12; // Number of bits per pixel
> public static short PLANES = 14; // Number of planes
> public static short NUMBRUSHES = 16; // Number of brushes the device
> has
> public static short NUMPENS = 18; // Number of pens the device
> has
> public static short NUMMARKERS = 20; // Number of markers the device
> has
> public static short NUMFONTS = 22; // Number of fonts the device
> has
> public static short NUMCOLORS = 24; // Number of colors the device
> supports
> public static short PDEVICESIZE = 26; // Size required for device
> descriptor
> public static short CURVECAPS = 28; // Curve capibilities
> public static short LINECAPS = 30; // Line capibilities
> public static short POLYGONALCAPS = 32; // Polygonal capibilities
> public static short TEXTCAPS = 34; // Text capibilities
> public static short CLIPCAPS = 36; // Clipping capibilities
> public static short RASTERCAPS = 38; // Bitblt capibilities
> public static short ASPECTX = 40; // Length of the X leg
> public static short ASPECTY = 42; // Length of the Y leg
> public static short ASPECTXY = 44; // Length of the hypotenuse
> public static short PHYSICALWIDTH = 110; // Physical Width in device
> units
> public static short PHYSICALHEIGHT = 111; // Physical Height in device
> units
> public static short PHYSICALOFFSETX = 112; // Physical Printable Area x
> margin
> public static short PHYSICALOFFSETY = 113; // Physical Printable Area y
> margin
> public static short SCALINGFACTORX = 114; // Scaling factor x
> public static short SCALINGFACTORY = 115; // Scaling factor y
> #endregion
> public static float TwipsPerInch = 1440.0f;
> public static float InchesPerTwip = 1.0f / TwipsPerInch;
> public static float PointsPerInch = 72.0f;
> public static float InchesPerPoint = 1.0f / PointsPerInch;
>
> /// <summary>
> /// Call the GetDeviceCaps Win32 method
> /// </summary>
> [DllImport("gdi32.dll")]
> public static extern Int16 GetDeviceCaps(
> [In] [MarshalAs (UnmanagedType.U4)] int hDc,
> [In] [MarshalAs (UnmanagedType.U2)] Int16 funct);
>
>
> /// <summary>
> /// Return the device 'hard' margins for the passed in
> /// Device Context handle. Return data in 1/100ths inch
> /// </summary>
> /// <param name="hDc">Input handle</param>
> /// <param name="left">output left margin in 1/100ths inch</param>
> /// <param name="top">output top margin in 1/100ths inch</param>
> /// <param name="right">output right margin in 1/100ths inch</param>
> /// <param name="bottom">output bottom margin in 1/100ths inch</param>
> public static void GetHardMargins(int hDc, ref float left, ref float top,
> ref float right, ref float bottom)
> {
> float offx = Convert.ToSingle(GetDeviceCaps(hDc, PHYSICALOFFSETX));
> float offy = Convert.ToSingle(GetDeviceCaps(hDc, PHYSICALOFFSETY));;
> float resx = Convert.ToSingle(GetDeviceCaps(hDc, HORZRES));
> float resy = Convert.ToSingle(GetDeviceCaps(hDc, VERTRES));
> float hsz = Convert.ToSingle(GetDeviceCaps(hDc, HORZSIZE))/25.4f; //
> screen width in inches
> float vsz = Convert.ToSingle(GetDeviceCaps(hDc, VERTSIZE))/25.4f; //
> screen height in inches
> float ppix = resx/hsz;
> float ppiy = resy/vsz;
> left = (offx/ppix) * 100.0f;
> top = (offy/ppix) * 100.0f;
> bottom = top + (vsz * 100.0f);
> right = left + (hsz * 100.0f);
> }
> }
> }
> ========================snip==========================
> "Jason Newell" <nospam.DeleteThis@nospam.com> wrote in message
> news:euZIihC1FHA.3820@TK2MSFTNGP10.phx.gbl...
>
>>Ron,
>>
>>If you don't mind, will you go ahead and post your code. I think I might
>>be needing to do something similar in the next few weeks and it may save
>>me some time. Thanks a lot.
>>
>>Jason Newell
>>
>>
>>Ron Allen wrote:
>>
>>>Devin,
>>> My guess would be that you are seeing the effect of the printer's
>>>'hard margins'. Using FW 1.x the origin of the print area for print
>>>preview is 0,0 of the bitmap but for the printer it is x,y where x and y
>>>are the printer's hard margins respectively. You can search for
>>>GetHardMargins in this ng to see some code to get around this. This is
>>>basically PInvoke on GetDeviceCaps to get the margins followed by a
>>>TranslateTransform on the Graphics.
>>> I normally check to see if this needs to be done by checking the
>>>VisibleClipBounds for the Graphics and do the transform if the
>>>Height/Width of this is less than the page size.
>>>
>>> If you can't find the actual code reply here and I'll post it again
>>>(C#). If you are using VB.Net look in
>>>microsoft.public.dotnet.languages.vb for a translation.
>>>
>>>Ron Allen
>>>
>
> ------------------snip==============
>
>
 >> Stay informed about: Print Preview=GOOD, Printout=BAD 
Back to top
Login to vote
Ron Allen

External


Since: Oct 17, 2005
Posts: 3



(Msg. 6) Posted: Sat Oct 22, 2005 11:14 am
Post subject: Re: Print Preview=GOOD, Printout=BAD [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Jason,
Note that you won't need this for FW 2.0 as you can get all these things
directly from the PrintDocument or Graphics with 2.0.

Ron Allen
"Jason Newell" <nospam.DeleteThis@nospam.com> wrote in message
news:OdTPe5l1FHA.2212@TK2MSFTNGP15.phx.gbl...
> Ron,
>
> Thank you very much. I saved your code and will evaluate it when I get to
> the printing part of my application. Thanks again!
>
> Jason Newell
>
>
> Ron Allen wrote:
>> Jason,
>> Here is the code. Modify as desired. NOTE: I took out a lot of <summary>
>> blocks that make the constants compile without warnings. They just said
>> the same thing as the comments at the end.
>> ====================snip=======================
 >> Stay informed about: Print Preview=GOOD, Printout=BAD 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Print problem - Does anyone know what would be causing the following problem. 'Error when writing to HPlaserjet. The network connection could not be found'. This is a network print server. All printers are pinging. Restarted spooler with no errors. It is an..

Windowws 2000 not able to print Landscape on NT queue - Hi, I have an NT queue which recently I tried accessing using a windows 2000 workstation. I am able to print portrait but not landscape. Can anybody help?

Saving Print Server Printers to Transfer to 2000 Server - .. - I have a Windows NT Server that I am planning on decommissioning and replacing with a Windows 2000/2003 Server. My problem is that I have approx. 150 printers configured for our facility and don't want to have to recreate them all on the new server..

Add Printer Wizard Problem - Hello, When I try to add a new printer using Add Printer Wizard, the "My Computer" option is greyed out, leaving only the "Network Printer Server" option available. Please help. Bong.

Sharing a printer on NT4 - Was trying to install the driver for an Epson LQ2090 until it asked for a file rasdd.dll which was on the NT CD. Stupid me, I installed the NT CD and restarted the server. After I restarted none of my colleagues could print. Went to check the printer....
   Win 2000/NT/98/ME (Home) -> Print All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum

Categories:
 Windows XP
 Windows Vista!
  Win 2000/NT/98/ME


[ Contact us | Terms of Service/Privacy Policy ]