Generally speaking, door hangers are a legal form of advertising. Distributing door hangers is considered canvassing, not soliciting. In order to avoid crossing the line into soliciting, do not knock on any doors – simply place the door hanger over the knob and leave without attempting to engage the residents. If residents ask you to stop leaving door hangers at their homes, you should make careful note of those addresses in order to respect their wishes.
Disclaimer - This is for informational purposes only and should not be construed as legal advice. Prior to printing and distributing door hangers, please check your area's laws and regulations regarding door hanger advertisements to make sure you are in compliance.