Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    New Coder
    Join Date
    Jul 2005
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Printing address labels from web database

    OK,

    I am trying to create for our school (I am one of the teachers), a web based application where we can list contacts in a mysql database. Then I can retrieve the addresses with php to a results page when we want to print address labels. Now I am unsure how to configure the results page or otherwise configure the web application to print to a sheets of avery address labels right from the php page off the web application. We have no budget (being a school of course) so I can't buy additional software...I just have to figure it out for them on my own. I have some experience with php and mysql (I have created basic contact forms and guestbook-like applications).

    Any help is greatly appreciated. Thanks in advance.

    Darren

  • #2
    Registered User
    Join Date
    Sep 2005
    Posts
    315
    Thanks
    0
    Thanked 0 Times in 0 Posts
    well.... to put the information in the database is quite easy i think, if you need help with that i can help you. I could probably also help you with the result page but i don't exactly understand what you mean by that

  • #3
    New Coder
    Join Date
    Jul 2005
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I can add the information to the mysql databse with no trouble. I also can create a results page where all the database info would be posted. Now, I am not sure how to get the addresses off the results page and printed to address labels on a printer. I assume if I knew how to configure the results page to be displayed like the avery label page I was going to print that could solve it. Otherwise I have no clue. I read somehwhere that you can configure a php page to send it to another program like ms word to print.

    Hopefully I am more clear. Thanks for offering to help. I appreciate it and look forward to your response.

    Darren

  • #4
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    do you need to do this over the web?

    if not, then just use MsAccess --> even has a report-wizard for adresslabels
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

  • #5
    New Coder
    Join Date
    Jul 2005
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts
    So if I use access for my database do I have to run access on the workstation to create the printed labels or can I still do it from the web page. ?

    Darren

  • #6
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    well, that's why i asked "do you need to do this over the web?".

    if you wanna initiate the printjob from your browser, then i don't think you could use MsAccess (well, i think it would still be doable be unnescecary complex). access would be a good alternative if you just print them ofline, after you loaded the data from your mysql db.

    if you wanna start the printjob from your browser, then, in my opinion, the only good way to do it is dynamically creating a pdf (through PHP, with the data from your db) that is streamed to your browser. there are a few good PHP classes that make this a very simple job. I frequently use the r&os-class ( http://www.ros.co.nz/pdf/ ) but there are of course other classes.
    With pdf, you completely control your pagelayout, which is not so in html, and you can control how the adresses are split up over pages.
    with the r&os-class, it's very easy to generate a table in your pdf, where rows aren't broken up over pages. so if you have 1 cell for each adress, then your adresses will always be kept on one page.
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

  • #7
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,479
    Thanks
    0
    Thanked 635 Times in 625 Posts
    There are some commands in CSS2 that allow you to set paper sizes etc for printing a web page. It should just be a matter of getting the text into the right place using the appropriate stylesheet commands which could involve a lot of trial and error. Which browser you use could also affect how well you can achieve the result as I don't think the older version 7 browsers support the page options within CSS2.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #8
    New Coder
    Join Date
    Jul 2005
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Here's an idea. I know this can be done but I don't know how to command it in php. There is a php command where I can force Microsoft Word to open a template file and populate it from the database using the e-mail merge. I know this works normally if I open the templete with Word so If I can get that file to be forced open that would be cool since the workstations have Word installed on them.

    What would also be cool if you could choose the entries you wanted to send to the template right in the browser by some check list or the like. However, I will leave that question for another thread. Thanks

    Darren

  • #9
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by dforbes
    Here's an idea. I know this can be done but I don't know how to command it in php. There is a php command where I can force Microsoft Word to open a template file and populate it from the database using the e-mail merge.
    Why do you assume that this can be done?
    I mean, for this to work, the word-document and template should be stored on each workstation (a maintenance-nightmare on its own) + you should be able to open a worddocument on the workstation bij the server (which would involve some form of 'remote desktop' control or maybe some sort of ActiveX-component, but it'll create a security-risk in any case) + the desktop should have access to your MySQL server (which creates an even bigger securityrisk).

    It's not because you can do this on the localhost (where PHP - Apache - MySQL and Word run on the same machine) that you can just do it on every workstation.

    Dynamically creating a pdf is far easier, more secure, faster and gives you more control over the pages layout.

    Quote Originally Posted by dforbes
    What would also be cool if you could choose the entries you wanted to send to the template right in the browser by some check list or the like. However, I will leave that question for another thread.
    This is quite easy to do if you dynamically create a pdf. you just display a form with the adresses with checkboxes next to them, and only select the adresses that were checked and then build the pdf from that recordset. Just like you would do it if you would show the adresses on screen.
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

  • #10
    New Coder
    Join Date
    Jul 2005
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts
    OK,

    Let's assume that I can't get php to open the file. I have already tested the template. When it opens, the file is automatically populated from the database. If I store the template in a folder (lets call it "docs") on the sites remote server, all I want is to create a form that allows me the coice to select the addresses I want to print or select all, and when I hit the send button it sends it to a php pahe that commands the tenplate to open. Because the only people accessing this page will be ones with MS Word installed...there is not a problem with workstations.

    I am open to ideas because I don't know how to accomplish this task either way. So suggestions about creating it the pdf way would be great. Let's assume I am retarded. Thanks

    Darren

  • #11
    tester1234
    Guest

    Did you find a solution?

    Hello Darren,

    I actually am working on exactly what you where doing as well.
    Did you ever find a solution?, would you mind sharing it?

    Thanks!

  • #12
    New Coder
    Join Date
    Aug 2006
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Avery should provide specifics to column row and margin spacing, then just use that to create the output table.

  • #13
    New to the CF scene
    Join Date
    Sep 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I now have a solution to this problem. I am happy to share it if anyone still needs it, providing that it is agreed that the code is not sold on. If you would like the code still please pm me or reply here and let me know.
    Chrissie

  • #14
    New to the CF scene
    Join Date
    Sep 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Chrissie, please post or email me your solution. I thought I would be able to do it using Cyrstal Reports but I just discovered that my server does not allow CR!

    Thanks in advance.

    wtlease@yahoo.com

  • #15
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    Perhaps rather than post the code that you don't want falling into evil hands, you could just explain the mechanics of your solution for future readers of this thread.


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

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