Friday, October 7, 2011

Tutorial: How to print directly from your Touchpad with non-HP printers

by theomodsim@precentral

Summary:
Touch2Pc Printer (you can find this in our App Archive#3) is a Windows application that emulates an HP printer and accepts print jobs from the TouchPad. From there, the received job is converted to PDF and optionally printed to a physical printer added to Windows.

How do I run it?
  1. Verify that .NET Framework 4 is installed on your machine (you can check by opening Add/Remove Programs and look for "Microsoft .NET Framework 4" or something similar). If it's not installed, you can download it at Download Details - Microsoft Download Center - Microsoft .NET Framework 4 (Standalone Installer)
  2. Open TouchPad2PcPrinter.exe and configure the options as follows:
    1. If you want to print to a physical printer, select the printer from one of the drop down boxes that corresponds to the capabilities of that printer (if you have a Simplex printer that prints Color, select that printer for the “Simplex/Color” drop-down). When you print from the TouchPad and specify 1-sided color printing, the print job will be printed on the “Simplex/Color” printer that you selected. You can support up to four different printing “profiles” by selecting different printers to handle jobs that require different capabilities.
    2. If you are only “printing to PDF”, check the check box labeled “Print to PDF only”. This will disable the drop down boxes for the output printer. All PDF files are still in color (there’s no way to force black and white PDFs) .It might be convenient to set your Output Folder to your DropBox folder, so you can immediately view the PDF from the TouchPad.
    3. If you wish to print to a physical printer, then you must select a PDF program to print with. Click the “Browse…” button for the PDF Program Path and search for AcroRd32.exe (Adobe Reader executable). Generally, the path for AcroRd32.exe is something similar to “C:\Program Files\Adobe\Reader 10.0\Reader\AcroRd32.exe”
  3. Click “Save”.
  4. Click “Start”. This will start the Touch2Pc Printer server.
  5. If a firewall warning dialog appears, be sure to allow Touch2Pc Printer network access (allow the firewall exception).
  6. On the TouchPad, open the Printer Settings application.
  7. Tap on “Add or remove printer”.
  8. Type in the IP address of your computer. If you’re not sure of your IP address, open a command prompt and type “ipconfig” and then press ENTER.
  9. You can name the printer whatever you want.
  10. You should now be able to send print jobs from the TouchPad to your computer!
Which ports need to be open?
Touch2Pc Printer requires that TCP port 9100 and UDP port 161 be open for the program to work correctly.

How does it work?
The program does multiple things, one of which is respond to SNMP requests sent by the TouchPad to identify the "printer". Whenever the TouchPad sends SNMP requests, the program responds with information about the HP pseudo-printer. Namely, SNMP variable 1.3.6.1.4.1.11.2.3.9.1.1.7.0 is used to retrieve the device string. This is how the TouchPad determines if a printer is an HP or not (see line 27 and 29 of SnmpObjects.cs to see what exactly the program sends as the response for that variable request).

Once the TouchPad has received the SNMP response, it then presents the user with the print dialog. After the user confirms the print job, the TouchPad sends the print job (as a PCL file) to TCP/IP port 9100, which the program is listening on. The program reads in the job.

After the program has received the job, it then uses GhostPCL's pcl6.exe to convert the job to PDF format. After the job has been converted to PDF format, the PDF file is optionally printed to a printer added to Windows, using Adobe Reader (or another PDF reader, provided it can be launched from the command line).

Disadvantages
I think the primary disadvantage to this solution is that you need to have a computer on the same local network running this program whenever you want to print. If you primarily use the TouchPad wherever you have a computer, that shouldn't pose a big problem.

License
Touch2Pc Printer is licensed under the GPL v3. However, it uses some components that are licensed under different terms (see legal.txt for details).

Special Thanks
Thanks to McTristan for working on several stability and new feature updates.

More Discussion:
http://forums.precentral.net/hp-touchpad-homebrew/299119-printing-any-printer-using-touchpad-solution.html

1 comment: