How do I set the z-order for a element on a PDF page?

How do I set the z-order for a element. We need to change the Grey background box. rest of the text and images are static.


The Z-order on a PDF page corresponds to the location of element (e.g. element count) in the display list. You can use ElementReader/ ElementWriter to traverse and edit PDF display list as shown in ElementEdit sample:

Since you just want to change the color on a background rectangle, there is no need to change the Z order. You can modify the fill color directly on a given rectangle.