I'm not sure what is "messy code", but there are alternative apps to export PDFs. My team develops this one, give this a try!
https://marketplace.atlassian.com/apps/5167/better-pdf-exporter-for-jira?hosting=server&tab=overview
(Discl. it is paid and supported and we're working on it.)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.