In the case of this sample file, the white background is generated by the statements (the comments beginning with a percent sign added by me):
b [1 1 1] sc % set red, green, and blue to maximum, i.e. white
b 0 0 800 47 re % define a rectangle that describes the area
b f % fill the rectangle with the defined color
Note that the instructions like "sc" etc. are defined in the prologue section of the file.
And the file looks like generated by (or by a descendant of) the xpdf suite from a PDF file. Therefore the possibility of an algorithmic solution for stuff like this seems rather unlikeky