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

Image Field not able to change it to readonly?

New Here ,
Mar 25, 2020 Mar 25, 2020

Copy link to clipboard

Copied

Hihi

 

Pls advise how do I make the image field uneditable or lock or compress or flatten such that user not able to click and add a new image? 

This is the code i used but it seems not working: 

-quote-

this.getField("Letterhead1_af_image").readonly = true;

-unquote-

 

All other text fields are working well. 

 

Thanks,

Yixiang

TOPICS
Acrobat SDK and JavaScript

Views

397

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
LEGEND ,
Mar 25, 2020 Mar 25, 2020

Copy link to clipboard

Copied

What do the users click on to add a new image? 

 

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 ,
Mar 25, 2020 Mar 25, 2020

Copy link to clipboard

Copied

Hihi, 

 

User open the file using adobe reader or DC. User can just click on the image field area and the pop up dialog box will appear to allow user to add new image or edit it. 

 

My case: the user fills up the image and text on all the field and upon clicking the "save" button, the file will compress or flatten such that no text or image can be edited again. I am having issue with the image. how should i do it? 

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 ,
Mar 25, 2020 Mar 25, 2020

Copy link to clipboard

Copied

This will work when you use the correct name of 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 Expert ,
Mar 25, 2020 Mar 25, 2020

Copy link to clipboard

Copied

Where is this code used, i.e., when is it run?

Are any errors reported in the Console Window when the code is run?

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 ,
Mar 26, 2020 Mar 26, 2020

Copy link to clipboard

Copied

Hi 

 

Below is my full code. 

 

I have a button for user to click and the code should compress the fields including all the images. 

 

-code-

var cMsg = "Clicking on this button will render all information in this page to be locked. ";
cMsg += "\n\nPlease confirm all the information provided is final. Are you ready to proceed?";

var nRtn = app.alert(cMsg,2,2,"Question Alert Box");
if(nRtn == 3)
{
}
else if(nRtn == 4)
{ this.getField("Counterparty_pg1").readonly = true;
this.getField("Free1").readonly = true;
this.getField("Free2").readonly = true;
this.getField("Beneficiary").readonly = true;
this.getField("Relationship").readonly = true;
this.getField("Relationship2").readonly = true;
this.getField("Explanation").readonly = true;
this.getField("Name").readonly = true;
this.getField("Address").readonly = true;
this.getField("Country").readonly = true;
this.getField("PIC").readonly = true;
this.getField("PIC Phone").readonly = true;
this.getField("Bank name").readonly = true;
this.getField("Bank Address").readonly = true;
this.getField("Bank Country").readonly = true;
this.getField("Bank Swift").readonly = true;
this.getField("Beneficiary1").readonly = true;
this.getField("Account Currency").readonly = true;
this.getField("IBAN").readonly = true;
this.getField("Corr Bank Name").readonly = true;
this.getField("Corr Bank Swift").readonly = true;
this.getField("Signature circle_pg1").readonly = true;
this.getField("Signatory Name_pg1").readonly = true;
this.getField("Signatory Designation_pg1").readonly = true;
this.getField("Letterhead1_af_image").readonly = true;

}

 

-ends code-

 

Pls advise how to amend?

 

Thanks,

Yixiang

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
LEGEND ,
Mar 26, 2020 Mar 26, 2020

Copy link to clipboard

Copied

I've just run a simple test in Acrobat Pro 2020.006.20042, and I find that readonly can be set for an image field, and is respected.

I suggest you make a simple test PDF file with simpler code, see if the problem occurs, and share it if so.

Also please carefully answer ALL questions. Especially:

-Are any errors reported in the Console Window when the code is run?

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 ,
Mar 26, 2020 Mar 26, 2020

Copy link to clipboard

Copied

LATEST

There is nothing wrong with the code. Are you sure the field name is correct? Are any errors reported in the console.

 

Have you tried running this line of code by itself from the console window?

 

this.getField("Letterhead1_af_image").readonly = true;

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 Expert ,
Mar 26, 2020 Mar 26, 2020

Copy link to clipboard

Copied

Did you check the properties of all fields?

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