If your print-file generation code tries to exploit the headless browser you use to turn its outputs into PDF something has gone very wrong already.