Measurement Unit problem with Printing.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have a problem where documents sent to the print spooler with a custom
page size are ignoring the regional settings for the Measurement Unit. I
have my Regional Settings set to "English (United States)" and confirmed that
the Measurement Unit is "U.S". When I print my 4"w x 2"h label (using a
custom paper size I set in my code as 400w x 200h (tenths of an inch)), it
converts to tenths of a millimeter, resulting in a page size of 1.47"w x
0.79"h.

I have tried checking the System.Globalization.RegionInfo.IsMetric in my
code, and it returns False, as expected.

Anyone have any idea why this is happening, and how I can correct the problem?

Thanks very much.

Alex
 
AFAIK The printer sizes are always returned in 100ths of an inch. Thats why
they are 800 * 1100 for a "standard" page.

To get the true dimensions of the printer page you need to do a bit of math
with the print page size and the DPI reported by the Graphics object.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 
Yes, I understand that part. The paper size seems to work fine on most of
our systems, however, we have a couple of systems where it seems to be
interpeting the page size values as 10ths of a millimeter instead of 100ths
of an inch, which you stated should always be in 100ths of an inch.

As a test, I've used the PrinterUnitConvert method to convert the page size
values from 100ths of an inch to 10ths of a millimeter, and pass in the
converted values, and the page size is then correct on the problem systems.

I would be fine with converting as necessary, except I can't find a way to
determine which measurement unit I should convert to.
System.Globalization.RegionInfo.IsMetric is returning false on the problem
systems, yet it is still interpreting the page size values as 10ths of a
millimeter.

I have also tried getting the graphics object from the pagesettings object,
and testing the GraphicsUnit member, which returns "Display", which I believe
means 100ths of an inch.

I would really appreciate any further assistance with this issue.

Thanks again!
 
Back
Top