Arik123 has asked for the wisdom of the Perl Monks concerning the following question:

Hi, Monks!

I want to modify a PDF, preferrebly with CAM::PDF. Specifically, I need to alter the Document Level Script (simply to edit that script). I couldn't find any reference in CAM::PDF documentation on how to do that. Any idea?


Replies are listed 'Best First'.
Re: PDF Document Level Script
by marto (Cardinal) on Dec 19, 2017 at 11:01 UTC

    By 'document level script' you mean the JavaScript content PDFs can have? I know that PDF::Reuse can work with this to some degree, I've no idea if CAM::PDF provides this. See also PDF::Reuse::Tutorial.

    Update: missing word.

      Thanks.... PDF::Reuse works to some degree, but it can handle only functions in the documents level script. I want some of the code there to be executed once the document is opened, and PDF::Reuse doesn't provide that capability. My template PDF did have such code, but PDF::Reuse simply deletes it (it doesn't recognize any JS code that isn't a function).

      So I'm still looking for a better solution. Any ideas? Maybe I can somehow locate that stream object, using CAM::PDF, and manually edit its content?

        As far as better solutions go, I've no further ideas I'm afraid, in order to provide any I'd have to do the same research as you. Feel free to report back with your findings.