Thom Parker
Community Expert
Thom Parker
Community Expert
Activity
54m ago
Are you using the Show/Hide action on the MouseUp of the Radio buttons?
How many marital status radio buttons are there, and what actions are on each button?
... View more
4 hours ago
Yes, the calculation order is incorrect. Look on the more menu in the "Prepare Form" tools.
 
 
 
 
 
  
... View more
4 hours ago
So what you want to do is export data from one form and import data into several other forms.
Read this:
https://www.pdfscripting.com/public/Form-Data-Handling.cfm
... View more
4 hours ago
In both of the files, all OCG layers are duplicated. For example in the first document with two layers, there are two OCGs named "Layer 1" and two OCGs named "Layer2". The first instance (in the listing order) of both are not connected to anything. So that is why setting the state doesn't do anything.
To see this more clearly, run this code in the console window:
setOCGOrder(getOCGs())
... View more
‎Jan 17, 2025
03:52 PM
Can you make up a demo PDF doc and post it so we can check it out.
... View more
‎Jan 17, 2025
01:28 PM
Watch this video on the Console Window:
https://www.pdfscripting.com/public/images/video/AcroJSIntro/AcroJSIntro_ConsoleWindow.cfm
... View more
‎Jan 17, 2025
01:24 PM
Run this code in the console window
this.flattenPages();
It'll flatten all annotations in the PDF.
There is a free flattening tool here:
https://www.pdfscripting.com/public/Free_Acrobat_Automation_Tools.cfm
There is a selective flattening tool here, but it's not free:
https://www.pdfscripting.com/public/Selective-Flatten-Tool-Description.cfm
... View more
‎Jan 17, 2025
11:00 AM
Not in Acrobat. The correct way to do this is to submit the PDF to a server script that renames the files based on submitted query data and emails it. This is the only way to make this functionality avaliaible to the form, and it has the added benefit that it will work across many different PDF viewers, although not all, because not all support all data submission options, or data submission at all.
... View more
‎Jan 17, 2025
10:51 AM
This article provides a function for getting the OCG object by name, and shows how to show/hide layers.
https://acrobatusers.com/tutorials/create_use_layers/
... View more
‎Jan 16, 2025
04:44 PM
Setting the layer state to true will turn the layer on. Whether or not this makes the layer visible depends on the layer settings. Make sure it is set to "Visible when On".
... View more
‎Jan 16, 2025
12:04 PM
Your idea of a master list is spot on. The way to this would be to have all the company names in a CSV file.
An Acrobat automation script could be written to read the file and double loop through all the names, redacting the entire line for each name except for 1.
This is not a trivial piece of scripting. You should consider hiring a developer. PM me if you are interested.
... View more
‎Jan 16, 2025
11:23 AM
1 Upvote
Use the "util.readFileIntoStream()" function.
Here's the reference entry:
https://opensource.adobe.com/dc-acrobat-sdk-docs/library/jsapiref/JS_API_AcroJS.html#readfileintostream
... View more
‎Jan 16, 2025
09:25 AM
You can contact me through the messaging on this forum or at the pdfscripting site.
And you can always post questions here.
... View more
‎Jan 15, 2025
05:33 PM
1 Upvote
Here's a modification of the script to handle 3 colon, ":", separated values place in the image tool tip.
// Hide all image fields
this.getField("images").display = display.hidden;
// Unhide the selected field
this.getField("images." + event.value).display = display.visible;
// Get Additional values and place in form fields
var aExtraVals = this.getField("images." + event.value).userName.split(":");
this.getField("accuracy").value = aExtraVals[0];
this.getField("assault").value = aExtraVals[1];
this.getField("evasion").value = aExtraVals[2];
Note that this code assumes the extra values exist, and will not operate properly if they are missing.
... View more
‎Jan 15, 2025
05:16 PM
Yes, you can copy the script as is, which is seems like you've already done. Happy to hear it's working without issue.
For including additional data:
Note how the "unit_info_type" data is handled in the script. This data is placed in the image field tooltip, which for a script is in the "file.userName" property. The idea is to place the data in the field at a location where it can be easily entered by the user. The tooltip is perfect for this, as long as you don't care that the data is shown to the user. Another option is to entered it into the button label (set in the field properties dialog on the "options" tab). Since the button only shows the image, the label text doesn't interfere with the button appearance. The method for entering the hidden label text is to set the button for Label only in the properties dialog, enter the text in to the label entry, then change the button back to Image Only. The text will dissappear in the UI, but it's still there under the covers.
Now, to handle multiple pieces of data, all the data must be put in a single line of text, where each data element is delimited(separated) by something. Common delimiters are colons and commas.
The code then needs to get the text and break it up into individual parts for placement in the fields.
This is a small modification of the code I provided above.
... View more
‎Jan 15, 2025
01:06 PM
1 Upvote
Another option is to use field naming to make the code more efficient. Doing this way also means that it is easy to add and remove fields without changing any code, becuase it's all in the name.
For example:
Name the image fields like this: "images.Portanova", "images.Revernova",
To handle the extra information in "unit_info_type" field", place it in the tooltip text for the image field.
Then this code will work for any number of image fields.
// Hide all image fields
this.getField("images").display = display.hidden;
// Unhide the selected field
this.getField("images." + event.value).display = display.visible;
// Add unit info type data
this.getField("unit_info_type").value = this.getField("images." + event.value).userName;
With this method you can add, change, and remove images without changing any code.
... View more
‎Jan 15, 2025
12:40 PM
You need to tell us how the text that is to be redacted can be identified.
for example:
1) does the text appear in exactly the same page location in each document?
2) Can the text be identified from a search? You say these are company names. Would redacting every instance of a company name work?
In order to automate this process with a script we need to know the details.
... View more
‎Jan 14, 2025
02:18 PM
So, there is a mistake in the logic. Change this line. That's all.
event.rc = (Loc1 != "OTHER") && (Loc2 != "OTHER");
... View more
‎Jan 14, 2025
11:37 AM
1 Upvote
Man, that is a good article, if I do say so myself. It says it's for Acrobat 9 in the title, but everything in it is still bang on for Acrobat DC.
... View more
‎Jan 14, 2025
11:34 AM
Thank You! However, I think that quote was about how other post didn't work because they were about area location.
But regardless. Clear, explicit info is needed to provide good advice.
And on that topic, the poster stated they were having trouble with JavaScript. So it would be helpful to see the script they are using.
... View more
‎Jan 14, 2025
11:02 AM
1 Upvote
How is the information identified? It is simple to automate redaction if it's in the same location on every document, or it has a unique pattern that can be identified with text matching.
... View more
‎Jan 13, 2025
04:58 PM
About the varied results of width and height when converting icons on different systems. The buttonImportIcon function does not import images 1 to 1. It resizes them according to some methodology I do not understand. I can imagine that different versions might do it differently, but I think thats unlikely. You reported rather wild differences. Something else is going on. If you really want to test this you need to simplify your setup and only test the one thing.
I've also never had an issue with setting the size of image data, when I got that size from the icon stream. Which also makes me think something else is happening.
I don't use buttons to import images that are used by the dialog, unless that is the only choice. Mostly I'm placing static images on dialogs, such as a logo. For this I convert the original image with a program I wrote for this specific purpose.
But I've also made dialogs that create images dynamically.
The point is that there is nothing wrong with Acrobat and the way it handles images in JavaScript. The problem is something in your code.
... View more
‎Jan 13, 2025
04:48 PM
Main point. Refer to #2 on my first answer. Don't recreate the icon stream, just use the one Acrobat gives you.
replace this code:
var DialogData = {
"APDS": util.iconStreamFromIcon(getField("OMC.Stamp").buttonGetIcon(0),
"Fnme": objOMManager.NameFirst,
"Lnme": objOMManager.NameLast,
"nmID": objOMManager.IDnum,
"Mail": objOMManager.Email,
"Unit": objOMCenter.Unit,
"OSym": objOMCenter.OfficeSymbol,
"Stat": objOMCenter.State,
"OBox": objOMCenter.Email,
"OMrq": blnOMMrequired
};
Side Questions
1. I don't know. Never tested the limit. I've loaded 2kx2k images, which is way larger than any practicle use I've had for an image.
2. No, button images scale, the dialog image object renders pixel for pixel.
... View more
‎Jan 13, 2025
03:14 PM
It all depends on the browser, the environment, and as stated by try67, any plugin/addin used by the browser to display the PDF.
For example, by specifying a "MailTo" URL, the PDF is asking the viewer to open an email application. Maybe such a thing doesn't exist for the browser/pdf viewer. There are a lot of dependencies when in comes to email. It's much more robust to submit data to a regular URL. Of course this requires that there be something on the other end that understands the submission. But that's how it is.
You may want to tell users to download the PDF to thier desktop and then submit it using Adobe Reader.
... View more
‎Jan 13, 2025
10:21 AM
No, it won't work. Did you look in the Console Window (Ctrl-J) to see the reported error?
Acrobat is sandboxed. Meaning that scripts in a PDF operate only in the PDF/Acrobat enviroment, NO touching things on the users local system, unless specific security measures are taken. And even then, there are limitations in the API.
Read this:
https://www.pdfscripting.com/public/Trust-and-Privilege-in-Acrobat-Scripts.cfm
... View more
‎Jan 13, 2025
10:05 AM
So, a raster image is composed of rows and columns of pixels. In the Acrobat JavaScript model, a Pixel has 4 components that are 1 byte each ARGB, where A is the alpha channel. The width and height parameters in the icon stream object represent then number of columns and rows of pixels. These parameters are necessary for properly reading the image data and are unrelated to the width and height of the dialog image element. To generalize, all image formats (JPG, BMP, PNG, et.) specifiy width and height in pixels, cause without it the image data makes no sense. And this is exactly the reason the images you posted above are repeated and skewed, i.e., your code provided bad dimension parameters for reading the data. Scaling has nothing to do with it.
And Yes, the raw image data can be read and anaylized, and modified using the read() function. I've done this many times. There are however limitations on size. Acrobat JavaScript is a lightweight programming environment. It's both slow and memory limited. You are not going to be able to use it to write a tool for manipulating large photos.
... View more
‎Jan 10, 2025
07:22 PM
Use this code:
var Loc1=this.getField("Location1").value;
var Loc2=this.getField("Location2").value;
event.rc = (Loc1 != "OTHER") || (Loc2 != "OTHER");
if((Loc1=="Sports Center" && Loc2=="Transportation")||(Loc1=="Transportation" && Loc2=="Sports Center"))
{event.value=3.7}
else if((Loc1=="Sports Center" && Loc2=="Middle School")||(Loc1=="Middle School" && Loc2=="Sports Center"))
{event.value=2.3}
else if((Loc1=="Sports Center" && Loc2=="Senior High")||(Loc1=="Senior High" && Loc2=="Sports Center"))
{event.value=2.0}
The code must not end with a hanging "else". This will cause an error that will prevent the code from running.
Also, "OTHER" must match the selection text exactly, including case.
If the code doesn't work there may be an error somewhere. Errors are reported in the Console Window. Press (Ctrl-J).
Good Luck,
... View more
‎Jan 10, 2025
07:16 PM
You can have one form that includes all options.
However, in order to script the actions you would like, the form fields have to be named. It is the names that the script uses to manipulate the field data.
You can read more about form scripting here:
https://www.pdfscripting.com/public/PDF-Form-Scripting.cfm
... View more
‎Jan 10, 2025
07:13 PM
That is exactly what I was talking about. So, you discovered what I told you to look for. I never mentioned a right click menu, although I probably should have been more specific.
... View more
‎Jan 10, 2025
02:44 PM
To get the new month names you'll need a mapping object. Then the current month can be identified relative to the following months.
Here's a simple script that is placed in the "Validation" script for the initial signing month dropdown.
The script assumes the names of the next signing months are "NextSign1", "NextSign2", "NextSign3"
var aMonthNames =["January","February", "March", "April", "May", "June", "July", "August", "September", "October","November","December"];
var nMnthNum = aMonthNames.indexOf(event.value);
for(i=1;i<=3;i++)
this.getField("NextSign" + i).value = aMonthNames[(nMnthNum + i*3)%12];
This script can be modified to include the signing period and number of periods.
... View more