How to remove JavaScript in PDF
You can use the pdf/makeunsearchable that takes input PDF and re-prints this input PDF as new PDF that will contain no bookmarks/actions/javascripts. Please check this page for more details https://developer.pdf.co/api/pdf-change-text-searchable/searchable