Results 1 to 14 of 14

Thread: Barcode Font problem

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2001
    Location
    India
    Posts
    276

    Barcode Font problem

    Hi,
    I have a requirement to display and print barcodes. I am using the Code39-digits font to display the number in barcode format. I want my web application to detect if the font is installed in the client machine and prompt the user to download the font if not.

    Any suggestions on how this can be done?
    Thanks
    Jemima.
    "Your worst days are never so bad that you are beyond the reach of God's grace...
    and your best days are never so good that you are beyond the need of God's grace."

  2. #2
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    To read a clients PC is very iffy. You should probably use Active X for this, but you will have major problems. Firstly Active X can only be used by IE: big ****ter. Secondly people will have to lower their security settings, that's more than most people will do.

    Maybe Java could do thie trick, in which case that would be an ideal solution. The best thing might be for them to check it themselves. Write out the alphabet in that font, and just below have an image of what it should look like in that font. They can then see if those match and if they don't then they have to download the font.
    Have I helped you? Please Rate my posts.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2001
    Location
    India
    Posts
    276
    Thanks for the quick response Acidic!

    The site is for within the intranet and we also have the liberty of assuming the browser to be IE (We're blessed!)

    I can't expect the security settings to be reduced though. I am looking at some Javascript code that will either help me loop thru the available fonts on the client machine or that will tell me if the barcode got written on the browser.. maybe some sort of a work around...

    We have an option with the WEFT, worst case. If that ain't accepted then I'm gonna propose jus this:
    "The best thing might be for them to check it themselves. Write out the alphabet in that font, and just below have an image of what it should look like in that font. They can then see if those match and if they don't then they have to download the font."

    Thanks again!
    Jemima.
    "Your worst days are never so bad that you are beyond the reach of God's grace...
    and your best days are never so good that you are beyond the need of God's grace."

  4. #4
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    JavaScript cannot read files on the PC. This is a good thing as otherwise there would be security concerns on every site.

    Hmm... Since you are using only IE there might be some IE only JavaScript functions that can actually do this though. I've never used these as they are IE only but I'm having a google as i write.
    Have I helped you? Please Rate my posts.

  5. #5
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    OK. I've found something that you can maybe use. Read this page:
    execCommand()
    and use this method for that function:
    SaveAs
    Have I helped you? Please Rate my posts.

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2001
    Location
    India
    Posts
    276
    No I didn't quite understand. What command should I give? I tried "FontName" but how will I know if the font existed?

    Jemima.
    "Your worst days are never so bad that you are beyond the reach of God's grace...
    and your best days are never so good that you are beyond the need of God's grace."

  7. #7
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    Oh sorry. I got muddled up with what I was doing half way through fdoing it and came out with totally irrevelent stuff.

    They do have an Open method, but they don't support it. So I guess you can't use JavaScript at all for this then.

    If it's on an intranet, then I suppose it's all within one company. Why don't you install the font on all the machines?
    Have I helped you? Please Rate my posts.

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2001
    Location
    India
    Posts
    276
    Installing the fonts on the destination machines was the initial idea. But going forward we had to think of an alternative when a new box got added.

    I am still beating around with the hopes of finding a Font object that would pull the fonts on a machine or be able to trap from the browser if the barcode got displayed.

    I just remembered that my page will be a print preview where the users can print the invoice as is.. so I can't have the help message on the same page but I could redirect them to a startup page at logon and let them decide if they need to install the font. If they could view the barcode I could probably save this into a cookie and proceed. This or WEFT? There's just 2 options for now.

    Thanks for your time Acidic.
    Jemima.
    "Your worst days are never so bad that you are beyond the reach of God's grace...
    and your best days are never so good that you are beyond the need of God's grace."

  9. #9
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    I suggest using php and then this barcode library to turn your barcode into an image and display that instead.
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  10. #10

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2001
    Location
    India
    Posts
    276
    The site is in ASP.NET and C#. Can't use PHP - its not within our standards and I don't know PHP too.

    Thanks anyways, Jop! We had thought of the option to convert the barcode to an image and stream it into the client but performance constraints in streaming in barcodes for records as many as 200 won't be a good idea.

    We're still trying. Somehow I have a feel some Javascript (not too complex or straight forward) should do the trick...

    Thanks
    Jemima.
    "Your worst days are never so bad that you are beyond the reach of God's grace...
    and your best days are never so good that you are beyond the need of God's grace."

  11. #11
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    Maybe you should consider installing PHP. What Jop said is a very good idea and if it cannot be done with ASP, then maybe you should try out PHP. I'm sure that you can learn enough for this, or else someone might write the code for you. I would write it myself, but I've never used those text to image functions.
    Have I helped you? Please Rate my posts.

  12. #12

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2001
    Location
    India
    Posts
    276
    That's very sweet of you to offer, Acidic; but we do have code in C# (downloaded from the net) that would convert text to image and all.. and like I said the issue was in streaming the image back to the client for around 200 invoices per request. That hits the performance of the web server. Hmm.. Still its one of the design options we've kept open.

    As for PHP, I don't have a say. Our client's coding standards do not give in to use PHP.

    Thanks
    Jemima.
    "Your worst days are never so bad that you are beyond the reach of God's grace...
    and your best days are never so good that you are beyond the need of God's grace."

  13. #13
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    Actually i'm pretty confident that it can be done in ASP.NEt even though I haven't used it in a while. If you can convert text to images, you can probably use ASP to generate the barcode from a font you install on the server.

    It's not gonna be a big performance hit either since the images are going to be only a few k if you use a gif, plus that you can cache the barcodes so that they don;t have to be regenerated every time.

    I"m sorry that I can't provide you with any examples, but this manner described above is the general idea of how I would do it.

    Good luck with it!
    Last edited by Jop; Sep 9th, 2004 at 06:27 AM.
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  14. #14

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2001
    Location
    India
    Posts
    276
    It would have been a clean sweep choice if we could have cached the images. But the barcode images can't be cached as they'll be different order numbers each time.

    Also we're having this ASP.NET code (in C# syntax) that will convert the text to an image on the server but rather than creating a GIF (or any other image format) file, we'll simply stream the image and binaryWrite it to the web page. That way the overhead traffic of streaming in each image was an issue.

    I also found that the font that is installed on the client machines is not supported by WEFT and so we can't embed this font as well. So now that we're left with not too many options to choose from, we'll just have to submit these 2 ways and wait n watch.

    Thanks all for your suggestions!
    Jemima.
    "Your worst days are never so bad that you are beyond the reach of God's grace...
    and your best days are never so good that you are beyond the need of God's grace."

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width