Quantcast
Channel: Adobe Community : Popular Discussions - JavaScript
Viewing all 12130 articles
Browse latest View live

Calculating Age from DOB field in Acrobat

$
0
0

Hello everyone,

 

I am placing this JavaScript code below in the calculate tab in the custom calculation script window for an Adobe acrobat form I am creating.  The user will enter in the DOB field "mm/dd/year" and the age output should be in the "age" field.  For the moment the code works up to the the day 12th day after that the age does not show up in the age field and if I put a date of 1/16/1973 my age should be 39, but my age comes out as 38.  Can anyone tell me what I am missing in the code?  All so its not accounting for the leap year.   Any help will be appreciated.  Thanks!

 

event.value = "";

dobValue = getField("dob").value;

if (dobValue!="") {

dob = util.scand("dd/mm/yyyy", dobValue);

today = new Date();

age = today.getFullYear() - dob.getFullYear();

if (today.getMonth() < dob.getMonth())

age;

else if (today.getMonth()== dob.getMonth())

age;

else if (today.getDate() < dob.getDate())

age;

else if (today.getDate() == dob.getDate())

age;

event.value = age;

}


Scan a folders/subfolders for PDF files to find the corrupt/unreadable one?

$
0
0

Hi...

We have archive share with 400.000 pdfs in many subfolders. Some of them is corrupted or unreadable. Need some way to find this pdfs.

 

tnx

Submitting to a different email address based on a drop down selection - ios compatible

$
0
0

Using Adobe Pro DC I have used a code posted in a forum about a year ago in order to change which email my submit button will go to based on a dropdown selection:

 

var email = this.getField("drop").value;

this.mailDoc(false, email);

 

This works perfectly using a windows computer (thank you!!!). However, when I pull it up on my iPad, using the Adobe Acrobat Reader app - it no longer recognizes the script and nothing happens when I push the submit button. I understand that not all custom javascripts will work with mobile apps however I feel like this one is so simple i'm hoping there is a way to make this one work on the ipad mobile app...

 

That being said, I have another very simple javascript encoding that works perfectly on both my PC and the mobile app on the iPad:

 

var a=this.getField("drop");

event.value=(a.value);

 

 

If the above one works on the ipad, I'm thinking there has to be a way to make the first one work on it as well...

 

If this doesn't work, is there another way to do this other than javascript so that the reader app will support the function?

 

Thanks in advance for any help

Adding a formula to form with acrobat professional

$
0
0
I am new to this so please be nice. My boss handed me the program last week and I have been creating a form (to the best of my abilities). I need to know how to insert a formula into a field so that it automatically calculates the total.

This is my formula (per excel format)
=(box1*32.9+box2*67+box3*75.8)*0.9

Is there a place in the object palette where I should be putting this in?
What all should be checked and entered in order for this to automatically calculate the total for the above equation?

Thanks so much!

Dependent dropdown lists in Acrobat

$
0
0

Hi,

 

I am a first time poster and was looking for help with some scripting in a PDF form I have created.

 

I am basically looking to have a second dropdown list dependant on the value of the first but I'm not having any success.

 

I have tried the following as a calculation and as a MouseUp Javascript action but to no avail.

 

Basically, I'm looking for the following: If a user selects a School/Unit called Registry in dropdown 1, it will populate with 4 or 5 locations in dropdown 2. I need to do this for about 20 units. I think I'll be ok once I get one unit working but I can't get to that stage

 


// clear the dropdown displayed value and items
this.Value = null;
this.clearItems();


// repopulate the items based on the checkboxes
if(this.getField("School/Unit").Value == "Registry")
{
     this.addItem("Location 1");     this.addItem("Location 2");     this.addItem("Location 3");     this.addItem("Location 4");     this.addItem("Location 5");

}

Can anybody help me please?

 

Many thanks

Scott

preloader and element overlay

$
0
0

I have an html page with two section.

left section is tree with many knots, default with one and rest are appearing after clicking +

by clicking each knots the related page will be displayed in the right section.

Right section data itself has many internal links.

Loading time is varying depends on the data to be loaded.

Problems now:
There is no pre loader in both section or general.

Solution I needed

  1. Display a preloader and an element overlay on the left section  to prevent the user interaction till the data loaded in the right section
  2. Display a preloader and an element overlay on the right section till the page/data fully loaded here to prevent the user to interact with partly displayed items.

Is it possible to simulate a button click?

$
0
0

Hi,

 

i want to click a button using a script in acrobat pro dc, how can i do this?

Split PDF Files by Bookmarks

$
0
0
Can anyone please let me know how do I split PDF Files by bookmark using Java Script.

I am making a Visual Basic utility to read the bookmarks in PDF Files and split them based on the bookmarks. I am able to split the PDF Files by using Arts PDF Split Pro. However since I am already using Adobe Standard, I would like to do it with Adobe itself.

Thus, I pay license for only one software and not two.

Thanks
Rahul

How to get original file name in batch processing when HTML files are being processed?

$
0
0

I'm working on a batch process javascript that will be running on HTML files to save them as pdfs, however it seems that when acrobat opens the HTML files since it has to render them it creates a temporary file. When I use this.path to get the file name and location it returns the temporary file path instead of the original. Is there a way to get the original path?

dynamic stamp with an incremental number

$
0
0

How to create a dynamic stamp with an incremental number every time I stamp in the PDF. This will be used by only one person and installed on a single computer. Thanks for your help in advance.

Once a dropdown is set to readonly I need a button to be hidden, how can I do this?

$
0
0

I have tried everything and can't get it to work. Here is one that I tried:

 

var HourField = this.getfield("Hours");

 

 

if (HourField.readonly == true){

  this.getfield("Submit Button").display = display.hidden;

}else{

  this.getfield("Submit Button").display = display.noPrint;

}

Can You Change A Check Box Color When Checked?

$
0
0

Would like to know if there is a script available that would turn a "Yes" Check box to a green background "No" to red and "In Progress" to yellow?

 

Yes_No_In_Progress.jpg

How I could delete a page with a specific attribute ?

$
0
0

Hello.

I would like to know if it's possible to delete a group of a page in pdf which contains a specific property.

 

The main pdf contains more than 100 pages. On a few pages, there is a text property like "DoNotPrint".

 

At first I've tried to convert in XML this pdf, to gain a parent / child structure... and if I detect the attribute in a child node I could delete the parent node (and then the entire page).

But this pdf is full of graphicals diagrams... so this solution will not work.

 

That's why I'm trying to work directly on the pdf.

Could you tell me if it's possible ? I see that it's possible to delete a range of page, but could I do that with my condition ?

 

Thanks a lot !

Automatically send copy of completed acrobat form to recipient's email address located on the form?

$
0
0

I'm new to acrobat forms and JavaScript.  I've created a contact form for my technicians in the field to use to sign up a new customer.  Once the form is completed I need the customer to sign the form.  After signing the form, can I write a javascript to automatically email a copy of the form (that can no longer be edited - like a flat file version) to the customer's email address which is one of the text fields within the form itself?  Is this possible and can you help me out with where I put this and the code?

Change positive number to Negative

$
0
0

Hello,

I am using the SUM function in calculated field to add and subtract values and display the results in a "Total" field.  In order to make the subtraction work, the user has to enter a negative number in the "Losses" field.  I would like to have the user just enter a number and have the field automatically change it to a negative number.  Is there a way to do this, or should I be approaching this in a different way?

 

Capture.JPG


Code to not allow two text fields to be field at the same time

$
0
0

Hi Guys,

 

I would like to ask for your help on a JavaScript code.

 

I don't have a lot of experience with JavaScript and I'm trying to add a code for a pop-up, to alert the user that only one field needs to be filled out.

 

In the form there are two main types of fields and the user should only fill one of them and not both of them.

 

Is there a way to add a code to each field text to alert the user that only one text field should be filled out?

Redact using quads

$
0
0

If you have your redactions already marked is there a way to loop through and gather the coordinates while applying another process using Acrobat Pro 9.5?  I was looking at this,  https://acrobatusers.com/tutorials/auto_redaction_with_javascript , and other examples but they all seem to be static numbers for the quads.  I'd just like to apply a strikethrough on the redactions I have marked and if possible place a stamp based of the quads coordinates.

in Acrobat DC-I would like to change the font of a text field to strikethrough after I check the checkbox next to it.

$
0
0

I am working on a document in Acrobat DC and want to be able to use the check boxes like a checklist. Once the box is checked I want the font in the text field the check box is associated with to have a strikethrough font.

Is this something that would need javascript?

The textfield name is 4MedHistoryMedication1 and it already has Calibri as the font type.

The checkbox is named 4MedHistoryMed_1_RXonFile

When the checkbox 4MedHistoryMed_1_RXonFile is checked, then the text in4MedHistoryMedication1 will be Calibri ; So any text content already typed into that text field will get the strikethrough font.

Please remember I am not familiar with Javascript.

Can javascript be used to batch replace images within a PDF from image files?

$
0
0

I want to batch process the images within some PDFs. I'm thinking the way to do that would be to export all images from the PDF to separate image files, batch process those in a photo editor, and then use javascript to batch replace the original PDFs' images with the processed versions. However I haven't been able to find any indication of such ability in the Acrobat SDK or any mention on the internets of anybody having tried it. Does anybody know if it's at least in theory possible? Can anyone point me to the right function to use?

 

Note that there's more in these PDFs than images, so rebuilding new PDFs from the processed image files is not an option.

How to change the background color of a textfield while changing its value?

$
0
0

Hi,

How to change the background color of a textfield while changing its value?

 

The value of the field is actually "" and the background color is red.

Now, if i type something in, the background color should get set to transparent.

 

So i think im looking for a custom keystroke script, but how it has to look?

Thanks.

Viewing all 12130 articles
Browse latest View live