Skip to main content
Known Participant
Sep 3, 2020 2:01 PM UTC
Question

How we can restrict to user not to upload images more than 45 kb on PDF using Javascript on adobe

Hello All,

 

I have to write a Java scrript to User not to upload Images for More than 45 kb. I have checked the Bible did not find anything related to images size Validation , Could you please help me with this.

This topic is closed to new replies. Start a new post to keep the conversation going.

6 replies

try67
Community Expert
Community Expert
Sep 3, 2020 2:31 PM UTC

You can't do it while they're selecting the image to prevent them from doing so. Maybe you can use an On Blur event on the button or the document's Will Save event to check the length of the icon stream, as mentioned, or even the file-size...

Translate
Bernd Alheit
Community Expert
Community Expert
Sep 3, 2020 2:20 PM UTC

You can check the size of the icon stream.

Translate
Known Participant
Sep 3, 2020 2:47 PM UTC

I have used this method but it's giving same value for diffrent images 

var im1 = this.getField(event.target.name);
// get the icon for image 1
var icon1 = im1.buttonGetIcon();
try {
var iconStream1 = util.iconStreamFromIcon(icon1);
var dd= icon1.toSource().length

Is this not correct?

Translate
Bernd Alheit
Community Expert
Community Expert
Sep 3, 2020 3:07 PM UTC

Check the size of iconStream1

Translate