JS2PDFInjector icon indicating copy to clipboard operation
JS2PDFInjector copied to clipboard

including complete js file

Open umnibot opened this issue 4 years ago • 2 comments

Hey, this works like a charm with a simple alert, etc. But will it work including a whole js script?

What I want to achieve is to include the js as we do in HTML for example

I have tried adding it like this in the js that I am including

var tagString = '<script async type="text/javascript" data-name="myscript" src="https://path_to_script/sdk.js" data-account="Pet" data-language="en"></script>';

var range = document.createRange();
range.selectNode(document.getElementsByTagName("BODY")[0]);
var documentFragment = range.createContextualFragment(tagString);
document.body.appendChild(documentFragment);

But it didn't work. Perhaps there is something else that should be done.

umnibot avatar Mar 29 '21 08:03 umnibot

I do not offer support for how to make JS work in PDF files unfortunately. I just needed to confirm a popup for my use case. When I tried to do advanced stuff a few years back I noted that PDF viewers are now more safe out of the box and deny a lot of things.

If you ever got something that worked in then sharing it here might help the community.

Thanks

cornerpirate avatar Oct 30 '23 10:10 cornerpirate

Tell me how can I rebuild your java source code for myself?

Kazakov12 avatar Feb 04 '24 09:02 Kazakov12