This back and forth discussion with correct solutions provided by @santimir is due to the fact that you do not publish real and complete samples of input documents and desired resulting documents.
You keep bringing new facts which make it difficult to provide a complete working solutions.
This looks like your other thread that ended up abruptly from your lack of response.