[lug] deconstructing pdf of voted Boulder ballots

Sean Reifschneider jafo at tummy.com
Mon Dec 12 23:46:17 MST 2011


On 12/09/2011 01:19 PM, Ken Weinert wrote:
> You might find that the 150 pixel high images is related to the hardware 
> that scans them. Might be related to a buffer size which was optimized 

There are all sorts of weirdnesses like that...

In the very distant past I was doing programming for Windows...  Version
2.11.  Part of my job was to write some code that would print a page of
barcode labels.  They had this "banding" API where you would set a band (a
stripe across the page), then draw the data to that band, and move on to
the next band.

This was an optimization, they said, to improve performance and prevent
having to build up a huge raster in memory or something.  I thought that
sounded like the weirdest thing ever, so my first attempt was drawing the
whole page.

I started the program, and some huge amount of time later, like 45 minutes,
it spit out the page.

So my next attempt was to use the banding API, grab the first band and just
call the function to draw the page.  They said you should draw only the
portion of the page that fit in the band, but I wanted to see the pretty
barcodes, so I just looped over the bands, drawing the whole page every
time.

BAM!  Now the pages printed in 30 seconds instead of 45 minutes.

There is weirdness in document handling.

Sean



More information about the LUG mailing list