views:

54

answers:

3

Hi , I'm developing an advertisement portal for a newspaper and I want to add an astonishing feature to my website.

here is my idea : I want to add a capability to let user to write his own advertisement's text withing an area then let him to tailor it as the way he/she wants it then at the end , the program calculate the inches high of his advertisement automatically for him/her.

I know how to providing the ability of tailoring a textarea in HTML/javascript but the problem is whit calculating the height of ADV in our real measurement say inches or centimeter.

is there any solution or any idea of how to doing this?

regards.

+1  A: 

That will be dependent of font and formatting. You could create a PDF form which implicitly contains width and height constraints and is easy for typesetting.

Byron Whitlock
thanks for the advice but I want to let my user to see what does he wants on the actual newspaper say something like his header should be bold he likes his phone number to be written in two lines etc...so I believe PDF forms can't help me much.thats why I've decided to program it with the help of javascript/css/html + dynamic language like asp.net or php.
austin powers
You can always render the view in PDF. So just put a preview button that links to a sample newspaper page and stick their ad (with formatting) in the space they paid for to see how it looks. Without using something like that you won't ever be able to tell reliably how it it will look when printed.
Byron Whitlock
+2  A: 

One option would be to generate an image of the text (using, say, ImageMagick) in the expected font, size, and formatting; display that image to the user for confirmation that it looks like they expect; and then measure the image. That should eliminate the issue of variation based on how it will be printed.

JacobM
+3  A: 

I'm not 100% sure whether the ads you're talking about are going to be used online, or in the actual paper.

If you are talking about on-line ads:

Forget about inches in online advertisements. Using the term is misleading and is going to produce misunderstandings and trouble. You can't guarantee a physical fixed size on a web page. There are only Pixels - calculate with, and price by them. Explain to your customers that a Pixel can have a different size on different displays, so actual results vary.

If you are talking about paper ads created online:

@Byron Whitlock's solution suggesting PDFs would be your safest bet, because the customer can print it out and expect to see the actual result in its real size, and if not, it's down to the customer's printer settings.

Pekka
thanks but I'm talk about newspaper I mean actual paper not web advertising which I believe in web there is no need to calculate these things ;)
austin powers