We are editing pages. Basically trying to remove everything visual within a specified Rect. We draw from your classic sample using Element_Reader and Element_Writer. That is we write all read elements, except for those we are trying to delete, and replace the new element list on the page. We use a trick you showed us to use XSet to avoid processing any XObject more than once in the recursive ProcessElements.
For the most part, this works fine for us, and has for some number of years.
Recently though we are seeing some strange results. I suspect it may be because in one edit, we eliminate an e_text element that is within a single set of e_text_begin/e_text_end elements, such as:
e_text: first line of interest
e_text: second line of interest
When we remove the first line of interest, the second line of interest disappears on us, as is seen by viewing the edited PDF page. My theory is because the both exist within text begin/end pair. Are we doing this correctly? Can the visual appearance of the first line of interest affect the second line of interest, so that if the first line were removed, it could cause issues for the second line?
Another thing to note is that we may find need to make another edit pass over the page, which may result in the second line of interest being removed.