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

annotation coordinate script

$
0
0

Trying to find coordinates of an annotation so I can create an automatic redaction script. I have been using this tutorial from adobe: http://acrobatusers.com/tutorials/2008/07/auto_redaction_with_javascript

 

When I run this part of the script (copied directly from the tutorial) to find the annotation coordinates I get several different errors every time I run it.

 

var rct = getAnnots(this.pageNum)[0].rect;

var left = rct[0];

var right = rct[2];

var top = rct[3];

var bot = rct[1];

qd = [ [left, top, right, top, left, bot, right, bot] ]

qd.toSource();

 

I am not well versed in JavaScript so any help would be great.

 

(Also if anyone knows of any existing scripts for automatic redaction that would be good too)

 

Thanks


Script to Split PDF files on Bookmarks

$
0
0

I'm totally new to Java scripting.  What I'm looking for is a script I can run from batch processing with professional that will look at a collection files in s directory and split ech one of them on their bookmarks into smaller files.

 

The bookmarks are all based on the page so it is possible to use the bookmark object's "execute" method to execute the bookmark action and pickup the page number.

 

I read that last part somewhere. If someone can give me a reference to a thread or just some code to get me started that would help. Thanks,

 

Josh

Is it possible to run a script from the command line in Windows

$
0
0

For example for joining two PDF files, I want to write code that read from a .txt file the names of the files that need to be joined and then do that. Without open Acrobat by myself and typing commands in the console.

 

Thanks!

Besoin d'un javascript pour afficher/masquer plusieurs boutons avec des conditions

$
0
0

Bonjour à tous,

 

Je suis dans le cas de figure suivant :

J'ai 6 boutons au total nommé comme ci-dessous :

a1, a2, a3, b1, b2, b3

 

a2 se masque lorsqu'on clique dessus et affiche a3

b2 se masque lorsqu'on clique dessus et affiche b3

jusque la rien de compliqué, j'utilise la fonction suivante pour afficher le bouton :

this.getField("nom du bouton à afficher").display = display.visible

Ou pour le masquer :

this.getField("nom du bouton à masquer").display = display.hidden

 

Maintenant, ça se complique.

Lorsqu'on clique sur a1, je veux que :

- a2 s'affiche et masque a3,b2 et b3,si et seulement si b2 était préalablement affiché.

ou

- a3 s'affiche et masque a2,b2 et b3, si et seulement si b3 était préalablement affiché

 

Même logique pour b1 lorsque l'on clique dessus :

- b2 s'affiche et masque b3,a2 et a3, si et seulement si a2 était préalablement affiché

ou

- b3 s'affiche et masque b2,a2 et a3, si et seulement si a3 était préalablement affiché.


Voilà mon objectif.

J'ai essayé plusieurs choses, notamment avec des variables et des fonction if...else, mais sans succès.

Je n'ai pas la bonne méthode ni la bonne syntaxe.


Si quelqu'un pouvait m'aiguiller se serait top.

Custom calculation script problems with Acrobat X form ~ newb

$
0
0

I could use a little help with a formula I'd like to use to calculate shipping costs. They are $4.63 for the first item and .25 for each additional item. This works; ((Quantotal - 1) * .25) + 4.63

But runs wonky when there are no items in the quantity total. I am guessing a conditional statement that checks for 0 is in the making, but not not from these fingers.

 

My effort looked like this:

var a=this getField("Quantotal");

var b=this getField("Shippingtotal");

if(a>0)then(b=((Quantotal - 1) * .25) + 4.63)endif;

 

Thanks for replies, thoughts and awesome code snippets

Need some help with button JavaScript for Save As event.

$
0
0

Hi,

I'm using Adobe Acrobat X Pro and am completely new to scripting forms in Adobe (completely new to Adobe Acrobat as well!).  On a form there is a save button that opens the Save As dialog by using a trigger (Mouse Up) and action (Execute a menu item - File>Save As...>PDF...) and this works fine, however, I want to now use javascript to modify this button's behavior so that is uses a trigger (Mouse Up) and action (Run a JavaScript), and I want that JavaScript to combine the text values from two form fields (a location Dropdown and a date Text field) and use this concateneated string + ".pdf" as the filename when it opens the Save As dialog.  Make sense?

 

This is what I have added to the button as a JavaScript so far I am using a test string at the moment ("NewFile.pdf") and will add the concatenated string to the script after I know the script is working as it should.

 

var newFileName = "NewFile.pdf";

var pathArray = this.path.split("/");

pathArray.pop();

pathArray.push(newFileName);

this.saveAs(pathArray.join("/"));

 

Two issues so far:

1. When I click the button nothing happens, no Save As dialog or anything. 

2.When I check the button properties under the Actions tab the Select Action property shows "Execute a menu item" even though I previously selected "Execute a JavaScript"

 

Thanks for any help!

How do I open and sign multiple PDF documents?

$
0
0

I would like to create a java script or some action steps that batch process many PDF documents.  There is a signature field on each page called 'Signature2'.  I would like to use my certificate to rapidly sign all the forms with minimal clicking.  The current way I've got to do it is going to give me carpal tunnel syndrome.  Any help would be much appreciated.

Open Data Object - Open File attachment within pdf document

$
0
0

I am trying to build a script which will open file attachments embedded in a pdf document.

 

I have used the following javascript to list all embedded files within a document so I can retrieve the name

 

var d = this.dataObjects;

for (var i = 0; i < d.length; i++)

console.println("Data Object[" + i + "]=" + d[i].name);

 

The console reported:

 

Data Object[0]=MTP-300-X-1210_A.pdf

Data Object[1]=MTP-300-X-1240_A.pdf

 

 

I then used the following script to open the file     

 

this.openDataObject("MTP-300-X-1210_A.pdf");

 

Console reports back as follows and does not open the file:

 

[object Doc]

 

Can anyone please offer assistance in how to open an embedded pdf attachment within a document?

 

Many thanks!


Script for calculating start time and end time

$
0
0

I am using Adobe Acrobat Pro and needing a script to calculate start time and end time for a timesheet (start time and end time are hh:MM) 24 hours please see below can anyone help me ......

 

Untitled.jpg

Text field not updating ?

$
0
0

I have a very simple script that was almost lifted from this forum.

 

The only changes I made were to make in generic so I could push it up to the document script level and call the same script for multiple buttons.

 

I have two input text boxes  (Section+"NewDefect" and Section+"NewDefectExport")

They get put into textVal, exportVal and stuffed into the list called (Section+"Issues") when a button is pushed

This works fine....  It should as it was lifted from this forum

 

My Issue.... I want to clear/reset/blank the input text fields when I am done....

 

I have tried textVal   = null, textVal   = " ", textVal.value   = null

getting the pointer again and setting it to " " ie :    var rawtextVal   = this.getField(Section+"NewDefect"); rawtextVal = " "

 

Why can't I blank/clear those text fields?

 

-------------------------------------------------------------------

function add_btn(Section)

{

    var textVal   = this.getField(Section+"NewDefect").value; 

    var exportVal = this.getField(Section+"NewDefectExport").value;

    var listFld   = this.getField(Section+"Issues");

    if (textVal)

    {

        listFld.insertItemAt(textVal, exportVal, 0);   // Everything works GREAT to here...

    }

    textVal     = " ";

    exportVal = " ";        // these seem to be ignored no matter what I do. a println shows they are being executed

}

------------------------------------------------------------------------

How to run script on Adobe Acrobat 9 Pro

$
0
0

HI all i'm new to Adobe Acrobat 9 Pro Scripting, and I'm hoping someone can help me how i can run any javascript on Adobe Acrobat 9 Pro.  I have no idea which place (location) take script then run.

 

 

Like Adobe InDesign CS4 script location=>

Application>Adobe InDesign CS4>Scripts>Scripts Panel>JavaScript

 

 

Run Path =>

Window>Automation>Script then run

 

Any insight is appreciated!

Thank you so much adv.

[email address removed by host]


Allowing user input to override autocalculations

$
0
0

How do I get a form field to allow user input that overrides the autocalculation? I'm particularly looking for a code snippet I can use and/or modify. The code I have now is included below.

 

 

//check bonus = stat bonus + applicable proficiency bonus
var profUse = this.getField("SklAcrProf").value;
var stat = Number(this.getField("DEX1").value);
var profVal = Number(this.getField("Proficiency Bonus").value);
var check = Number('-2');
if (profUse != "Off"){
    check = stat + profVal;
}
else{
    check = stat;
}
event.value = check;

Need help with pop up notice when form submitted

$
0
0

Hello,

I created a form that has a submission button at the bottom for the application to be emailed upon 'mouse up' action to an email address.

I want to put in a pop up of 'Thank you!  Your Application has been submitted'.

Can this be done within the pdf form somehow?

Any guidance or person who can do this is much appreciated!

 

Dena Price

how to call c++ activexComponent using javascript

$
0
0

Hi,

 

I need to call COM component using .js file.

it is saying as ActiveXobject is not defined in acrobat.

How to automatically set Print Scaling to 'None'

$
0
0

Is there any way to automatically set print scaling to 'none' on an existing PDF document?

 

This setting is set manually by going to File > Properties, and then going to the 'Advanced' tab and changing the 'Page Scaling' preference from 'Default' to 'None'. This preference can then be saved with the document.

 

There seems to be no way to do this via javascript but if anyone has found a way to automate this that would be great!!!

 

Ideally I want to run this as a batch process across a number of PDFs. Maybe as a last resort there is a way to do this using "execMenuItem"????

 

Many thanks in advance for your help!!!!

 

HJ


If Else Statement for PDF Form

$
0
0

I am unfamilar with JavaScript and need to create a calculation for a PDF form. The form is used to determine profit. There is a radio button called payroll with two values, "internal" and "external". One calculation to determine costs will need to say: if payroll equals "internal" then 1.02 else .98. This number will then insert in the costs field. The other calculation to determine markup will need to say: if payroll equals "internal" then 1.2 else 1.4. Thanks in advance for the assistance.

How to build list of (PDF) files in a local directory?

$
0
0

Folks,

Part of a project requirement I have requires that a PDF form dynamically build a list of PDF files in a local user directory.   The files vary from system to system, but the idea is for the user to be able to select a PDF file to open from within a master PDF file.

 

I haven't been able to find a way to do this.   Doing it from javascript or LiveCycle would be ideal (it's the dev tool we're licensed for), but it could conceivably be done from another development platform, as long as the functionality can be embedded in a PDF.  The ideal would be to simply embed a FileManager type control in the PDF.  I might be able to get away with  launching an instance of FileManager (Win) / Finder (Mac) on the local box, though I'd have to be able to determine the OS type, and it would have to work cross-platform.

 

Any ideas, or examples floating around someone could point me to?    Any suggestions appreciated!

 

Thanks!

-russ

How to Apply Security or Remove in Batch using Acrobat X

$
0
0

I’m using Acrobat X Pro. I’ve used Acrobat Pro 6-9. I need to remove security in batch and apply security to about 100 PDFs. I’m totally lost in Acrobat X. Where are all of the batch sequence commands that were in Acrobat 9? Can anyone point me to an article or tutorial on batch sequences and the new “Action Wizard”.

 

Thanks.

Custom calculations for time card

$
0
0

I have been looking for Java Script for my particular need and I can't seem to find the right one. We use a PDF form to track hours worked over various types of work codes. We use military time format in our form. I have a simple if/then scheme that will take care of the math, but I can't figure out the code for it. The major issue is when shifts cross over the midnight barrier and that's where the if/then comes in.

 

Easy Example:

v1 = Monday Start @ 0600

v2 = Monday End @ 1400

v2-v1 = Total time

 

Difficult Example:

v1 = Monday Start @ 2200

v2 = Monday Ends on Tuesday @ 0600

 

if/then

 

if v1<1200 then time = v1+2400

if v2<1200 then time = v2+2400

v2-v1/100 = Total Time

 

In this example the Monday start stays 2200 and the 0600 end becomes 2800 after the 2400 is added to the 0600.

Now (2800 - 2200)/100 = 6 hours

 

So the math is simple but the script is beyond me. Can anyone assist with this? And yes, Excel would be easier but I do not have that option. Thank you in advanced for anything you guys/gals might be able to throw at me.

Using Excel VBA to save PDF file as a text (plain) file?

$
0
0

I'm using 8.0 Acrobat Pro.

 

Third party apps are not an option (I'm restricted from installing anything on my office PC).

 

I could simply save each PDF manually, but given the number of files this would not be practical.

 

The text it will output does not have to be pretty by any means (and I'm aware it won't be).

 

As long as I can get the PDF files in a text file format, there would be no further obstacles for me - because I would then be able to get Excel to gather-import all the data and consolidate-clean-organize everything accordingly at that point.

 

What's in these PDF files are simply names, numbers, and email addresses (basic office text type data stuff simple).

 

I wish to save them all as text files, and then use Excel to suck all the data from those newly created text files and consolidate-organize them accordingly.

 

The VBA module I've seen referrenced around the web is the following beneath; however, I am having no luck with it.

 

 

 

I keep getting the error message:

ActiveX component can't create object or  return reference to this object (Error 429)

 

I am running Microsoft Office 2010 | Excel (and using Adobe Acrobat Pro 8.0).

 

Any help is extremely appreciated.

 

Here is the VB code in Excel I'm having trouble with:  What this is supposed to do is simply find the specified PDF file and save it as a Plain Txt File.

 

 

Sub Convert_PDF_To_Text_File()

'---------------------------------

Dim AcroXApp As Object

Dim AcroXAVDoc As Object

Dim AcroXPDDoc As Object

 

Set AcroXApp = CreateObject("AcroExch.App")

AcroXApp.Hide

 

Set AcroXAVDoc = CreateObject("AcroExch.AVDoc")

AcroXAVDoc.Open strPDFPath, "Acrobat"

AcroXAVDoc.BringToFront

 

Set AcroXPDDoc = AcroXAVDoc.GetPDDoc

 

Dim jsObj As Object

Set jsObj = AcroXPDDoc.GetJSObject

 

jsObj.SaveAs strOutputFile, "com.adobe.acrobat.plain-text"

 

AcroXAVDoc.Close False

AcroXApp.Exit

'---------------------------------

End Sub

Viewing all 12130 articles
Browse latest View live


Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>