• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
7

How do you resize an image in a interactive pdf

Community Beginner ,
May 21, 2024 May 21, 2024

Copy link to clipboard

Copied

Hi all, 
I have been using InDesign to create my company's ID badges. In that program, I can size the image to fill the entire rectangle without stretching or warping the image.
I have made this file into a PDF as the rest of the team have Acrobat and then can make their own cards for each department.

I have placed an image box through prepare form, but when I put a photo in it it will either stretch the image and make the faces long and thin or have empty space on the top and bottom of the image.

Is there a way to make it scale proportionately to fit the whole rectangle without distorting the image 

TOPICS
Create PDFs , Edit and convert PDFs , How to , Modern Acrobat , PDF , PDF forms

Views

1.5K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 21, 2024 May 21, 2024

Copy link to clipboard

Copied

What options do you use at the image field?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 22, 2024 May 22, 2024

Copy link to clipboard

Copied

In the prepare form tool, I just used the Image field component. Then put a normal image file into that 
At the moment I have the setting set to, Always scale - proportionately - fit to bounds
they are the only settings I've played with as the rest didn't seem to do anything 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 22, 2024 May 22, 2024

Copy link to clipboard

Copied

If the aspect ratio of the image and the image field do not match, then there is no other option than to either scale the image asymmetrically, crop it, or leave empty space. It sounds like what you really want is to change the field aspect ratio to match the image aspect ratio, i.e., resize the field. 

 

This can be done with a script. The first step is to aquire the image dimensions, from which the new width or height of the field can be calcuated to match aspect ratio. 

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 22, 2024 May 22, 2024

Copy link to clipboard

Copied

I'm not really sure what you mean sorry. I have attached an image of the file I'm working on. As it's a company ID and going out to multiple departments, I need a fix that the nongraphic designers/non-techy people can do. The files are just jpegs/ Pngs sent in by the staff. 
I have been creating these ID cards for the last few years so they will still need to look as close to my orginal file as possible. Ive also never done anything with script so would be very unsure where to start with that

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 22, 2024 May 22, 2024

Copy link to clipboard

Copied

In your example the image of the fox has white space above and below it in the image field.  This is because the ratio of the height to width of the image and the field are different. You can see that the way to make the image fit the field perfectly is to make the field shorter. You can do it manually in Perpare Form mode. Give it a try.  It can also be done with a script.  

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 23, 2024 May 23, 2024

Copy link to clipboard

Copied

I really can't make the field smaller as they need to be uniform across the company and each photo from staff will be a different size. 
Would the issue be that the field is a rectangle?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 23, 2024 May 23, 2024

Copy link to clipboard

Copied

The point of the script would be to resize the field to correctly fit the photo dimensions. 

 

The idea being that if photos are of different sizes, then the image field has to change size to fit the photo. 

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 23, 2024 May 23, 2024

Copy link to clipboard

Copied

So there isnt any script to make the photo fit to the photo field?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 24, 2024 May 24, 2024

Copy link to clipboard

Copied

Yes, there is a way to make the photo fit the field. Open it in an image editing app and crop it to fit the image field dimensions.   Otherwise, as I've been trying to explain, the only option is to change the field size. 

 

Do you understand the issue with the different aspect ratios between the image and the image field?

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 19, 2024 Sep 19, 2024

Copy link to clipboard

Copied

Hi Thom. Thanks for the above information which I have tried over the years. but had no luck I too have the same issue, but if you can share the script, then I can give it a try. I thought the team @ Adobe would have found a solution by now but no complaints, most of the features are simply fantastic. Loving it. Thanks.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 19, 2024 Sep 19, 2024

Copy link to clipboard

Copied

In fact there is not problem.  But here's something you can do. 

1)  Make the image field as large as it can be on the page without interfering with other content. 

2) Open the properties dialog for the image (button) field.

3) On the "Options" tab, press the "Advanced" button.

4) check the "Fit to Bounds" checkbox.

5) adjust the margin offsets to place the image in the button at the edge you'd like it to sit on. 

 

Done. 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 19, 2024 Sep 19, 2024

Copy link to clipboard

Copied

Great. Thanks Thom. That surely helped. Just wondering like some of the comments posted in the past to see if there is any way I can make the picture fit proportionately to the image field. The option you provided does help, but if there is any better option like a script, I can run to make it fit. Thanks once again Thom for your help and which is much appreciated. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 19, 2024 Sep 19, 2024

Copy link to clipboard

Copied

There is a script. Here's what you do. 

The image field already contains a MouseUp script that loads the image. 

Add code to this script that finds the aspect ratio of the loaded image and then sizes the field to fit that aspect ratio. 

You can get the image size by converting the icon object to an Icon Stream Object, which includes the width and height.  Use the util.iconStreamFromIcon() function.

https://opensource.adobe.com/dc-acrobat-sdk-docs/library/jsapiref/JS_API_AcroJS.html#iconstreamfromi...

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 02, 2024 Oct 02, 2024

Copy link to clipboard

Copied

LATEST

Hi Thom. Thanks for your help and guidance on the query I sent few weeks back. I meant to thank you long time back but just got side tracked. I haven't yet tried the script but will send you my feedback once I have used it. Thanks once again. Much appreciated.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines