Edgewalker81 Posted January 14, 2008 Share Posted January 14, 2008 I was trying to make a very naive version of a barcode generator using code39 (it's based on just stretching out white and black 1x1 gifs in sequence) The result is a correct barcode, and if I print it in IE it scans great. The problem is printing (from apparently any computer to any printer) in FireFox garbles the code, almost like FF is just throwing out some images. Suggestions? Should I scrap this and go down the long road to php image generation? Here's where I have my test: http://www.edge-walker.com/barcode_tests/test.php I don't want anybody wasting paper on my account , but printing from firefox does give you something very different from what is on the screen. Relevant code: $black='<img src="b.gif" height='.$height.' width='.$width.' />'; $white='<img src="w.gif" height='.$height.' width='.$width.' />'; $encodings['0']="$black$white$black$white$white$black$black$white$black$black$white$black"; // Encodings continue in that manner... $html_string=$encodings['*'].$white; $pos=0; while($pos<strlen($text)) { $html_string.=$encodings[$text[$pos]]; $html_string.=$white; $pos++; } $html_string.=$encodings['*']; return($html_string); Quote Link to comment https://forums.phpfreaks.com/topic/86018-solved-barcodes-simple-solution-that-seems-to-work-only-in-ie/ Share on other sites More sharing options...
kickassamd Posted January 14, 2008 Share Posted January 14, 2008 Works in IE Maxthon Opera and Prints of here in Firefox... Quote Link to comment https://forums.phpfreaks.com/topic/86018-solved-barcodes-simple-solution-that-seems-to-work-only-in-ie/#findComment-439282 Share on other sites More sharing options...
Edgewalker81 Posted January 14, 2008 Author Share Posted January 14, 2008 Well, then I can only assume there is something about the way our printers are set up here, which is very helpful. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/86018-solved-barcodes-simple-solution-that-seems-to-work-only-in-ie/#findComment-439290 Share on other sites More sharing options...
kenrbnsn Posted January 14, 2008 Share Posted January 14, 2008 I ran your generated code through the xHTML validator and it generated over 500 errors. If you fix the errors in the generated source it may fix the problems you're seeing. BTW, it printed differently with FF than with IE7 on my machine. Ken Quote Link to comment https://forums.phpfreaks.com/topic/86018-solved-barcodes-simple-solution-that-seems-to-work-only-in-ie/#findComment-439292 Share on other sites More sharing options...
PFMaBiSmAd Posted January 14, 2008 Share Posted January 14, 2008 I have the same results as mentioned above, along with the validation recommendation. However, I recommend generating the bar code as one image that can be printed. Relying on HTML/browsers to render the bar code will mean that you might get it working now, but it could stop working upon the next update/fix FF/IE and different browser settings of different people could produce different results. Quote Link to comment https://forums.phpfreaks.com/topic/86018-solved-barcodes-simple-solution-that-seems-to-work-only-in-ie/#findComment-439301 Share on other sites More sharing options...
Edgewalker81 Posted January 15, 2008 Author Share Posted January 15, 2008 I ran your generated code through the xHTML validator and it generated over 500 errors. If you fix the errors in the generated source it may fix the problems you're seeing. BTW, it printed differently with FF than with IE7 on my machine. Ken Thanks for the help. It was really just 500 instances of one error (being that I forgot to include quotes around my attribute values, which as far as I know doesn't affect the problem I was having). I got XHTML validation by just inserting quotes where they ought to be. In the end I got it to work by just making the images 10px x 10px, and it works in every browser I've tested since then. I'm a little intimidated by the orders of magnitude more complex a single-image solution is, but I plan to move in that direction as time permits. Any suggestions? I was thinking of working with php's GD2 libraries. Quote Link to comment https://forums.phpfreaks.com/topic/86018-solved-barcodes-simple-solution-that-seems-to-work-only-in-ie/#findComment-440074 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.