473,779 Members | 2,016 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Pixels per Inch

I have to create some vertical text for a web page that allows users
to print to labels. We decided to do this by creating an <imgtag on
the web page and having the src attribute point to another ASP.NET
page that generates the image on the fly and streams it back to the
browser. It works fine, but I'm worried about sizing issues. The image
has to be a specific height and width to fit properly onto the label.
The constructor for the Drawing.Bitmap class (which is what we're
using to generate the image) takes pixels as arguments, not inches or
any "real" measurements. I don' t think that pixels are absolute
measurements of length are they? I think they differ in size between
platforms and maybe even monitors.

Since it's a web page, we can't rely on any particular browser or
platform. I could set the width and height attributes on the <imgtag
but that can stretch the image and make the text hard to read. I could
also put the <imgtag into a <divof fixed size but that may cut off
parts of the image if it ends up being too big. I'd rather have a way
for the browser to tell the image generating page how many pixels per
inch it can handle. I'm not sure if you can get that kind of data from
the browser, but that would probably work if we could.

Any suggestions would be appreciated.

Thanks,
Dave
Dec 4 '07 #1
3 3137
>I could
>also put the <imgtag into a <divof fixed size but that >may cut off
parts of the image if it ends up being too big.

u could set the img width to be 100% width&height of the div container
using some css


On Dec 4, 8:19 am, headware <david.k.l...@g mail.comwrote:
I have to create some vertical text for a web page that allows users
to print to labels. We decided to do this by creating an <imgtag on
the web page and having the src attribute point to another ASP.NET
page that generates the image on the fly and streams it back to the
browser. It works fine, but I'm worried about sizing issues. The image
has to be a specific height and width to fit properly onto the label.
The constructor for the Drawing.Bitmap class (which is what we're
using to generate the image) takes pixels as arguments, not inches or
any "real" measurements. I don' t think that pixels are absolute
measurements of length are they? I think they differ in size between
platforms and maybe even monitors.

Since it's a web page, we can't rely on any particular browser or
platform. I could set the width and height attributes on the <imgtag
but that can stretch the image and make the text hard to read. I could
also put the <imgtag into a <divof fixed size but that may cut off
parts of the image if it ends up being too big. I'd rather have a way
for the browser to tell the image generating page how many pixels per
inch it can handle. I'm not sure if you can get that kind of data from
the browser, but that would probably work if we could.

Any suggestions would be appreciated.

Thanks,
Dave
Dec 4 '07 #2
you can specify the image size in points (about 72 points/inch) which
will transfer to the printer correctly. the browser will scale it, just
be sure you have enough resolution.

-- bruce (sqlwork.com)
headware wrote:
I have to create some vertical text for a web page that allows users
to print to labels. We decided to do this by creating an <imgtag on
the web page and having the src attribute point to another ASP.NET
page that generates the image on the fly and streams it back to the
browser. It works fine, but I'm worried about sizing issues. The image
has to be a specific height and width to fit properly onto the label.
The constructor for the Drawing.Bitmap class (which is what we're
using to generate the image) takes pixels as arguments, not inches or
any "real" measurements. I don' t think that pixels are absolute
measurements of length are they? I think they differ in size between
platforms and maybe even monitors.

Since it's a web page, we can't rely on any particular browser or
platform. I could set the width and height attributes on the <imgtag
but that can stretch the image and make the text hard to read. I could
also put the <imgtag into a <divof fixed size but that may cut off
parts of the image if it ends up being too big. I'd rather have a way
for the browser to tell the image generating page how many pixels per
inch it can handle. I'm not sure if you can get that kind of data from
the browser, but that would probably work if we could.

Any suggestions would be appreciated.

Thanks,
Dave
Dec 4 '07 #3
On Dec 4, 1:37 am, bruce barker <nos...@nospam. comwrote:
you can specify the image size in points (about 72 points/inch) which
will transfer to the printer correctly. the browser will scale it, just
be sure you have enough resolution.

-- bruce (sqlwork.com)

headware wrote:
I have to create some vertical text for a web page that allows users
to print to labels. We decided to do this by creating an <imgtag on
the web page and having the src attribute point to another ASP.NET
page that generates the image on the fly and streams it back to the
browser. It works fine, but I'm worried about sizing issues. The image
has to be a specific height and width to fit properly onto the label.
The constructor for the Drawing.Bitmap class (which is what we're
using to generate the image) takes pixels as arguments, not inches or
any "real" measurements. I don' t think that pixels are absolute
measurements of length are they? I think they differ in size between
platforms and maybe even monitors.
Since it's a web page, we can't rely on any particular browser or
platform. I could set the width and height attributes on the <imgtag
but that can stretch the image and make the text hard to read. I could
also put the <imgtag into a <divof fixed size but that may cut off
parts of the image if it ends up being too big. I'd rather have a way
for the browser to tell the image generating page how many pixels per
inch it can handle. I'm not sure if you can get that kind of data from
the browser, but that would probably work if we could.
Any suggestions would be appreciated.
Thanks,
Dave
Thanks for the response Bruce. By "point" do you mean pixel? I've read
that the pixels per inch number is not an industry constant. In other
words, 72 pixels does not always equate to 1 inch. I'm pretty confused
about the whole subject and it seems to be hard to find good
information on it. This can't be the first time somebody needed to
print something from a web browser in a precise, reproduceable way.
How do people solve this problem? Is there even a problem to begin
with?
Dec 4 '07 #4

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

Similar topics

2
8402
by: duikboot | last post by:
Hi there, In Photoshop I can, when I want to change the dpi(dots per inch) of a picture, arrange that the picture won't be resized. Do you know of a way, I can accomplish this in python with PIL? If I use this script it changes the dpi, but the picture becomes huge. Thanks Arjen
4
2466
by: nutso fasst | last post by:
window.getComputedStyle() is no good in MSIE. Is there a way to determine the pixel size of the default (or user-specified) font for BODY in IE? Thanks, nf
1
6421
by: cefrancke | last post by:
I've been working with the Twips/Pixel issue and after reviewing the Acc.Dev.Hnd book and the groups, the standard seems to be ... 640x480 15 Twips/Pixel 800x600 12 Twips/Pixel 1024x768 12 Twips/Pixel 1280x1024 12 Twips/Pixel Some sources even say all resolutions other than 640x480 have 12
6
2986
by: Craig Parsons | last post by:
Folks, I have an image of a circle, which I am trying to straighten out into a flat line. I am essentially wanting to look at the image, and read a straight line from the centre, and then plot this on a graph. Then I want to rotate the image 1 degree and read the next line down, if you see what I mean. My question is, how do I determine how many pixels wide I should read, in order not to miss anything out? IE: If I rotate it 1...
13
23278
by: T.Jackson | last post by:
Hi guys, Does anyone know the conversions for the above (relationship between each of the above). Ie how many points makeup a pixel & how many pixels make up a point. -- Besty Regards, TJ
8
2333
by: Rainer Queck | last post by:
Hi NG, in a dataset.datatable I have rows, containing metric data as doubles. I need to display/edit these values in textboxes depending on the culture (Metric/Inch). Is there something like a built in conversion functionality for that in the framework / visualstudio or do I have to do these conversions manually? Thanks for help and hints Rainer
4
1904
by: Jimmy | last post by:
hi, all I attempt to use the function inch() to get the character at the current position, and compare it with a particular character like : if screen.inch(x,y) == 'F' but this method doesn't seem work, can anyone tell me the reason and how to corrent it thanks
1
4244
by: Nitzan Tomer | last post by:
hi everyone, i created a script that outputs an image (transparent with text) based on parameters passed by $_GET. everything in my application works with 'pixels' and since GD2 this function (imagettftext) uses 'points' as the text size unit. i've searched everywhere for a solution to convert from pixels to points (or the other way around) but with no luck... each place says something different and i can't find a good answer.
4
2202
by: MangroveRoot | last post by:
A few years ago, I worked on a project in which I designed some tables, queries, forms, and reports. I'm reasonably certain that when I was designing the forms for that project, I set the snap-to grid to something like 1/16", or 1/10", or 1/8" -- enough so that it was obvious that the form elements were nicely lined up (and nicely spaced), but nothing so widely spaced as 1 whole inch apart (origin to origin). Now, however, I'm trying...
0
9636
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9474
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10306
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10138
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10074
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9930
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5373
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5503
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3632
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.