The Stamp script runs between the time that you click on the page and the stamp gets added to the page. If you try to flatten the page in that time... well... you see what happens.
However, if you put this.flattenPages() as the cExpr parameter in a setTimeOut method with (maybe) a 250 millisecond delay, it should work since the code won't execute until 250 milliseconds elapses.
What version of Acrobat are you using?
Thanks, I figured it was something like that. I will see if I can put in setTimeOut.
Good morning again,
So, the delay worked, but only within the stamp file itself. If I place the stamp either in the stamp pdf or in another pdf while the stamp pdf is open, the stamp pdf gets flattened. Am I missing an argument to specify the current file?
This is what I added to the end of my stamp script: