From a quick search that didn’t provide anything really insightful, it seems that at least in Italian the term has been used since the XIV century, so it’s not photocopy related
Wait, the resemblance thing is also used in other languages: “spitting image” in English, for example, and “copia sputata” in Italian. I’m actually wondering for the first time where it comes from, so maybe there’s a reason for the Portuguese saying to be related to spit