# Pdf writer, are loose objects always "on top"

**URL:** <https://www.ruby-forum.com/t/pdf-writer-are-loose-objects-always-on-top/124696>\
**Category:** Ruby\
**Created:** [January 1, 2008, 6:50am UTC](https://www.ruby-forum.com/t/pdf-writer-are-loose-objects-always-on-top/124696 "2008-01-01T06:50:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [January 1, 2008, 6:50am UTC](https://www.ruby-forum.com/t/pdf-writer-are-loose-objects-always-on-top/124696/1 "2008-01-01T06:50:49Z")

</div>

I have a watermark image that I want beneath the content of every  
page. I’d like to use loose objects so I do bloat the file, but loose  
objects seem to always be on top, making for a very poor BACKGROUND  
watermark !

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [January 1, 2008, 5:20pm UTC](https://www.ruby-forum.com/t/pdf-writer-are-loose-objects-always-on-top/124696/2 "2008-01-01T17:20:35Z")

</div>

On Dec 31 2007, 11:49 pm, “removed\_email\_address@domain.invalid” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I have a watermark image that I want beneath the content of every  
> page. I’d like to use loose objects so I do bloat the file, but loose  
> objects seem to always be on top, making for a very poor BACKGROUND  
> watermark !

Ok, this seems to work…

#===== shazam

# move the last content item for this page (the loose object)

# to the front pf the content array

#===== shazam  
c = pdf.current\_page.contents  
pdf.current\_page.contents =  
c.slice(-1,1).concat(c.slice(0,c.length-1))
