makePdf uses args instead of global vars