Mupdf supposedly support JS when configured so. Would it be possible to add this as a USE flag to the ebuild?
Added dev-lang/mujs and + 01 Jun 2015; Michael Weber <xmw@gentoo.org> + +files/mupdf-1.7a-system-mujs.patch, mupdf-1.7a.ebuild: + Enable javascript support (bug 550286, Cedric Sodhi). +