adapt pdf generation for sub directory