Thom Parker
Community Expert
Thom Parker
Community Expert
Activity
‎Feb 06, 2025
09:09 AM
Creating plug-ins for Reader takes some special sauce. You can read about it in the SDK Reference.
https://opensource.adobe.com/dc-acrobat-sdk-docs/library/plugin/Plugins_ReaderPlug.html#50618405_11144
For your first plug-in you should start with Acrobat Professional.
... View more
‎Feb 06, 2025
09:01 AM
The correct method for overridding a calculation so the field value can be entered manually is to set event.rc to false.
... View more
‎Feb 05, 2025
04:58 PM
You have a calculation order problem. And checking the source to block the calculation is inefficient, use event.rc.
... View more
‎Feb 05, 2025
12:55 PM
That's one approach. However, you can't catch and fix all the possible errors that might be made entering a time. A more universal approach is to test for valid inputs and reject invalid inputs with a warning to the user.
For example, here's a regular expression for detecting a valid regular time input.
var rgStdTime = /^\s*([01]?\d)\:([012345]\d)\s*((?:am?)|(?:pm?))\s*$/i;
Here's one that will match military time.
var rgMilTime = /^\s*([01]?\d)\:?([012345]\d)\s*$/i;
In both expressions the numbers are marked as subexpressions, so they can be extracted for reformatting.
... View more
‎Feb 05, 2025
10:25 AM
Of course.
Try it and see how it works.
... View more
‎Feb 05, 2025
10:23 AM
2 Upvotes
Use the "Will Print" and "Did Print" scripts under "Document Actions". You can find this tool by searching the tools for "Document Actions"
If you want to turn off borders for all fields. Use this code.
// Will Print Script
var oFld;
for(var i=0;i<this.numFields;i++){
oFld = this.getField(this.getNthFieldName(i));
oFld.tmp = oFld.strokeColor;
oFld.strokeColor = ["T"];
}
// Did Print Script, restores borders.
for(var i=0;i<this.numFields;i++){
oFld = this.getField(this.getNthFieldName(i));
oFld.strokeColor = oFld.tmp;
}
Note that the border style will also need to be remove and restored.
... View more
‎Feb 05, 2025
10:09 AM
Well then, you can use a simpler version of the code provided by PAS.
var oFld = this.getField("DropdownName");
if(oFld.value == "YES") oFld.value = "NO";
else oFld.value = "YES";
Add this code to an Acrobat Action Script.
... View more
‎Feb 05, 2025
10:05 AM
2 Upvotes
So the 3D JavaScript model is completely different from the Acrobat JavaScript model. It lives in it's own world. Has it's own objects and functions.
I haven't written anything for the 3d model in years, so don't know if there is a popup message window, but you can access the Acrobat model from the 3D model through the "Host" object.
Try this code:
host.app.alert("Hello World");
... View more
‎Feb 04, 2025
10:28 PM
The code you posted is perfectly fine and will run in any JavaScript context in the Acrobat environment.
You have not actually explained how you would like the app.alert to be run. Or the scripting context of the failures you've reported.
For the failures, did you place the script in a PDF document? for example on a form field? or in a document level script?
If so can you post the PDF?
Here's an article that may be of help.
https://www.pdfscripting.com/public/Editing-Fields-Properties.cfm
... View more
‎Feb 04, 2025
04:42 PM
Yes, this is possible.
The issue is identifying the dropdowns. Do all the dropdowns in the all the different PDFs have the same name? If not, is there a pattern to the names?
The options in a dropdown field are set with the "field.setItems()" function. Just call this function for fields that need changing.
... View more
‎Feb 04, 2025
04:19 PM
1 Upvote
Good choice with the validation script. This is indeed the correct place to do the conversion.
To do this correctly you'll need to write code that analyzes the entered value to determine how the script should proceed. Should it leave the value as is or do a comversion? The best way to do this is with a regular expression.
https://www.pdfscripting.com/public/Pattern-Matching-with-Regular-Expressions.cfm
The script should test for a standard time input first. Then test for military time. If both tests fail, then it's not a valid input.
Here are some tips on scripting in Acrobat:
https://www.pdfscripting.com/public/PDF-Form-Scripting.cfm
... View more
‎Feb 04, 2025
04:08 PM
1 Upvote
Adobe doesn't struggle with dot naming in simplified field notation. Let's put that to sleep right away.
If special characters in names are escaped, then there is no problem.
... View more
‎Feb 04, 2025
03:51 PM
This method does not work anymore. Sadly.
By @collette_4061
You mean using the field properties dialog to change the name and export value of a radio button?
Yes, it does still work. And if this isn't what you mean then you need to say explicitly what it is that you think is not working.
See theses articles.
https://www.pdfscripting.com/public/Checkboxes-and-Radio-Buttons.cfm
https://www.pdfscripting.com/public/Editing-Fields-Properties.cfm
... View more
‎Feb 04, 2025
03:45 PM
1 Upvote
Can you post the PDF?
Is the Arial font embedded?
... View more
‎Feb 03, 2025
12:47 PM
Use this code instead:
this.getField("JobCard").display = display.hidden;
However, this code should really be in a folder level automation script. There is no reason for it to be in the PDF.
https://www.pdfscripting.com/public/Automating-Acrobat.cfm
... View more
‎Feb 03, 2025
11:20 AM
This is not an Acrobat issue. Talk to support for your case managment software.
... View more
‎Feb 03, 2025
10:13 AM
One way to modify how data entered into a form field is shown, is with a custom format script.
Something like this.
if(event.value.length)
event.value = event.value + ",";
... View more
‎Feb 03, 2025
09:38 AM
Since the console is not reporting any errors, no error condition is being hit.
That doesn't mean the code doesn't have them. The code you posted is designed to exit the "while" loop if any non-zero number is returned from the "importTextData" function call. And further, the SaveAs function is only called if zero is returned. Well, it's happened. The "importTextData" function is returning 3. This is not an error that should exit the loop.
But, according to your posts, the code is operating exactly as you've designed it.
Well, except for the ".this.removeField("JobCard");" code. What's this about?
... View more
‎Feb 01, 2025
02:09 PM
That's really bad. Have you tried starting over with a newly created PDF? Could be that the PDF you're working on is corrupted in some way.
... View more
‎Jan 31, 2025
04:53 PM
Yeah, dissappearing calculation scripts is a big problem. This happens when Acrobat is confused about the selected calculation type, which happens when switching between fields. I haven't had this problem in a while because I'm very careful not to click on stuff too fast in any dialog in Acrobat. However, I understand that this issue can also happen with the built-in editor, which doesn't work that great. I would suggest setting up Acrobat with an external editor, such as Notepad++, which besides being an awesome code editor, is free.
I don't know if this will fix your issue, only Adobe can know that. But it's worked for me.
... View more
‎Jan 31, 2025
03:01 PM
Here's an article that covers the basics of scripting radio buttons:
https://www.pdfscripting.com/public/Checkboxes-and-Radio-Buttons.cfm
Basically, the default "On" value for a radio button is "Yes". But this is also the export value, which you can change to be whatever you want.
... View more
‎Jan 31, 2025
02:59 PM
1 Upvote
This article will provide you with some intro to forms information:
https://www.pdfscripting.com/public/PDF-Form-Scripting.cfm
... View more
‎Jan 31, 2025
11:15 AM
What is the formatting option on the dropdown field?
... View more
‎Jan 31, 2025
10:04 AM
1 Upvote
If your code is hitting the "3" return right away, then the script as written above will exit the loop and never hit the saveAs code. But since a 3 return is not a failure, the code should be modified to include the saveAs code when 3 is returned. I hope that makes sense.
Follow the advice from PAS, do an importTextData from the console and see if any fields are missing data. If not, then try running your SaveAs code in the console to see what happens. If all is good, then modify your script to do the saveAs when 3 is returned from the import.
... View more
‎Jan 30, 2025
05:46 PM
Did you check the console window (Ctrl-J) for errors?
... View more
‎Jan 30, 2025
05:15 PM
So 3 is returned when there is a column on the form that does not match a field name. The data is still imported, but it's letting you know that some data did not get imported.
... View more
‎Jan 30, 2025
05:11 PM
In a validate script the value of the newly selected item is in "event.value". Your scripts are using getField to acquire the field the script is in. This gets the previosly selected value, because the field value doesn't change until after validation is complete.
However, if you really wanted the field object, it is in event.target. So no need to use the getField function.
... View more
‎Jan 30, 2025
05:02 PM
There is probably something wrong with your data file. .
However, there is an error in your code.
On the saveAs line:
this.saveAs(...).this.removeField("JobCard");
The saveAs function return "undefined" so adding .this.removeField("JobCard"); is an error
... View more
‎Jan 30, 2025
04:50 PM
Can you post the form?
... View more
‎Jan 30, 2025
04:23 PM
1 Upvote
See this article:
https://www.pdfscripting.com/public/Value-Entered-Does-Not-Match-Format.cfm
... View more