Skip to main content
New Participant
March 23, 2016
Question

I would like to automatically flatten document when dynamic stamp is applied.

  • March 23, 2016
  • 2 replies
  • 117242 views

Good afternoon,

I am looking to automatically flatten my document when I place a dynamic stamp. I am pretty new to Java and have cobbled together code to make my stamp, learning on the way.

I have tried adding this.flattenPages() to the script, but when I do Acrobat crashes when I place the stamp.

I cannot install the menu bar script to add a flatten document button, because I don't have admin permissions.

Thank you in advance for any help.

Patrick

This topic has been closed for replies.

2 replies

Inspiring
March 24, 2016

What version of Acrobat are you using?

patf_Author
New Participant
March 24, 2016

Morning,

Acrobat 11.0.15

JoelGeraci_Datalogics
Participating Frequently
March 23, 2016

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.

J-

patf_Author
New Participant
March 24, 2016

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:

function delayClose()

{

this.flattenPages()

}

app.setTimeOut("delayClose()",500)

Thanks,

Patrick

Participating Frequently
March 4, 2018

Why didn't you use event.source.source in that last one?


You mean app.setTimeOut("event.source.source.flattenPages()",500)? This won't work. I think my mistake is on how I use the app.setTimeOut...