to_pdf function now is public