Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

dynamic pdf up to 200 images, the size of pdf is larger, cannot save data and images to the form

Avatar

Level 2

Hi all,

My client would like to dynamic images up to 200 pictures to my forms. It is working fine. However, when I add images up to 35 images. I could not add images to the form any more. Then, I save data on the form. All images and data typed on the form are disappeared. I don't know reason.

If I only add 10 images - I can save data and images on the form. The size of pdf is 15456 kb.  I was unable to  add more pictures or data on the form.

Maybe there are problem the size of pdf? How much size can an dynamic pdf  limited?

Can we save the information and images as much as we want?

I have spent 2 weeks to work and try to figure out this problem. However it is not successful.

Please help,

Cindy

1 Accepted Solution

Avatar

Correct answer by
Level 10

You should ensure, that your users do not import big images.

Therefore you can use a script on the change event of an image field which checks the data size and warns the user if the file is too big.


function formatNumber(number) {


    var num = number + '',


    x = num.split('.'),


    x1 = x[0],


    x2 = x.length > 1 ? '.' + x[1] : '',


    rgx = /(\d+)(\d{3})/;


    while (rgx.test(x1)) {


        x1 = x1.replace(rgx, '$1' + ',' + '$2');


    }


    return x1 + x2 + "KB";


}




var sizeLimit = 200, //allow upto 200KB images


  thisSize = Math.round((this.value.oneOfChild.value.length * 3 / 4) / 1024);




if (sizeLimit > 0) {


  if (thisSize > sizeLimit) {


  xfa.host.messageBox("Note: With " + formatNumber(thisSize) + " the size of the imported image is greater that the recommended maximum of " + formatNumber(sizeLimit) + ".\nLarge images can cause a insufficent performance.\n\nIf possible, use images with the following recommended specs:\nFormat:\t\tPNG or JPG\nColor depth:\t8 Bit (higher is not supported)\nColor space:\tRGB (CMYK is not supported)\nFile Size:\t\t" + formatNumber(sizeLimit), "Recommended image size exceeded", 3, 0);


  }


}


View solution in original post

4 Replies

Avatar

Level 7

I've run into issues where Adobe Reader runs out of memory when using many images in a single PDF. I don't believe there is a limit to the number of images in the PDF format.

Avatar

Level 2

Thank you for your response.

If the Adobe Reader runs out of memory. What we need to do?

Thanks,

Cindy

Avatar

Correct answer by
Level 10

You should ensure, that your users do not import big images.

Therefore you can use a script on the change event of an image field which checks the data size and warns the user if the file is too big.


function formatNumber(number) {


    var num = number + '',


    x = num.split('.'),


    x1 = x[0],


    x2 = x.length > 1 ? '.' + x[1] : '',


    rgx = /(\d+)(\d{3})/;


    while (rgx.test(x1)) {


        x1 = x1.replace(rgx, '$1' + ',' + '$2');


    }


    return x1 + x2 + "KB";


}




var sizeLimit = 200, //allow upto 200KB images


  thisSize = Math.round((this.value.oneOfChild.value.length * 3 / 4) / 1024);




if (sizeLimit > 0) {


  if (thisSize > sizeLimit) {


  xfa.host.messageBox("Note: With " + formatNumber(thisSize) + " the size of the imported image is greater that the recommended maximum of " + formatNumber(sizeLimit) + ".\nLarge images can cause a insufficent performance.\n\nIf possible, use images with the following recommended specs:\nFormat:\t\tPNG or JPG\nColor depth:\t8 Bit (higher is not supported)\nColor space:\tRGB (CMYK is not supported)\nFile Size:\t\t" + formatNumber(sizeLimit), "Recommended image size exceeded", 3, 0);


  }


}


Avatar

Level 2

Thank you very much for your help.

Cindy