baumi's blog

baumi's personal blog … Linux, OS X, Windows, Random things, …

printing bing ads invoices with cups / lp: white pages

tried printing Microsoft’s BingAds invoices with lp/cups. Result: prints blank pages 😉

Solution: run through imagemagick’s “convert”. gives a warning (see below), but works:

Screen Shot 2016-06-06 at 19.43.58

ATTENTION:
New, better solution (way faster!). The old solution stopped working (upgraded to Ubuntu 16.04 und changed cups printer setup. can’t tell what exactly was breaking it):

pdftk "$infile" output "$outfile" flatten

So basically i’m running something like this on every PDF:


function processpdf
{
        infile=$1
        outfile=$2

        mshit=`grep -m 1 -o "Microsoft Reporting Services PDF Rendering" "$infile"`
        if [ -z "$mshit" ]
        then
                echo "Not a Microsoft PDF, skipping ..."
                mv "$infile" "$outfile"
        else
                echo "Fixing Microsoft PDF mess ..."
                #echo convert -density 1200x1200 "$infile" "$outfile"
                #convert -density 1200x1200 "$infile" "$outfile"
                pdftk "$infile" output "$outfile" flatten
                rm "$infile"
        fi
}

export -f processpdf

find /tmp/bingads/ -type f -name '*.pdf' -exec /bin/bash -c 'processpdf {} {}.fixed.pdf' \;

Comments are currently closed.