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?