Thom Parker
Community Expert
Thom Parker
Community Expert
Activity
‎Feb 24, 2025
10:48 AM
This is a dynamic XFA form, not a PDF. It can only be viewed correctly in Acrobat. I'd only used in in the latest Acrobat DC.
The problem is with document, there is an error in the print script on the button.
However the script is simply trying to execute the print menu item. So try printing it from the "File->Print" menu item.
You probably are using the new Acrobat UI. To make this process easier, revert to the old UI.
... View more
‎Feb 24, 2025
09:51 AM
Copy the code I provided to the console window and run it as a test to add bates numbers to a single document.
The only thing you need to add is the rectangle coordinates. Use the method I outlined above.
Watch this video to learn about using the console window.
https://www.pdfscripting.com/public/images/video/AcroJSIntro/AcroJSIntro_ConsoleWindow.cfm
... View more
‎Feb 21, 2025
06:08 PM
A simple way to get the page coordinates for placing the field is to place one manually, the get the coordinates from it by running this code in the console.
this.getField("TestField").rect
Then in the code the rect looks something like this:
var rectPlacment = [1,2,3,4];
Please read this article:
https://www.pdfscripting.com/public/PDF-Page-Coordinates.cfm
Also look at this one:
https://www.pdfscripting.com/public/PDF-Form-Scripting.cfm
If the documents you are processing are all the same, then the placement rectangle will be the same, but if the pages are different sizes you'll need to write some code to find the correct coordinates. Everything you need is in the articles.
Find a list of field properties here:
https://opensource.adobe.com/dc-acrobat-sdk-docs/library/jsapiref/JS_API_AcroJS.html#field-properties
"textSize" is the property for the text size.
... View more
‎Feb 21, 2025
02:46 PM
1 Upvote
An easy way to add new text to a PDF is to use a text field. Use the doc.addField() function
https://opensource.adobe.com/dc-acrobat-sdk-docs/library/jsapiref/doc.html#addfield
var nCnt = 0;
var nBatesNum = 1;
var rectPlacment = ... Calculate placement ...;
for(var nPg = 0;nPg<this.numPages;n++){
var oFld = this.addField("BatesNum" + nBatesNum , "text", nPg, rectPlacment);
oFld.value = nBatesNum;
if(++nCnt >=6){
nCnt = 0;
nBatesNum++;
}
}
this.flattenPages();
Determining the placment of the number is up to you. There are also some text field properties that will need to be set, and possibly some text formatting. Up to you.
After the script is finished you should flatten the PDF.
If you want to see some examples of more sophisticated Bates numbers scripts, then see these links;
There is a free one here (the Stamp and Number Document):
https://acrobatusers.com/actions-exchange/
This one is a hopped up version:
https://www.pdfscripting.com/public/File-Name-Stamper-Action-Description.cfm
... View more
‎Feb 21, 2025
11:43 AM
My answer is not patronizing.
It is a fact, the form was acquired from an organization that encrypted it. Obviously they felt the needed to protect it. You suggested making unauthorized modifications to use it outside the intended purpose. That is actually pirating someone elses property. You are guilty.
You also didn't mention you'd already contacted the owner. That would have been helpful. So again your fault for not providing complete information.
Take your lumps and be honest about what you are doing.
... View more
‎Feb 21, 2025
11:07 AM
Since this is not your form, you really aught to speak with the owner to see if they can help you. Otherwise you are pirating someone else's property.
... View more
‎Feb 21, 2025
11:03 AM
To add to Try67's analysis. If a field value needs to be changed in a certain way, then the original value has to be preserved. Otherwise it can never go back. Calculations need to be a linear progression. It starts somewhere stable and then goes somewhere else. You don't have a stable starting place. Think about that.
Using the MouseUp event will provide an approximation. But it is not restoring the original value. Each time the number is divided and multiplied it losses data. Depending on the initial value, it could either maintain a stable value, or become unstable. So this is not a good strategy.
... View more
‎Feb 21, 2025
10:46 AM
It seems like the issue is outside of Acrobat, or at least something that is not coming back through the SDK. Which isn't surprising for a remote folder. I would suggest a test that saves the file outside of the SDK. It might provide some more insight to the issue.
Save the PDF to a safe, local temporary folder. Then use the OS api (from inside the plug-in) to move the file to the remote folder.
Another method might be to use the API for the remote folder service directly, rather than relying on the OS to interpret the operations.
... View more
‎Feb 21, 2025
10:01 AM
Just for future reference. Save files you need locally. Link are always unreliable, cause they change or go away. That link is probably invalid now, and doesn't have anything to do with your settings. They often have an expiration.
... View more
‎Feb 14, 2025
01:51 PM
The Console is displayed by pressing Ctrl-J.
See this video:
https://www.pdfscripting.com/public/images/video/AcroJSIntro/AcroJSIntro_ConsoleWindow.cfm
AI will screw you. It is the worst possible way to write a script. All it does is cobble together random crap from the web. Whereas the helpful experts on this forum, and others, actually know what they are doing and test code before providing it.
Don't ever ask someone here to fix crap from an AI.
... View more
‎Feb 14, 2025
01:46 PM
1 Upvote
See this web site:
www.pdfscripting.com
... View more
‎Feb 14, 2025
11:53 AM
There are errors displayed in the Console Window for all selections. The "Cleric" selection has the additional error that Nesa pointed out. But you should always check the console first and fix those errors.
... View more
‎Feb 13, 2025
11:49 AM
I think what Mike means to say is that it should not happen. The appearance of those checks is explicitly defined in the PDF, which is what PDF is all about. By definition, a PDF file should look exactly the same in all viewers on all platforms.
If it is not displayed the same, then that viewer is non-compliant piece of crap and you should avoid using it.
... View more
‎Feb 13, 2025
11:40 AM
1 Upvote
For future reference:
https://acrobatusers.com/tutorials/dynamically-setting-submit-e-mail-address/
... View more
‎Feb 13, 2025
11:39 AM
There is nothing to fix because there is nothing wrong, i.e., things being different than you would like does not mean they are wrong. However, if you edit the text, or change the box size/position, it is highly possible that the next time you open the PDF, or even the next time you switch to PDF Edit mode, the division in text boxes will change.
I shouldn't be suggesting this, but there is another way to edit PDF content that will get you where you want to go.
1. Delete the "text box" that has the content you want to modify.
2. Add the new text in the proper format. There are a few ways to do this. Here are the two simplest
a) Use the "Add text" tool. This is fast and easy but has the same problem you're posting about if you need to make changes.
b) Use a text markup annotation. You get the same fornt and formatting options, but the text is in its own separate box that can be easily modified. You'll need to flatten the PDF after you're finished.
All that said, performing major edits in the PDF is a really bad practice. You run the risk of corrupting the PDF beyond repair. Acrobat is not a document content editing tool. It is a document finishing, organizing, and analysis tool. Major changes should be made in the original document and then re-converted to PDF.
... View more
‎Feb 12, 2025
10:35 AM
This is something Acrobat does automatically when parsing the page content for editing. The why and how are mysteries.
Why do you care?
... View more
‎Feb 12, 2025
10:27 AM
For future reference:
https://acrobatusers.com/tutorials/dynamically-setting-submit-e-mail-address/
https://acrobatusers.com/tutorials/submitting-data/
... View more
‎Feb 11, 2025
05:00 PM
Tracking the selected value is done by saving it and watching for all changes to the checkboxes. Probably the best approach is to use a text field. The calculation event is called anytime any value on a form is changed. So it works for both saving the value and tracking changes. For the example code I'll assume the renaming I suggested.
Here's the script for a custom calculation on a hidden text field.
if(event.source && (event.source.name.split(".").shift() == "Block"))
{// only process field changes from the checkbox block
if(event.source.value == "Off")
{// Checkbox is turning off
if(this.getField("Block").getArray().every(a=>a.value == "Off"))
{// all checks are off so clear saved value
event.value = "";
}
}
else if(event.target.value == "")
{// No previously selected value, save current selection
event.value = event.source.value;
}
else
{// Current value, reject selected if it doesn't match
if(event.target.value != event.source.value)
{// Doesn't match so turn off
// Can't directly change field that is triggering this event, so delay
app.setTimeOut('this.getField("' + event.source.name + '").value = "Off";',10);
}
}
}
... View more
‎Feb 11, 2025
03:40 PM
Yes this is possible.
But to be clear. If no checkboxes are selected, then any checkbox can be selected? any row, any column?
Then only checkboxes in the same row as the first selected checkbox can be selected?
To do this you will need to track the value of the first check box selected. All other selections are then rejected if they don't match the saved value. The saved value can only change if all boxes are first unchecked.
I would also suggest renaming the fields to include a block prefix, like this "block.AddAlt1", "block.AddAlt2".
... View more
‎Feb 10, 2025
10:35 AM
1 Upvote
These articles will be helpful for programming dropdowns.
https://acrobatusers.com/tutorials/change_another_field/
https://www.pdfscripting.com/public/List-Field-Usage-and-Handling.cfm
... View more
‎Feb 10, 2025
10:11 AM
I see that now. It's aways in the details 🙂
... View more
‎Feb 10, 2025
09:36 AM
1 Upvote
Another way to implement this functionality is to use group naming for the fields. This would make the process more easily expandable, robust, and simplify it.
For example, use these field names: "8base.2", "8base.3", "8base.4"
Then the code can be written like this:
this.getField("8base").getArray().forEach(function(oFld){
if (oFld.display == display.visible) {
template.spawn(...);
... other code ...
}
});
And there is another issue that the other posters didn't mention. Don't use the spawnPageFromTemplate function. Use the "template.spawn()" function.
... View more
‎Feb 10, 2025
09:26 AM
Acrobat can't do this. Maybe there is a 3rd party solution, but I doubt it. This is not a feature a lot of people are asking about.
... View more
‎Feb 07, 2025
01:29 PM
#1. Accessibility has nothing to do with fillable forms. This is a different issue.
#2. Why would you think Acrobat would automatically add fields to the TOC? There is no reason to have fillable fields here. It did it because the automatic form field recognition is poor. If the form is not specifically formatted to make things easy for auto-field recognition, and even then, you'll have to add fields manaully. At a minimum you'll have to rename the fields and add other properties so the fields are usable.
... View more
‎Feb 07, 2025
01:23 PM
1 Upvote
Revert to the old UI.
Don't expect Adobe to fix anything.
... View more
‎Feb 07, 2025
10:19 AM
1 Upvote
There is no "field.toolTip" property.
... View more
‎Feb 06, 2025
05:40 PM
You are correct about how protected mode works.
An easy way to see all the loaded plug-ins is to open the Acrobat JavaScript Console window and run this code:
app.plugIns
The plug-ins I write all have an about box entry in the "Help->About 3rd Party Plugins" menu. That and a command menu item, which makes it easy to check whether its loaded or not.
... View more
‎Feb 06, 2025
03:50 PM
The sandboxpisdk::InitSandboxPIBrokerIPCChannel() function returns false when Protected mode is turned off. It only returns true in Protected mode if the specified broker exe file exists. But either way this doesn't affect whether or not the plug-in is loaded.
BTW, how are you determining if the plug-in is loaded?
Have you set breakpoints and walked through the plug-in initialization?
... View more
‎Feb 06, 2025
11:46 AM
The mostly likely possibility is that you are not signed in to your Adobe Account, or that you do not have a subscription to Acrobat.
... View more
‎Feb 06, 2025
09:39 AM
No, this is not normal. But the most likely cause is code in your plug-in that is causing it to not load.
In the PluginInit.cpp file, make sure that the PluginExportHFTs(), PluginImportReplaceAndRegister(), and PluginInit() functions are returning true.
... View more