Jump to content

Remote printing


jbarr
 Share

Recommended Posts

One computing function that I'm surprised that no one has developed is the simple, cheap ability to remotely print documents across the Internet. I'm talking about creating some sort of "print file" on a remote PC, say .pdf, and then sending that file to my home PC where it would automatically print. It's the "automatically print it" part I'm struggling with.

As an example, let's say I am at work. I am surfing the 'net, or I'm creating a document, and I would like to print out what I'm working on on my printer at home. My thought is to leverage .PDF creation apps, FTP, AutoIT's scripting, and an application like "DirMon2" that "polls" a folder and then executes an app (in this case, an AutoIT script) based on user-defined criteria.

Here is the flow:

  • While at work, I run any of a number of .PDF creation apps to generate the page(s) that I want to remotely print at home.
  • I FTP to my home PC the resulting .PDF file(s) containing these pages.
  • The home PC is running an application like DirMon2 that polls a folder for specific files, in this case, a .pdf file. When it finds the .pdf file in the folder, it would...
  • ...execute some application that would print that .pdf file to a pre-defined printer on my home network
My problem is step #4. I can very, very easily set up and accomplish 1,2 & 3, but how do I write an executable that would print a .pdf file to the default printer?

Any suggestions?

Visit Jim's Tips for lots of cool tips on Gmail, SageTV, PDA's, and whatever else interests me!

Link to comment
Share on other sites

One computing function that I'm surprised that no one has developed is the simple, cheap ability to remotely print documents across the Internet. I'm talking about creating some sort of "print file" on a remote PC, say .pdf, and then sending that file to my home PC where it would automatically print. It's the "automatically print it" part I'm struggling with.

As an example, let's say I am at work. I am surfing the 'net, or I'm creating a document, and I would like to print out what I'm working on on my printer at home. My thought is to leverage .PDF creation apps, FTP, AutoIT's scripting, and an application like "DirMon2" that "polls" a folder and then executes an app (in this case, an AutoIT script) based on user-defined criteria.

Here is the flow:

  • While at work, I run any of a number of .PDF creation apps to generate the page(s) that I want to remotely print at home.
  • I FTP to my home PC the resulting .PDF file(s) containing these pages.
  • The home PC is running an application like DirMon2 that polls a folder for specific files, in this case, a .pdf file. When it finds the .pdf file in the folder, it would...
  • ...execute some application that would print that .pdf file to a pre-defined printer on my home network
My problem is step #4. I can very, very easily set up and accomplish 1,2 & 3, but how do I write an executable that would print a .pdf file to the default printer?

Any suggestions?

I don't even have the AutoIt help file to refer to from where I am right now so I'll just wing it.

Assuming;

1) You have an application at home that handles PDF files

2) the application at home is an AutoIt script (probably compiled)

try using the following in your app at home

ShellExecuteWait("filename.pdf","","","Print")

Edit: The above assumtions should have included

3) You copied the file to your home computer. If not then you will also have to use InetGet() to copy the file to the home system. You can always delete the file later.

You could also play with

Something along the line of

ShellExecuteWait(InetGet(<File Address>), "","","Print")

Like I said, I'm just winging it here.

Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

This is what I just got done with for my software @ work. Now, keep in mind it references the rest of my GUI. There has to be a $partnum field that it reads from (the ControlGetText part).

It also checks if Acrobat is running first. If it is, it leaves Acrobat alone after printing. If it wasn't running, it closes Acrobat (time delay check, may need to be altered on a slower/faster machine).

Func PrintLabel()
    $partnum = ControlGetText("Remote","",8)
    $openacrobat = 0
        If WinExists("Adobe Acrobat","") then
            $openacrobat = 1
        Else
            sleep(2)
        EndIf
    If FileExists($artworkDir & $partnum & '\' & $partnum & '.pdf') Then
        $answer = MsgBox(4, "Confirm Print", "Printing ONE copy of part number " & $partnum & " to the " & $printerName & ".")
            If $answer = 6 Then
                Run(@ProgramFilesDir & $acrobat & ' /t ' & $artworkDir & $partnum & '\' & $partnum & '.pdf' & ' "' & $printerName & '" "' & $printerDrv & '" ' & $printerIP,"",@SW_MAXIMIZE)
                sleep(2500)
                If $openacrobat = 0 Then
                    WinClose("Adobe Acrobat","")
                Else
                    sleep(2)
                EndIf
            Else
                sleep(2)
            EndIf
    Else
        MsgBox(4096,"", ".pdf file does not exist.")
        EndIf
EndFunc

Command-line for Acrobat is as follows:

acrobat.exe /t c:\1.pdf <printer name> <printer driver> <port>

The port WILL need "IP_198.168.x.x". Has to have the IP part if it is a network printer. At least for me it did. The printer name and printer driver can just be double checked in your printer settings windows. Simple copy/paste works. They have to be in qoutes if there are spaces.

Edited by gnosis3d
Link to comment
Share on other sites

I FTP to my home PC the resulting .PDF file(s) containing these pages.

Well what ftpprogram do you use ?? Mine server can execute a program when upload is finished.. You could then have a program at home that checks the uploaded file if its a pdf then print (make a autoit for that)

Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...