santosh22 Posted August 28, 2013 Share Posted August 28, 2013 Hi, I need to get dynamic contents (name & address) from database and have them printed in labels. I am preparing a HTML page with the right height, width & margins defined for the type of labels (AVERY). However, while printing those, I feel it is not having right effect on the alignment. Based on the text length, the labels get printed over eachother & margins are not aligned. Can you please suggest a browser plug in which would take my content & give me rightly aligned output from the printer? I am using a normal HP printer. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/281645-label-printing/ Share on other sites More sharing options...
requinix Posted August 28, 2013 Share Posted August 28, 2013 (edited) A browser plugin? Please. Is there something wrong with adjusting your HTML and CSS until it fits the labels correctly? Edited August 28, 2013 by requinix Quote Link to comment https://forums.phpfreaks.com/topic/281645-label-printing/#findComment-1447202 Share on other sites More sharing options...
Psycho Posted August 28, 2013 Share Posted August 28, 2013 (edited) Each browser type (IE, FF< Opera) and each version can have differences in how it displays a web page. Using a web page for exacting printer layout/output is never going to be 100%. For labels you can probably format the structure of the output so it will meet your needs, but you can't cover every eventuality. If the content of some labels is bigger than the available space you can reduce the font size to cover those eventualities. heck, even MS Word will fail to fit content into a label template if there is too much text. EDIT: Here is a post on dynamically scaling text within a fixed area that might be of interest to you. http://stackoverflow.com/questions/687998/auto-size-dynamic-text-to-fill-fixed-size-container Edited August 28, 2013 by Psycho Quote Link to comment https://forums.phpfreaks.com/topic/281645-label-printing/#findComment-1447214 Share on other sites More sharing options...
will35010 Posted August 28, 2013 Share Posted August 28, 2013 You could also output it to a pdf so you wouldn't have to worry about the browser differences. Quote Link to comment https://forums.phpfreaks.com/topic/281645-label-printing/#findComment-1447215 Share on other sites More sharing options...
Psycho Posted August 28, 2013 Share Posted August 28, 2013 You could also output it to a pdf so you wouldn't have to worry about the browser differences. I was going to suggest that - but you still have the same problem of the text may not "fit" in the available space. So, the process to output to PDF would have to be able to measure the output and adjust it accordingly. Quote Link to comment https://forums.phpfreaks.com/topic/281645-label-printing/#findComment-1447216 Share on other sites More sharing options...
mac_gyver Posted August 28, 2013 Share Posted August 28, 2013 you will probably have better luck writing the output to a text file and piping it to the printer using a system() statement. Quote Link to comment https://forums.phpfreaks.com/topic/281645-label-printing/#findComment-1447219 Share on other sites More sharing options...
santosh22 Posted August 29, 2013 Author Share Posted August 29, 2013 someone suggested me to use this plug-in. Scriptx I will see if that suits my needs. I have tried the PDF file one, but it also has the same problem of alignment. I am going to use one browser but again the challenge is some css is not working in different versions. Thanks for all suggestion. IF there are any more, I would love to welcome.. Quote Link to comment https://forums.phpfreaks.com/topic/281645-label-printing/#findComment-1447237 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.