Forum How do I...?

Can I change the page background to an image with Prince.trackBoxes?

Rutger
Hi,

I have a question.

I would like to modify the page background after rendering when the page contains images with a certain class in the content.

    Prince.trackBoxes = true;

    Prince.registerPostLayoutFunc(analyze);

    function analyze() {

        var images = document.querySelectorAll("img.fullpagebackground");
        for (var i = 0; i < images.length; ++i) {

            var img = images[i];
            var boxes = img.getPrinceBoxes();

            // Here I know the page number and I would like to do something like this:
            // PDF.pages[pagenumber - 1].style.backgroundImage = ...
        }
    }


I can't seem to modify the page the way I would like, is there a solution that I might be missing?

Thanks in advance!