Scale and Position PDF Image Fields in Adobe Acrobat
Question details
The user wants to know whether Acrobat JavaScript can scale or reposition an image inside a PDF image field.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Adjusting how an image appears within an interactive PDF form field.
- Observed behavior
- The desired result is an image scaled and aligned appropriately within the field.
Open the PDF in Adobe Acrobat and identify the image field's exact name in Prepare a Form. Image fields use button icons, so their available fit and alignment settings depend on the field configuration.
Scale and align the image with Acrobat JavaScript
Use field properties to control icon scaling and alignment programmatically.
Acrobat JavaScript is different from browser JavaScript: HTML and CSS cannot be used to style a PDF form field. Alignment settings position the icon within the field's available space; they do not provide unrestricted image panning or cropping.
Open Prepare a Form, select the image field, and check its name in Properties.
Open Acrobat's JavaScript Debugger and select the console. Replace ImageField in the following code with the exact field name.
Run this code in the console: var f = this.getField('ImageField'); if (f) { f.buttonFitBounds = true; f.buttonScaleHow = scaleHow.proportional; f.buttonScaleWhen = scaleWhen.always; f.buttonAlignX = 50; f.buttonAlignY = 50; }
View the image field in the PDF. Adjust buttonAlignX or buttonAlignY from 0 to 100 to change its alignment where unused space is available.

Adjust image fit in the field Properties dialog
Use Acrobat's form editor when you prefer to configure the field without scripting.
Edit PDF content and Office files with WPS Office
WPS Office is a free, lightweight alternative with a familiar interface for working with PDFs and Office documents. Its format compatibility makes it easier to bring existing files into your workflow. Use Adobe Acrobat for Acrobat-specific form JavaScript and image-field settings.

Frequently Asked Questions
Can Acrobat JavaScript move an image inside a form field?
It can adjust icon alignment with buttonAlignX and buttonAlignY. These properties control alignment within available field space, not unrestricted panning or cropping.
How do I keep the image's proportions when scaling it?
Set the field's buttonScaleHow property to scaleHow.proportional, or choose proportional scaling in the field's Options > Advanced settings.
Why does changing the image alignment have no visible effect?
Alignment depends on unused space within the field. If the scaled image already fills the field in that direction, changing buttonAlignX or buttonAlignY may not visibly move it.
Can I use CSS to position an image in an Acrobat PDF form?
No. Acrobat PDF scripts use Acrobat JavaScript rather than browser HTML and CSS. Use the field's icon properties or its Properties dialog instead.




