Expand my Community achievements bar.

SOLVED

How to reduce size of image while uploading it in livecycle pdf.

Avatar

Level 2

Hi,

I have created a pdf with Image field using live cycle designer.

I have selected "Sizing: Scale Image to fit Rectangle".

Now the problem is the pdf which i have created is 1.5MB and if i import or upload a 2.5MB image in image field then the size of pdf becomes 6MB.

I have around 20 image fields in my pdf report , so if people keep uploading high resolution images in the pdf then the pdf becomes more then 15MB, slow and unmanagable.

Is there any way by which even if I upload a 5MB image the it should automatically reduce image size?

As the users does not bother to reduce the size of image they just upload high resolution and large size image in pdf.

Please tell me the way through which i can reduce the image size automatically while uploading.

Regards,

Kartik Shrivastava

1 Accepted Solution

Avatar

Correct answer by
Level 2

I figured out that this is not possible  so I managed to have a workaround:

1. Restricting user from uploading an image greater than 250kb size using this script:

2. Use this script in "validate" event of script drop down ("ImageField1" is image field name)

if(ImageField1.resolveNode("value.#image").value.length > 250000)

{

if(xfa.host.messageBox("Image size should be less than 250KB","",0,0)==1)

{

ImageField1.rawValue = null;

}

}

Also, I wanted to have image center aligned and use this in "initialize" event of javascript drop down:

this.para.hAlign = "center";

xfa.layout.relayout();

Using this script in "enter" event also works:this.para.hAlign = "center";

this.para.hAlign = "center";

Hope this helps

Regards,

kk

View solution in original post

1 Reply

Avatar

Correct answer by
Level 2

I figured out that this is not possible  so I managed to have a workaround:

1. Restricting user from uploading an image greater than 250kb size using this script:

2. Use this script in "validate" event of script drop down ("ImageField1" is image field name)

if(ImageField1.resolveNode("value.#image").value.length > 250000)

{

if(xfa.host.messageBox("Image size should be less than 250KB","",0,0)==1)

{

ImageField1.rawValue = null;

}

}

Also, I wanted to have image center aligned and use this in "initialize" event of javascript drop down:

this.para.hAlign = "center";

xfa.layout.relayout();

Using this script in "enter" event also works:this.para.hAlign = "center";

this.para.hAlign = "center";

Hope this helps

Regards,

kk