I far prefer the second sentence. It is like natural speech.
The document is valid only after it has been signed.
In the first sentence, the present participle in "after being signed" is awkward. A present participle usually describes something that happens at the same time as the main verb. It doesn't fit well with "after". The following is better in my opinion, though only marginally:
The document is valid only after having been signed.
I would revise it to:
The document is valid only when signed.
However, this is still in the compressed language you find on forms and so on, rather than natural speech. That is why I prefer your second version. It is like natural speech.