Alpha Video Training
Results 1 to 5 of 5

Thread: Auto Printing in Web app

  1. #1
    Member
    Real Name
    Carlo Macasaet
    Join Date
    Dec 2003
    Posts
    8

    Default Auto Printing in Web app

    Hi all,

    I have a web application that is polling the server for updates. When an update comes, i would like to automatically print this report out.

    I used the report.save() function using HTML as option instead of PDF. The browser on the machine that will do the printing is only IE 5.0.

    I tried to use the javascript window.print() command however, i get the print dialog box. Is there a way to prevent this dialog box to come out and send the page directly to the printer?

    below is the code i used to generate the print output....

    <%A5
    if eval_valid("Tran_id")
    if Tran_id = ""
    goto CustidNotSpecified
    end if
    dim filter as c
    dim order as c
    filter = "tran_id = " + quote(tran_id)
    order = ""
    dim filename as c
    filename = session.session_folder + chr(92) + "templabels.htm"

    report.saveas("DeliveryDocket","HTML",filter,order,filename,.f.)

    if file.exists(filename)
    response.redirect(session.session_url + "templabels.htm?" + time("hms3"))
    end
    end if
    else
    CustidNotSpecified:
    %>
    <html>
    <head><title>Labels</title></head>
    <body>

    <p>Error: You must call page with a query string that specifies the Customer ID.<br>
    For example: <%a5 ? request.script_name %>?cust_id=000001</p>
    </body></html><%A5
    end if
    %>

  2. #2
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: Auto Printing in Web app

    Quote Originally Posted by carlo View Post
    Is there a way to prevent this dialog box to come out and send the page directly to the printer?
    Web app questions a re generally posted in the Application Server area, not the Desktop.

    You issue may be solvable by unchecking Show Printer Setup on Print in the report properties.


  3. #3
    Volunteer Moderator Steve Wood's Avatar
    Real Name
    Steve Wood
    Join Date
    Nov 2003
    Location
    Bay Area, California
    Posts
    8,842

    Default Re: Auto Printing in Web app

    The report properties settings will have no effect on the report from the web.

    I don't know if you can use any javascript to auto print, but how about changing your process a bit.

    Rather than printing using javascript, install a shareware FolderWatch program to watch the folder for files. If one exists, the folderwatch program can execute a program to print it to your local printer.
    Steve Wood
    Join the ALPHA DEVELOPERS NETWORK
    There is no Cloud. It's just someone else's computer.
    Web - Mobile - Hosting - Products - Frameworks - Developer Resources
    AlphaToGo | IADN (100% Alpha Anywhere Websites)

  4. #4
    Member
    Real Name
    Carlo Macasaet
    Join Date
    Dec 2003
    Posts
    8

    Default Re: Auto Printing in Web app

    Hi Steve,

    Thanks for the tip... now i just need to understand how this will work when i created the template.htm file in the session_folder. I believe there is a sub-folder that is auto-generated by a5 at random where it will store the file. Will folderwatch detect the new folder and move inside and pickup the newly generated template.htm file?

    I assume i can install FolderWatch in the local computer and monitor the session_folder... is this correct?

    many thanks,

    Carlo M.

  5. #5
    Volunteer Moderator Steve Wood's Avatar
    Real Name
    Steve Wood
    Join Date
    Nov 2003
    Location
    Bay Area, California
    Posts
    8,842

    Default Re: Auto Printing in Web app

    You should specify where you want it to go. Like:

    filename = "C:\\myoutput\\labels_" + Tran_id + ".htm". That will also give you unique report names in case two reports are created in a short timeframe. The Application Server has physical access to the whole LAN file system, so you can push the file where ever you want. Also, you'd get rid of the response.redirect() statement and the whole CustidNotSpecified: area because I don't think any human is involved here, its an automatic process, right? If your polling process can just start a browser with that A5W page, it will all happen automatically. I have a report scheduler coming (see my website/Products) that can schedule this.
    Steve Wood
    Join the ALPHA DEVELOPERS NETWORK
    There is no Cloud. It's just someone else's computer.
    Web - Mobile - Hosting - Products - Frameworks - Developer Resources
    AlphaToGo | IADN (100% Alpha Anywhere Websites)

Similar Threads

  1. web app development in v7
    By jonlau in forum Web Application Server v7
    Replies: 3
    Last Post: 09-10-2006, 01:57 PM
  2. Desktop app to web app?
    By Huey in forum Alpha Five Version 7
    Replies: 1
    Last Post: 03-19-2006, 09:02 PM
  3. Web App Question
    By afreeland in forum Web Application Server v6
    Replies: 1
    Last Post: 02-27-2006, 09:46 PM
  4. getting data to my web app
    By jkukuda in forum Web Application Server v6
    Replies: 1
    Last Post: 04-07-2005, 08:43 AM
  5. Converting your APP to a Web App
    By Dave Wilson in forum Alpha Five Version 6
    Replies: 4
    Last Post: 09-22-2004, 11:13 AM

Bookmarks

Posting Permissions

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