How to get 3.3 output voltage in PC817 opto coupler?
If you have 12V feeding the input diode via 1K you will be producing a forward current of about 10mA. If you have a 1k resistor on the output that you hope to have 3V3 across it means an output current (Ic) of 3.3mA.

It looks to me like you will probably achieve about 3.2 volts on the output but this is a typical example only. In my experience, a lot of opto devices are worse than this so try driving the input a little harder (maybe 20mA) and try increasing the output resistor from 1k to 10k.