1. Introducing Channels - a new way to chat with other Android users!
    Dismiss Notice

Here's how to print from Android or any mobile device that normaly can't


Last Updated:

  1. Lars

    Lars Well-Known Member This Topic's Starter

    Joined:
    Mar 24, 2010
    Messages:
    1,439
    Likes Received:
    210
    I've been agonizing whether to release this in the wild because it isn't a 100% solution yet. The problem with Mobile devices is that no one has developed a good way to print documents directly from them. I have come up with a fairly simple way to print.

    It involves installing a simple print daemon on a windows machine that has a default printer of some kind. It doesn't matter the type. If the PC can print and it is the default you are good to go.

    This daemon will print any document recognizable by the Windows PC.
    The basic idea is to pass the name of the directory you would like the daemon to monitor for files as a parameter.
    The directory must be shared and writeable by devices such as smartphones.
    This folder can be a network share or ftp folder if you have an ftp server setup. If you don't know how to share folders or setup an ftp server, start googling.

    1. Extract the file in the zip and save it to your local disk. On XP drop a shortcut to this file to Documents and Settings\All Users\Startup.
    On Vista and newer click Start-Programs-Startup and right click Open All Users then drop a shortcut to the file in that folder. You must be in an admin account to do this and the Print.vbs file must be on a local drive of the PC or you will get security warnings. I wrote the program in vb. Inspect it if you like.

    2.Edit the properties of the shortcut and add the folder name to monitor to the commandline such as "c:\program files\print.vbs" "C:\Printme". This printme folder is the one shared to the mobile devices.

    3. Reboot the computer and log back in. You should then see wscript running in the task manager. It checks for files every three minutes and doesn't slow the computer. You'll get a warning if you didn't do step two and things won't work.

    4. For Windows Mobile map the shared folder from the pc using NetUse.
    For Android create a Samba share to the LAN using estrongs File manager.
    For other platforms or the the above, turn on ftp on the XP machine
    and use an ftp client to access the folder. estrongs can also be used for ftp if you are printing over the internet.

    5. To print, simply copy the file(s) into the Shared folder on the server from the phone using estrongs or an ftp client.
    If the XP machine has a file association for the file, it will print to the default printer and then delete the file. You may want a special folder like Printme so that other stuff doesn't go in there.

    PDFs and office documents work well. Problems: First it requires a moderately tech savvy person to setup. Second, you need software such as MS Office or adobe reader installed on the host so the computer knows what to do with the file. Third, and here is the big one so far, a user account has to be logged in to activate the script. I haven't been successful running it as a system service because the System service can't spawn apps even if you runas admin.

    So there it is. Maybe it helps someone.
     

    Attached Files:


    Advertisement
  2. UncleMike

    UncleMike Well-Known Member

    Joined:
    Nov 15, 2009
    Messages:
    2,319
    Likes Received:
    482
    Thanks! I've been thinking about doing something like this using a CMD script (my vbscript skills are more rusty than my cmd script skills) but I''m sure I probably would have never gotten around to it.
     
  3. indianajonze

    indianajonze Well-Known Member

    Joined:
    May 17, 2010
    Messages:
    123
    Likes Received:
    24
    above is why i cannot wait for the new hp eprinters that were announced earlier in the week. hp + google partnership = remote printing for all FTW
     
  4. Lars

    Lars Well-Known Member This Topic's Starter

    Joined:
    Mar 24, 2010
    Messages:
    1,439
    Likes Received:
    210
    I considered compiling an app but I think I would still have execution as a service issue. Vbs was quick and does it.

    HP has always made the most flexible printers. Those eprinters sound cool.
     
  5. e3titanium

    e3titanium New Member

    Joined:
    Sep 3, 2010
    Messages:
    2
    Likes Received:
    0
    where do you specify the folder path in your script, i keep getting an error
     
  6. Lars

    Lars Well-Known Member This Topic's Starter

    Joined:
    Mar 24, 2010
    Messages:
    1,439
    Likes Received:
    210
    The path should get passed as a commandline argument. If you created a shortcut to run the bbs then go back and edit the shortcut. In the commandline you'll see the name of the script. Put a space after the name and then the folder you want it to monitor in double quotes " . Make sure that folder is empty because everything in there gets printed and deleted. I guess I could have made it move the files as a safety.
     
  7. sitlet

    sitlet Banned

    Joined:
    Apr 11, 2010
    Messages:
    5,867
    Likes Received:
    633
    Printershare works too
     
  8. e3titanium

    e3titanium New Member

    Joined:
    Sep 3, 2010
    Messages:
    2
    Likes Received:
    0
    got it to work! thanks! how do i have it delete without prompting to confirm deletion?
     
  9. davemonfl

    davemonfl Member

    Joined:
    Jun 17, 2010
    Messages:
    8
    Likes Received:
    0
    Awesome Dude!!! Works great, thanks a lot!!!

    How do I modify the script so that it deletes file without prompting to confirm deletion?
     
  10. Genisis

    Genisis Member

    Joined:
    Sep 15, 2010
    Messages:
    12
    Likes Received:
    1
    Windows??? REALLY? What about if all you use on all your PC's is Linux?
     
  11. Rokcet Scientist

    Rokcet Scientist Banned

    Joined:
    Nov 24, 2010
    Messages:
    172
    Likes Received:
    8
  12. davemonfl

    davemonfl Member

    Joined:
    Jun 17, 2010
    Messages:
    8
    Likes Received:
    0
    I found a way to modify the script so that it just deletes the file after printing without putting up a dialog box and waiting for a response. Find the first line shown below in the script and insert the second line into the script below the first line as shown:

    Dim strFolderPath : strFolderPath = ArgObj(0)
    Dim objFSO : Set objFSO = CreateObject("Scripting.FileSystemObject")

    Do the same with these two lines:

    wscript.Sleep(10000)
    objFSO.DeleteFile(objItem.Path)
     
  13. ouroboros2012

    ouroboros2012 New Member

    Joined:
    Jan 16, 2011
    Messages:
    2
    Likes Received:
    0
    Thank you for this wonderful how-to!
    :)
     
  14. Lars

    Lars Well-Known Member This Topic's Starter

    Joined:
    Mar 24, 2010
    Messages:
    1,439
    Likes Received:
    210
    Thanks and thanks to dave for digging into VBscript further than my lazy A$$. The machine needs Recycle bin prompts turned off BTW. Printing jpgs varys with Windows version and may pause to prompt depending on your file associations.

    If I was on Linux, I'd make a php script and have an interface on the phone that would do a file upload. Open that to the web and print from anywhere.

    In reality HP is solving this issue for us with their Air Print printers. About time.
     
  15. PSkeptic

    PSkeptic Well-Known Member

    Joined:
    Jan 10, 2011
    Messages:
    905
    Likes Received:
    97
    Write a bash/ksh/sh script that checks a directory for files, and if they exist, print them. The Android side would be the same.

    A simple script would be something like this:

    Code (Text):
    1.  
    2. #!/bin/bash
    3.  
    4. set PRINT_DIR=/tmp/AndroidSpool
    5.  
    6. if [ -e $PRINT_DIR ] then mkdir $PRINT_DIR
    7.  
    8. for i in `ls $PRINT_DIR` do
    9.   lpr $i
    10. done
    11.  
    12. exit 0
    13.  
    Yes, this script needs some work, as most files will come out munged, but you get the idea.
     
  16. korkusoft

    korkusoft New Member

    Joined:
    May 26, 2012
    Messages:
    1
    Likes Received:
    0
    Hello:

    What I have understood is that the script only works for the default printer, right? How would it be to select any printer installed?

    Thank you!
     
  17. Tijuanatom

    Tijuanatom Active Member

    Joined:
    Oct 27, 2012
    Messages:
    28
    Likes Received:
    10
    Korkusoft,

    While this thread still has good information it is a bit old at this point. Try Google Cloud Print for a more complete solution.

    Google Cloud Print Help
     

Share This Page

Loading...