Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Invoice created. How to edit once and then lock it from being edited?

Avatar

Former Community Member
Hello,

I just started using LiveCycle the other day when I purchased CS4.



I created a custom invoice for my billing using text fields and numeric fields. This works fine and it looks good.



When I create a PDF from LiveCycle it has the fields that I can input my amounts into, text, and so forth.



How do I, once I edit the PDF lock it so that the clients I am sending the invoice to, can not edit it but only print it? I see this functionality only within LiveCycle itself, requiring a password to edit, however I would prefer to just edit the PDF myself (since I am the only one doing the billing) and then just lock it somehow rather than putting in a password each time.



Any ideas? I couldn't seem to find what I wanted here or in the help files.



Thanks
30 Replies

Avatar

Former Community Member
If you never need to modify the PDF again, (for example don't need to edit the form after the client pays, etc), would it not be simpler to just print to PDF to create an invoice that could only be printed. You might still need to apply security to the document in acrobat to prevent editing.

Avatar

Former Community Member
Hi Paul,

Is it possible to post the code for locking fields?



Thanks

Avatar

Former Community Member
If you post your email I will send it to you.

Avatar

Former Community Member
Hi Paul can you post to code. Im sure other might find it very very usefull. Thanks.

Avatar

Former Community Member
The code will not make sense unless it is in context of the form (I believe). I will post it here and you can decide for yourself:



/*************************************************************************************

Function: LockAllFields

Description: This function will lock all fields.

IN: The parent subform. It could also be an element that contains subform like form1

OUT : nothing

**************************************************************************************/

function LockAllFields(myParentObject){



var allChildElements;

var intNumElements;

var currentElement;

var j;



//Get all the child nodes of the parent element

allChildElements = myParentObject.nodes;



//Total number of element in the object

intNumElements = allChildElements.length;



//Loop through all the child elements

for(j=0; j< intNumElements;j++){

currentElement = allChildElements.item(j);

//If the element is another subform we'll recusively call the function again

if(allChildElements.item(j).className == "subform"){

LockAllFields(currentElement);

}

//If the objects are fields then set the access to readOnly

else if(currentElement.className == "field"){



currentElement.access = "readOnly";



}

//Check for exclusion groups - Radio Buttons

else if(currentElement.className == "exclGroup"){

for(k=0; k< currentElement.nodes.length;k++){

if(currentElement.nodes.item(k).className == "field"){

//set the access for the RadioButtons individually currentElement.access = "readOnly";

}



}

}

}

}//end function

Avatar

Level 1

where i put this code exactly ??

this is my mail if u can send me a simple  please   i need do that important

al-baker@msn.com

Avatar

Level 4

The attachment has been queued so I cannot download it.

Could you please send me it as well?    bmorash@london.ca

Thanks.

Avatar

Level 10

Hey Paul, I've got a script that does the same thing but is a lot shorter...does yours do anything different from this:

// Get the field containers from each page.
for (var i = 0; i < xfa.host.numPages; i++) {
var oFields = xfa.layout.pageContent(i, "field");
var nodesLength = oFields.length;
// Set the access type.
for (var j = 0; j < nodesLength; j++) {
var oItem = oFields.item(j);
if (oItem != this) {
oItem.access = "readOnly";
}
}
}