What is this four-legged part from under an inkjet printer head?
This part seems to look like a pair of IR receivers/transmitters, but the two appear very similar, 


I'd say you are correct. The transmitter is likely to be infrared so it won't be visible to the naked eye but should be visible to your digital camera / phone.







simulate this circuit &ndash; Schematic created using CircuitLab

Figure 1. Test circuit.

Try to find the IR LED by powering up with a 5 V supply and a 180 Ω resistor. Most LEDs can tolerate 5 V in reverse so you are unlikely to damage it. View it through a camera.

That should leave you with two pins to identify. This is unlikely to be a transistor as shown in my sketch but eliminate that first. With the sensor covered the voltmeter should read 5 V. If the transistor turns on the voltage will drop. You could "drive it hard" using an infrared remote control pointing straight into the receiver. 

Note that both lenses will have IR filters and so the receiver will not respond well to visible light.


  ... and I'm not sure why the printer would try to "look" at the paper.


To detect start of page and avoid spraying ink onto the printer itself in the event of a jam or short page.



If it's a photo-diode ...







simulate this circuit

Figure 2. Photo-diode test circuits.


(a) The photo-diode should give a little less than 1 V on diode test function on a digital multimeter.
(b) This circuit should allow you to detect changes in voltage across the reverse-biased diode when IR is shone on the device.