How do I set up printer sharing with a Windows 7 machine in Ubuntu?

This is a two part question, requiring 2 part answer.

First, Windows -> Ubuntu:

To begin with, you need to make sure that your windows host allows connecting to the printers. There are various things that could disallow access, the most common one being Windows Firewall.

Here is a quick howto

Now that you have a working share on your windows host, you need to add the printer to your Ubuntu host. This can be accomplished by going to System -> Administration -> Printing and by selecting the + Add button. From there the wizard will guide you through adding the printer. You will need to know the IP address or name of the windows host and name of the printer being shared to complete the wizard.

Next Ubuntu -> Windows:

The easiest way to accomplish this is by using IPP share to connect to the printer. Start by enabling Internet Printing Client as described in this knowledge base article

browsing to http://IP.OF.UBUNTU.HOST:631/printers/ and select the printer you wish to connect to and make a note of the full URL of the printer. Now go to Printers and Faxes on the windows host and start adding a network printer. At one point of the installation wizard you will be asked for the location of the printer, in the IPP field enter the address for the printer found on the webpage.

When the wizard asks for the driver to be used for the printer, use the CUPS Windows driver available from CUPS download page

Continue through the wizard and fill in the rest of the information normally.

You can also use the native driver for the printer, but you will then need to edit the CUPS mimetype support to include RAW printing which is done by editing /etc/cups/mime.convs file and uncommenting this line:

application/octet-stream application/vnd.cups-raw 0

You will also need to edit /etc/cups/mime.types and uncomment the line

application/octet-stream

After editing the files and restarting CUPS, you are able to print with native drivers as well.