Total Pageviews

Wednesday, 31 July 2013

Livecycle Designer: Select Specific Record from Excel Table - Working

1. Create Table in Excel:
  • You need excel sheet name
  • Table Header Name











2. Adobe Livecycle Designer ES2: Set Form Properties
  • File-->Form Properties-->Default Tab-->Target version--> Select Acrobat and Adobe Reader 7.5 or later (Version 9 was selected and did not work for me)



























If you do not follow the Step 2 then it shows error message: Property command could not be set because doing so would violate the permission settings.

3. Adobe Livecycle Designer ES2: Create dynamic DropDownList from Excel Table
  1. Window menu-->Select Data View-->On the Data View pane right click-->New Data Connection--.OLEDB Database-->Click Build Button-->Select Microsoft OLEDB Driver for ODBC Drivers-->Click next-->In the Use data source name select Excel files-->Browse to the folder and select the file-->Select SQL Query and type: select * from [Electric Bicycles$]. Here Electric Bicycles is the excel sheet name. after $ name you can choose the cell range
  2. From the Tools Menu-->Select Option-->Select DataBinding-->Check Show Dynamic Properties
  3. Add a DropDown list from the standard object library-->Select DropDown list -->Select specify item values-->Select DataConnection and Item and Value
  4. From the Window menu--> select Script Editor
  5. Now select the DropDown list and type the following code while Show: Change, Language: FormCalc, Run At: Client selected


var sSKUName = xfa.event.newText
var sSKUId = $.boundItem(sSKUName)

xfa.sourceSet.DataConnection.#command.query.commandType = "text"
xfa.sourceSet.DataConnection.#command.query.select =
  concat("SELECT * FROM [Electric Bicycles$] WHERE SKU ='", sSKUId ,"' ORDER BY SKU;")
   
xfa.sourceSet.DataConnection.open()
xfa.sourceSet.DataConnection.first()

nancy.presence = "visible"


































Here:
sCategoryName: is the text getting from dynamic DropDownList
sCategoryId: is the value of the DropDownList text
Electric Bicycles: is the working sheet in the Excel file
'""': variable name is used inside single and double inverted comma.
nancy: is a subform name where all the button or text field stay





Word 2010: Printing to pdf without borders

So I've been all over the Internet trying to find a solution to my problem -- couldn't get Word to print to a pdf without a white border around the page. I finally figured it out, and I hope it works for you!

In Word file, go to Page Setup:
Settings - Page Attributes
Format for - Any Printer
Paper Size - click here and then click on Manage Custom Sizes

Click + to add new size - name it PDF borderless
Click in the paper size boxes to make 8.5 x 11 (or whatever you need)
Make sure Non-Printable Area says User Defined, and change margins in boxes to 0
Click OK

Go to Print menu:
Printer - choose any 
Presets - Standard
Click on PDF - Save as PDF
Choose file name and save location
Click Save

Voila! I'm so happy!!

Some printers do not allow completely borderless printing.

You can completely borderless printing using the windows photo print wizard (found by opening picture & fax viewer and clicking print) - using a photo as a test).

Monday, 29 July 2013

Livecycle Designer: Selecting specific database record

Selecting specific database record
Every now and then, someone posts a comment with a question on how to do something and the answer requires more than just a quick response. In this case, it was Ricardo’s question on how to select a specific record from a data connection to a database for editing in a form.
If you read my previous post on Connecting a Form to a Database, you might’ve realized that the result was a single live data connection to the entire set of records in a database. This is great if you want to iterate through all records one at a time and update them on an individual basis. You might’ve also realized that you could narrow the scope of the data connection by specifying a more specific SQL statement (with a WHERE clause, for example). But what if you wanted the form to filter, on the spot, the data loaded from the data connection? For example, you might want to let the user pick from the different movie categories (action, comedy or drama) and then let them iterate through only that subset of the Movie Database.
If you’ve been scratching your elbow, pinching your nose and blinking your eyes in hopes that this might “just work”, well, it’s actually scratch your nose, pinch your elbow and roll your eyes — ok, just kidding…
The idea with this sample (based on the Movie Database) is to design a form which has a drop down list for picking a movie category and then a subform (which appears only once a category has been selected) that contains the movie data for all movies with the selected category.
The key to achieving this functionality is to use two data connections. (It’s important to note here that while you may only have a single data connection which loads data from an XMLData file, you may have any number of data connections to web services (WSDL) and databases (ODBC).) Furthermore, the use of SQL statement is crucial to making this work properly.

xfa.sourceSet.{DataConnectionName}

When you define a data connection in the Data View palette, you’re actually defining a <source name=”{DataConnectionName}”> node within the <sourceSet> packet inside theXDP file (which is then wrapped in a PDF if you save your form as a PDF file). Since this is defined in the XDP using XML, you can access its properties just like you can get at the properties of the objects you place on your form.
In this sample, I’ve defined two data connections to the Movie Database:
Two Data Connections
If you look at the XML Source which describes these connections, you can see that there’s an interesting command node which contains information about the query currently being used by each data connection. That’s what we ultimately want to modify once the user picks a movie category:
Source Set XML

//query@commandType

You should note that the query node’s commandType attribute value is very important. Setting it to text will let you specify the SQL statement used by the data connection. Other possible values are table (to let you specify a table name for the data connection) andstoredProc for specifying a stored procedure.

Data Node Names

Another very important thing to note is the names given to the data nodes in theMovieCategories data connection. You’ll notice that the following SQL statement is used for the data connection:
SELECT id as catId, name AS catName FROM movie_categories
GROUP BY name ORDER BY name;
In particular, the id and name columns have been renamed to catId and catName, respectively. That’s because having data nodes with the names “id” and “name” in your data connection will give you a lot of headaches when attempting to iterate through the xfa.record.{DataConnectionName} node in order to find the data associated to the current record from a data connection (so that we can display the category names in the drop down list, for example). This is because the words “id” and “name” conflict with properties of the xfa.record object.

Building the Form

Category List

The first step is to use the Data Drop Down List object from the Custom tab in the Library palette. This is a really handy object that has code in its Initialize event that’s already setup to populate its item list based on data nodes from a data connection.
In the Initialize event of the object, set the data connection name to “MovieCategories”, the hidden value column name to “catId” and the display text column name to “catName”.
If you run the form at this point, you should get three values in the list: “Action”, “Comedy” and “Drama”.

Movies in the Category

Next, create a subform (let’s call it “movieData”) which contains fields with explicit bindings to the title and showTime data nodes from the MoviesInCat data connection using the Binding tab in the Object palette. Also, add the Data Connection Controls object from theConnecting a Form to a Database sample to this subform (making the proper adjustments for the data connection name in each button’s Click event script) and make this subform invisible.
At this point, you should have a form which displays a list of categories and contains an invisible subform.

Filtering Records Displayed by the movieData Subform

Finally, in the Data Drop Down List’s Change event, write a script which sets the SQLstatement used by the MoviesInCat data connection, opens the connection and displays the movieData subform. For this sample, I chose to use FormCalc to script this event.
First, get the category selected by the user and determine it’s associated ID:
var sCategoryName = xfa.event.newText
var sCategoryId = $.boundItem(sCategoryName)
Given the XML structure of the <sourceSet> packet displayed above, you first set the query’s command type to “text”:
xfa.sourceSet.MoviesInCat.#command.query.commandType = "text"
This ensures that the data connection will use an SQL statement. Note the pound (#) prefix to the command property of the MoviesInCat node.
Then, set the SQL statement, on the MoviesInCat data connection, which will filter the records from the movie table in order to show only those that belong to the selected category:
xfa.sourceSet.MoviesInCat.#command.query.select =
  concat("SELECT title, showTime FROM movies WHERE categoryId = ",
    sCategoryId, " ORDER BY title;")
Finally, open the data connection, move to the first record and show the invisible subform:
xfa.sourceSet.MoviesInCat.open()
xfa.sourceSet.MoviesInCat.first()
movieData.presence = "visible"
Opening the data connection will cause the explicit bindings you set earlier on the fields in the movieData subform pertaining to the movie title and show time data to be used in order to load data from the xfa.record.MoviesInCat record (which will now contain the data from the first record of the MoviesInCat data connection as per the SQL statement we just built using the selected category ID).
If you want to “run” this sample, you can download the form and Movie Database here:
Minimum Requirements: Designer 7.0, Acrobat Standard 7.0.
Use the FormBuilderDB20060929.sql file to build the database, create an ODBC Connection named “FormBuilderDB” and load the form.
Update for Designer/Acrobat 8.0 forms: If you’re attempting to reproduce this sample or something similar in your own forms using Designer and Acrobat 8.0, you’ll most likely run into security errors when attempting to run the form in Acrobat 8.0. This is due to new restrictions imposed on modifying data connections at run time in XFA 2.5 forms.
Updated: February 6, 2007

Posted by Stefan Cameron on September 29th, 2006
Filed under Data Binding,Scripting,Tutorials

Getting a List's New Selection

3
Have you ever struggled to figure-out what item from a list (list box or drop down list) a user had just selected in the list’s Change event? If so, it’s possible you were trying to use the
rawValue
property in order to get at this information.
Unlike other objects such as exclusion groups, the rawValue property of a list object doesn’t reflect the new selection until the selected value is committed to it (by the user tabbing or clicking away from the list). That means that if you’re trying to, say, make a certain field visible at the moment when a particular item in the list is selected, you can’t use therawValue property because it still contains the old (previous selection) value.
Instead, you must use the
xfa.event.newText
object/property of the Change event itself and possibly the list object’s
boundItem
function in order to determine the value associated with the new selection.
When scripting any XFA event, you always have access to properties (information) of that event via the
xfa.event
object. In the case of the Change event (which occurs when the list’s selection changes), the
xfa.event.newText
property is of particular interest because it contains the text portion of the item that was just selected in the list. It’s important to note that this is only the text portion because if your list contains items with values that differ from their text (you’ve associated both a text and value part to each item in the list), you’re probably even more interested in determine the value associated with the new text that was just selected in the list. Fortunately, that’s an easy problem to solve as well:
this.boundItem( xfa.event.newText ); // JavaScript
$.boundItem( xfa.event.newText ) // FormCalc
will return the value bound (associated) to the text from the list’s new selection.
So there you have it: When handling a list object’s (list boxes or drop down lists) Change event, don’t rely on the rawValue to get the new selection: Use xfa.event.newText andboundItem(text) instead.

Posted by Stefan Cameron on September 23rd, 2006
Filed under Events,Scripting

PDF Form: Programming List and Combo fields in Acrobat and LiveCycle forms - Part 1

Programming List and Combo fields in Acrobat and LiveCycle forms - Part 1

By Thom Parker – September 18, 2007
Was this tutorial useful to you?
Rating: 
 Log in to rate:
Print version of this tutorial
Scope: All Acrobat Full versions (not Standard) and LiveCycle Designer
Skill Level: Beginner
Prerequisites: Familiarity with Acrobat and LiveCycle forms
There are times when entries in a Combo box or List field need to be changed on the fly. For example, a parts order form might include two drop-down lists (combo fields); one for selecting an assembly and one for selecting a part within the assembly. Each time a different assembly is selected, the list of parts needs to be changed to reflect the correct assembly parts for that selection. 
A different scenario is where individual items are added or deleted from a list, such as an e-mail distribution list. In this example, the form has two list elements: the master e-mail list and the distribution list. On the form, buttons are provided for both adding and deleting entries to/from the distribution list. 
In all cases, manipulating list entries requires scripting. In this two-part article, we’ll explore programming options for both scenarios outlined above. In Part 1 (this one), we’ll learn about using list events and re-populating the list entries. In Part 2, we’ll learn about modifying list entries one at a time. Sample code for both Acrobat forms (AcroForms) and LiveCycle Designer forms (XFA forms) is provided in the article. Each of the example files contains more complete code than is presented in this article along with some bonus scripts for doing more advanced list manipulation.

General list operations

Before getting into the nitty-gritty details of each example, let’s take a higher-level view and look at some programming features shared by all list fields, regardless of forms technology. A List field, as the name implies, is a list of items sorted into some order. The user interacts with a List field by selecting one or more items from it. Typically, there will be a display string and an export value assigned to each list item. For both AcroForms and XFA forms, the export value is a string. Finally, a list should have some properties for controlling how it behaves.
While each of the forms technologies has its own diverse set of properties, two common list properties are a parameter for making the list single or multiple selection, and a parameter for controlling how item selections are committed. Committing is the process of taking the selections made by the user and applying them to the value of the field. This can be done when the focus is moved to another field, or immediately when the user makes a selection.
To manipulate a list programmatically there must be functions or properties to:
  • Add and remove items to and from the list
  • Get and set an item’s display and export values
  • Order the items
  • Get and set item selections
  • Set various list properties 
Each forms technology has a different way of handling these features. Unfortunately, neither does a very good job of providing good functions for all the items listed above. However, both forms technologies do have enough support functions that it only takes a little extra coding to cover the holes.

Part 1- List Events, populating and clearing a list

Example files:
In this example, we’ll use a parts order form with two drop-down lists on each order line, as shown in Figure 1. (see page 1 in the example files). The first drop-down list selects the Assembly. The second drop-down is a list of parts for that assembly. Obviously, the parts list must change each time the Assembly selection changes.   
Figure 1: Order form using two lists. Assembly selection changes entries on parts list.

In order to do this, we need a master list of lists. This master list must contain all the parts lists for each assembly type all the part prices. We’ll use an object literal stored somewhere in the document to accomplish this. The location where the master list is declared is different for each of the two forms technologies, but the list itself is the same. 
var oAssemblyParts = {
 Chasis: [ 
  ["-","None"], ["Rear Bracket",205.95], 
  ["Front Bracket",185.95], ["Long Support",44.95],
  ["Front Bearing",48.95]
 ],
 
 Clutch: [ 
  ["-","None"], ["Plate 1",15.95], ["Plate 2",22.95],
  ["Inside Shaft",44.95],["Outside Shaft",32.95]
 ],
  
 Brake: [
  ["-","None"], ["Master Cylindar",139.95],
  ["Slave Cylindar",85.95], ["Pad",15.95],
  ["High Presure line",22.95]
  ],
   
  Coolant: [
  ["-","None"], ["Pump",35.95], ["Thermostat",19.95],
  ["Coolant Line",8.95],["Reservoir",17.95]
 ]
};
Each entry in the object is a name/value pair separated by a colon “:”. The name is the Assembly name. The value is an array of the items for the parts list. Each item is small array containing the part name and the price. For example, use this code to get the item list for the “Clutch” assembly:
var clutchItems = oAssemblyParts["Clutch"];
To get the price of the “Plate” in the “Clutch” assembly, use this code:
   var nPlatePrice = clutchItems[2][1];
We’ll also need a way to trigger the script that modifies the parts list. Each List field receives a number of events from Acrobat. There are events for Mouse Up, Mouse Down, On Focus and more. We’ll use the change event on the Assembly list to re-populate the parts list from the master list object. Both AcroForm and XFA Forms have this event and use it in approximately the same way. The change event is triggered when the user selects a list entry. 

AcroForm solution

In AcroForms, the master list and all the supporting functions are placed in a Document Level Script. This is the standard location in an AcroForm for doing initialization and set-up activities. 
The first supporting function is for setting the part entries. Fortunately, the master list contains the part/price information in exactly the right format for the function that populates a List field. The only other thing we have to be concerned about is handling the case where no Assembly is selected. In that case, we need to clear the list. Here’s the code:
function SetPartEntries()
{
 if(event.willCommit)
 {
  // Get the new parts list from the Master List
  // Since the selection is being committed,
  // event.value contains the Assembly name
  var lst = oAssemblyParts[event.value];
  // Clear the Parts list if there are no parts for the selected assembly
  if( (lst != null) && (lst.length > 0) )
   this.getField("PartSelect").setItems(lst);
  else
   this.getField("PartSelect").clearItems();
  // We have a new parts lists and the first entry is
  // is a non-selection, so clear the price field.
  this.getField("Price").value = 0;
 }
}
Notice that the AcroForms model provides a single function for setting all items in the list. We simplified our programming task by formatting the master list to take advantage of this function, the “field.setItems()” function. 
To use our “SetPartEntries()” function, simply call it from a the Keystroke Event of the Assembly list field, like this:
SetPartEntries()
The Keystroke event is called whenever the user changes the list selection, so in this case it’s really the Change event, which could be caused by a mouse action or by a keystroke.
The only other general-purpose function we need is one to handle populating the Price field when a part is selected: 
function SetPriceValue()
{
  
 // In order to get easy access to the export value, i.e. Price. This
 // function needs to be run on the un-committed change event. 
 // This field is set up for Commit on select so we know the value
 // will be committed anyway.
  
 if(!event.willCommit)
 {
   
  // If the export value is Not a Number then
  // set the price to zero.
   
  var nSelExp = 0;
  if(!isNaN(event.changeEx))
   nSelExp = event.changeEx
   this.getField("Price").value = nSelExp;
 }
}
In AcroForms, there are two kinds of Change events: Committed and Uncommitted. The difference between these two is more important for Text fields than it is for List fields, but for this function, we specifically want the Uncommitted Change event because this event makes the export (i.e., price) value available to us through the “event.changeEx” property. This is a matter of convenience, since it would only take a few more lines of code if we were to use the Committed Change event.
To use the “SetPriceValue()” function, simply call it from the Keystroke Event of the Parts list field, like this:
SetPriceValue()
The full implementation for this example can be found in the example file, ListProgramming_Part1_AcroForm.pdf.”  In this file, there are three order lines so the two general-purpose functions (SetPartEntries() and  SetPriceValue()) are written in a more generic way to work with any of the drop-down lists in any line. This is done with creative field naming. Always pay close attention to how you name form fields. There is a direct relationship between the names you choose for the fields and how easy it is to program the form.
XFA-form solution
In an XFA form, the master list and support functions are placed in a Scripting object. The Scripting object can be attached to any sub-form in the form hierarchy, but the best location is on a parent sub-form close to the fields it will be working with, i.e., the parent of the order row, which is where it is located in the example file, ListProgramming_Part1_XFAForm.pdf.” 
There are several advantages to using LiveCycle Designer for this example. The number one reason is that no special code is required for handling multiple order rows like there was in the AcroForms example. Each row is in its own sub-form and the code only needs to reference fields in the same row. Another advantage is that rows can be added to the form dynamically. 
Unfortunately, the list programming model for XFA is not that great. There is no function for populating the List field with all new entries like there is in AcroForms. The entries have to be added individually. Here is what our function for setting the part entries looks like in an XFA Form: 
function SetPartEntries()
{
 // Since entries are added one at a time it is necessary to
 // clear out the list first.
 PartList.clearItems();
 
 // The ComboBox value is not dependent on the list selection
 // so this also has to be cleared.
 PartList.rawValue = null;
 Price.rawValue = 0;
 
 // Grab the list of parts from the Master list and loop

 // over it to add entries into the Parts List Field.

 
 var aParts = oAssemblyParts[xfa.event.change];

 if(aParts && aParts.length)
 {
  for(var i=0;i<aParts.length;i++)
  PartList.addItem(aParts[i][0],aParts[i][1].toString());
 }
}
In XFA JavaScript, it is the "xfa.event.change" property that holds the text for the new selection. Another difference between this code and the AcroForm code is the parts list and the price field have to be explicitly cleared.
To use this function, simply call it from the Change event of the Assembly list, like this: SetPartEntries(); To populate the price field, we use a function very similar to what was used in the AcroForm code, with one main difference. In XFA JavaScript, the “boundItem()” function is used to retrieve the export value from the selection text. Here’s the code:
function SetPriceValue()
{
 // If the export value is null or not a number
 // then set the price to 0.
 var newPrice = 0;
 newPrice = PartList.boundItem(xfa.event.newText);
 if(isNaN(newPrice))
 {
  newPrice = 0;
  Price.rawValue = newPrice;
 }
}
To use this function, call it from the Change event of the Part List field, like this:
SetPriceValue();
 The full implementation for this example can be found on page one of ListProgramming_Part1_XFAForm.pdf.”

Summary

In this article, we learned how to use the Keystroke event and the event object to instantly capture the user’s selection on a Combo Box field. This was done for two different Combo Box fields. In one case, the selection was used to re-populate the list on another Combo Box. In the other case, the selection was used to set a field value. 
In Part 2 of this article, we’ll delve deeper in to the mysteries of List fields, taking a look at list sorting and how individual items can be added to or deleted from a List or Combo Box field.

Livecycle Designer: Populate Text Field Based On Drop-Down List Selection - Javascript code

Let's say the text field is named "TextField1" and that you've associated a value to each item in the drop down list so that the selection is easy to compare in order to determine which initial (default) value to set in the text field. In your drop down list's Change event, you could use the following script (in JavaScript): 


var sNewSel = this.boundItem(xfa.event.newText);
switch (sNewSel)
{

  case "1": // car purchase
    TextField1.rawValue = "Basic features:\n- frame\n- wheels\n- glass";
    break;
  case "2": // other purchase
    TextField1.rawValue = "Basic features..."
    break;
  default: // unknown value -- do nothing
    break;
}

Livecycle Designer: Connection a PDF Form to Database

Source: http://forms.stefcameron.com/2006/09/18/connecting-a-form-to-a-database/
In response to Lala and malik’s questions on connecting a form to a database (whether it’s Microsoft Access, MySQL, etc. doesn’t really matter), I decided to write a little tutorial on how to do it.
Even if you already know how to do it, I encourage you to pay special attention to the section on Auto-Incremented Table Columns because it might help you understand and resolve some of the issues you may have already run into.

Create a System DSN

First, you need to create a System DSN for your database using the ODBC Data Source Administrator Windows tool.
ODBC Data Source Administrator
That will let Acrobat interface with your database when your form is opened in Acrobat in order to be read and/or filled. Because of the DSN, it doesn’t matter what kind of database you need to connect to.
For this tutorial, I’ll be using my FormBuilder database which contains the same kind of movie information found in the XML Data files from various other tutorials I’ve already posted:
This SQL file will create the database and a user if you’re using something like MySQL (for which you can also download a free ODBC driver). You should also be able to easily tweak it to create tables in a Microsoft Access database if that’s what you want to use.

Make a New Data Connection

The second thing you need to do is create a data connection in Designer: From a new or existing form, open the Data View palette (you can use the “Window | Data View” menu item to open it) and choose “New Data Connection” from the palette’s fly-out menu.
Data View Palette Fly-Out Menu
In the “New Data Connection” wizard, pick “OLEDB Database” from the first screen, using the “Build” button on the next screen to open the “Data Link Properties” dialog, go to the “Connection” tab and pick the name of the DSN you created in the first step from the first drop down list. Then click the “Test Connection” button to make sure a connection can be established to the database via the DSN.
Data Link Properties Dialog
Click on OK to close the “Data Link Properties” dialog and return to the “New Data Connection” wizard. Now that you’ve chosen a DSN, you’ll be able to specify the resource within that DSN to which the connection should be made: You may either pick a Table from the list, specify a Stored Procedure or specify an SQL Query. If you’re connecting to a single table, you may be able to simply pick its name from the list of tables. If you need to connect to multiple tables in the same data connection, then you’ll need to use a Stored Procedure or an SQL Query.
Table Or SQL Query

Auto-Incremented Table Columns

If the table you’re wanting to connect to contains any auto-incrementing columns, you must use the “SQL Query” option instead of simply choosing a table name from the “Table” option. If you pick a table with an auto-increment column, you’ll be able to read from it but you’ll get errors when you try to push data into it. If this is the case, write an SQL Query that selects all columns in the table except for those which are auto-incremented. In the image above, I chose “SQL Query” because the “movie” table I’m connecting to has an auto-incrementing column named “id” that needs to be excluded from the data connection.

Bind Fields to Data Connection Nodes

At this point, you should have a new data connection listed in the Data View palette which contains a list of “nodes”, one for each column in the table(s) you picked while setting-up the data connection:
Data Connection in Data View Palette
The next step is to create fields to represent each node in the data connection and bindeach field to its respective data node. The easiest way to do this is simply to drag & drop the nodes from the data connection onto your form. This is handy for two important reasons:
  1. The Data View palette has inspected the definition of each node and pre-determined the best type of field to use in order to edit its data.
  2. When you drop the nodes onto the form, the fields that are created are automatically setup to be bound to their respective data nodes.
The database I’ve connected to is one that uses the Movie Data I’ve used in previous tutorials. In this case, I’ve connected to the Movie table’s “title” and “showTime” columns. Since the “title” column is described as VARCHAR, the Data View palette figured it should be a text field. As for the “showTime” column, described as TIME, it’s set to be a date/time field with its Data Format property preset to Time.
After you’ve completed this step, the Data View palette now shows the data nodes in the data connection as “bound” with special icons:
Fields Bound to Data Nodes

Add Control Buttons

The last step in this process consists in adding a set of controls to manipulate the records in the database obtained via the data connection. The simplest way to do this is to use a set of buttons where each is assigned one of the following statements (each statement is one line and provided in FormCalc):
xfa.sourceSet.{DataConnectionName}.first()
xfa.sourceSet.{DataConnectionName}.previous()
xfa.sourceSet.{DataConnectionName}.next()
xfa.sourceSet.{DataConnectionName}.last()
xfa.sourceSet.{DataConnectionName}.addNew()
xfa.sourceSet.{DataConnectionName}.update()
xfa.sourceSet.{DataConnectionName}.delete()
xfa.sourceSet.{DataConnectionName}.cancel()
where {DataConnectionName} should be replaced by the name you gave to the data connection you created earlier (“DataConnection” by default).
Each statement above represents a different action to take with the data connection: Move to the first, previous, next or last record, add a new record, update or delete the current record and cancel changes to the current record, respectively.
Data Connection Control Buttons
Note that the “first”, “previous”, “next” and “last” statements imply an “update” by default which means that if you simply use
xfa.sourceSet.{DataConnectionName}.next()
to move to the next record and the user has made changes to the current record, thosechanges will be committed prior to moving to the next record. If you want those navigation controls not to commit changes (and therefore require the user to explicitly click on the “update” button in order to apply any changes to the current record), you must specify the cancel statement prior to the next statement:
xfa.souceSet.{DataConnectionName}.cancel()
xfa.souceSet.{DataConnectionName}.next()
To help you do this quicker now and in the future, here’s a Library Object Snippet that you can place into the Custom tab of the Library palette (you’ll have to save the XFO file to the following folder on your system: C:\Documents and Settings\{userid}\Application Data\Adobe\Designer\en\objects\custom where userid is your windows user id).
Minimum Requirements: Designer 7.0, Acrobat 7.0.
Once you place the file in the folder indicated above, you’ll then have a new object in the Custom tab of your Library palette named “DataConnectionControls”. Simply drag the object onto your form and the buttons will appear, all pre-configured and ready to go.

Run Your Form

Now that the DSN, data connection, fields, bindings and navigation controls have been setup, you should be able to preview your form in Acrobat Pro and see the first record in the database table(s) pre-loaded into the bound fields.
Form Loaded In Acrobat
If you’re having problems getting this going, you can check-out my form (assuming you’ve created the FormBuilder database and a DSN for it) to see if you missed any steps:
Minimum Requirements: Designer 7.0, Acrobat Standard 7.0.

Sunday, 28 July 2013

Livecycle Designer: Connect to Excel

Does the path & filename combination of the referenced excel file contain spaces ?
eg. C:\Documents and settings\....\spreadsheet.xls

Apart from this, you could use a query like-This query has worked like charm
Select * FROM [Sheet1$]

PDF Form: Reading PDF Form Fields with VBA

Hi there,
This is exactly what I am looking for. Thanks so much.
However, my assignments are a bit different. I am wondering if you can give me a hand.
The data source:
1. An excel spreadsheet storing the raw data
2. A PDF file with an interactive form used to store the data input by the user according to the above excel spreadsheet
My assignments:
1. input the raw data from excel spreadsheet to the PDF interactive form
2. double check if the data input in the PDF interactive form is correct.
I am not allowed to convert the Excel spreadsheet to the PDF file directly as the PDF file is the template with precise paragraphing and wording embedded. It is a heavy job when there are over hundreds of number. I am thinking if the excel VBA can do both assignments automatically or at least double check my input.


Source: http://www.khk.net/wordpress/2010/09/23/reading-pdf-form-fields-with-vba/


Reading PDF Form Fields with VBA

Posted by khk
I’ve written about VBA and Acrobat JavaScript before, and I’ve also mentioned that you can combine VBA and JavaScript to access PDF form fields, but I still owe a sample for that. I had to answer another question today about how to exactly do that, so I whipped up a quick sample program that demonstrates the use of the JavaScript Object (JSO) to read and write AcroForm fields.
We start the same way as in my old VBA sample to create a VBA program that references the Acrobat TLB and to add a button to a document. When we now use the following script as the button handler, we can work with form fields:
Private Sub CommandButton1_Click()
    Dim AcroApp As Acrobat.CAcroApp
    Dim theForm As Acrobat.CAcroPDDoc
    Dim jso As Object
    Dim text1, text2 As String
    
    Set AcroApp = CreateObject("AcroExch.App")
    Set theForm = CreateObject("AcroExch.PDDoc")
    theForm.Open ("C:\temp\sampleForm.pdf")
    Set jso = theForm.GetJSObject
    
    ' get the information from the form fields Text1 and Text2
    text1 = jso.getField("Text1").Value
    text2 = jso.getField("Text2").Value
    
    MsgBox "Values read from PDF: " & text1 & " " & text2

    ' set a text field
    Dim field2 As Object
    Set field2 = jso.getField("Text2")
    
    field2.Value = 13   ' assign the number 13 to the fields value
    
    ' get the information from the form fields Text1 and Text2
    text1 = jso.getField("Text1").Value
    text2 = jso.getField("Text2").Value
    
    MsgBox "Values read from PDF: " & text1 & " " & text2

    theForm.Close
     
    AcroApp.Exit
    Set AcroApp = Nothing
    Set theForm = Nothing
     
    MsgBox "Done"
End Sub
This program requires a PDF file with text fields called “Text1″ and “Text2″ to be stored as C:\temp\sampleForm.pdf. With the explanation in the previous two blog posts, it should not be hard to understand what’s going on here. The only new command introduced is the getField() function, which returns a form field. The form field object has a property “value” which contains the actual value that’s assigned to the field. Give it a try and let me know how it works for you. The updated form field is not saved (because the document does not get saved) – I’ll leave that up to the reader to figure out.
Also, this program will not work with XFA forms (the ones you create in Designer). For those, you need to use the XFA DOM to access the form data. For anybody interested in XFA forms, the LifeCycle Designer ES Scripting Reference is a must read.

Adobe Acrobat: Adobe Javascript code which will read cell by cell data from xls file

Hi I am posting here some javascript code which will read cell by cell data of the xls file. this is just sample code. you can modify it according to your need. JavaScript code is


<script Language='JavaScript'>
 function readFromExcel(x,y)
{
 var excel = new ActiveXObject("Excel.Application");
var excel_file = excel.Workbooks.Open("D:\\test.xls");
var excel_sheet = excel_file.Worksheets("Sheet1");
var data = excel_sheet.Cells(x,y).Value; return data;
}
 function cFile(fileName)
 {
 var fso = new ActiveXObject("Scripting.FileSystemObject");
varFileObject = fso.OpenTextFile("D:\\"+fileName+".pdf", 2, true,0);
 // 2=overwrite, true=create if not exist, 0 = ASCII
varFileObject.write("You have written in the file successfully....."); varFileObject.close();
}
 function readVal()
{
var val = readFromExcel(1,1);
alert(val);
 document.write(val);
cFile("dk");
}


HTML Code :



 <html>
 <head>
 </Script>
 </Head>
 <body>
 <form>
 <input type="button" onclick="readVal();" value="Click to read" name="btnClick">
 </form>
</body>
</html>

Thursday, 25 July 2013

PDF: 7 Free PDF Password Remover Tools

7 Free PDF Password Remover Tools
Free PDF Password Remover, Cracker, Reset, and Recovery Tools for Windows

By Tim Fisher, About.com Guide
Ads: PDF Encryption Freeware Password Cracker PDF Download Free PDF Convert Password Windows
A PDF password remover (also called a PDF password cracker, password reset, or password recovery tool, depending on its ability) is a program that can be used to either find, remove, or bypass the security on a PDF file that prevents you from opening, printing, or changing the PDF file.

Most PDF password cracker tools fall in to one or more of three major categories: tools that recover the PDF user password, tools that recover the PDF owner password, and tools that remove the PDF owner password allowing full access to the PDF file.

The majority of PDF password remover tools cost money but there are also plenty of free PDF password removal, recovery, and cracking programs and the best of them are listed below:

Note: An individual PDF password removal tool might only support the cracking or removing of a password if it's of a certain kind, for a certain security level, encrypting a certain version of PDF, or may even have other restrictions. I'll call out any of those known limits below.

Important: In most countries, the only legal use of PDF password crackers is to break the security on a PDF file that you have the permission to do so on, like a PDF you encrypted but forgot the password to.

Need to Crack a Different Kind of Password? See my list of free password crackers for free programs to crack Windows passwords, RAR and ZIP archives, Word and Excel files, and more.

1. PDFCrack
PDFCrack - Free PDF Password Recovery Program
PDFCrack is the best free PDF password recovery tool available, assuming that's what you're after - an actual password "recovery" and not a simple PDF password removal or reset.

Method: PDFCrack would be considered a true PDF password recovery program since it recovers both the user password and owner password from encrypted PDFs. PDFCrack uses a brute-force password recovery method.

Limits: PDFCrack works with PDF files up to version 1.6 with 128-bit RC4 encryption.

My Test: PDFCrack recovered the 4-digit owner password on a version 1.6 PDF file with 128-bit RC4 encryption in two minutes. A longer and/or more complicated PDF password could take days, weeks, or even longer to recover.

If all you need is a way to bypass the permissions security in a PDF then PDFCrack is probably more than you need in a PDF password cracker. However, if you need to know the actual owner or user password, PDFCrack is your best bet.

PDFCrack is a command-line tool and should work on Windows 7, Windows Vista, and Windows XP, including both 32-bit and 64-bit versions.

Download PDFCrack 0.11 for Windows
Ads
Unlock your PDF Files
unlock-pdf-password.com
Unlock password-protected PDF files - remove PDF security restrictions!
PDF Password Remover
iStonsoft.com/pdf-password-remover
Best PDF Password Remover to Remove Password Protection from PDF files!
Remove PDF Restrictions
Wondershare.net
Convert Locked PDF Files. 100% Copyable,Editable,Printable!
2. GuaPDF Demo
GuaPDF - Free PDF Password Remover Program
GuaPDF, sometimes referred to as Guaranteed PDF Decrypter, is a combination PDF password remover/recovery tool. GuaPDF is easy to use and doesn't even require installation.

Method: GuaPDF is primarily a PDF password remover tool for the owner password but can also be used as a PDF password recovery tool for 40-bit encrypted user passwords.

Limits: GuaPDF works with PDF files up to version 1.7 level 3 even with 256-bit AES encryption. However, GuaPDF will only decrypt PDF files at higher levels of version 1.7 if the encryption is at 128-bit AES.

My Test: GuaPDF removed the security on a version 1.7 level 8 PDF file with 128-bit AES encryption instantly.

I recommend that you pick GuaPDF as your PDF password cracker if you have a small PDF with only owner restrictions, which is probably the most common situation. If you need to recover the owner password, try PDFCrack instead.

GuaPDF works on 32-bit and 64-bit versions of Windows 7, Vista, XP, 2000, and most Windows server operating systems as well.

Important: Including "demo" software in a list of freeware programs might seem wrong but the GuaPDF demo is fully functional for small files - it doesn't watermark or pretend to remove the password. Considering that it works across almost all PDF versions and encryption levels, something not found in most other true freeware PDF password removers, I couldn't skip on including GuaPDF here.

Download GuaPDF Demo (Free and Functional for Small PDFs)
3. FreeMyPDF.com
FreeMyPDF.com - Free PDF Password Remover
FreeMyPDF.com is a free online PDF password remover. Just choose an encrypted PDF file to upload, wait a few seconds while the owner password is removed, and then download the new decrypted PDF.

Method: FreeMyPDF.com is a password remover or cracker tool because the security is removed but no passwords are actually found.

Limits: FreeMyPDF.com will decrypt PDF files up to version 1.7 level 8 with 128-bit AES encryption. The maximum PDF file size is 150 MB.

My Test: FreeMyPDF.com decrypted a small, version 1.7 level 8 PDF file with 128-bit AES encryption in just a few seconds.

FreeMyPDF.com is really fast, and really easy to use, especially since there's nothing at all to install.

Since FreeMyPDF.com is an online application, it will work with just about any operating system.

Crack PDFs for Free with FreeMyPDF.com
4. PDF Password Remover Online
PDF Password Remover Online - Free Password Remover Tools
PDF Password Remover Online is, you guessed it, a free online PDF password remover. Just select a PDF file with an owner password, upload it, and wait a few seconds while the password is removed and the full set of PDF permissions are made available in a newly created PDF.

Method: PDF Password Remover Online is considered a password remover or cracker tool since no passwords are actually discovered.

Limits: PDF Password Remover Online works with PDF files up to version 1.7 level 8 with 128-bit AES encryption. The maximum PDF file size is 10 MB.

My Test: PDF Password Remover Online decrypted a small, version 1.6 PDF file with 128-bit RC4 encryption in just a few seconds, providing a new PDF for download with the password removed.

Since there's nothing to install with PDF Password Remover Online, and there's no options to confuse or complicate the PDF cracking process, this is one of the easiest to use tools available.

Since PDF Password Remover Online is a browser based application, it will work with any operating system you happen to be using.

Note: If you like PDF Password Remover Online but don't like the thought of uploading your PDF file, try PdfCrypt, also listed here. PdfCrypt is the desktop version of PDF Password Remover Online. If the file size limit is the concern, try FreeMyPDF.com instead.

Use PDF Password Remover for Free
5. PDF Password Remover
PDF Password Remover - Free PDF Password Remover Tool
PDF Password Remover (no relation to PDF Password Remover Online as far as I can tell) is another installable PDF password remover. It has a very simple PDF-in / PDF-out interface.

Method: PDF Password Remover's name says it all - it's a PDF password remover tool for the PDF owner password and that's all it does.

Limits: PDF Password Remover works with PDF files up to version 1.7 level 8 with 128-bit RC4 encryption.

My Test: PDF Password Remover instantly cracked a version 1.7 level 8 PDF encrypted at 128-bit RC4.

PDF Password Remover is really easy to use but doesn't support some of the higher encryption levels. This might be the perfect PDF password cracker/remover tool for some PDF files but you'll want to make another choice if the encryption level demands it.

I tried PDF Password Remover on a 64-bit Windows 7 PC but it should work equally well in Windows Vista and Windows XP.

Download PDF Password Remover for Free
6. PdfCrypt
PdfCrypt - Free PDF Password Cracker
PdfCrypt is the Windows command-line version of PDF Password Remover Online. Just specify the input and output PDF and a decrypted PDF file is instantly generated.

Method: PdfCrypt is a password remover tool. PdfCrypt will not find an owner or user password.

Limits: PdfCrypt works with PDF files up to version 1.7 level 8 with 128-bit AES encryption.

My Test: PdfCrypt decrypted a small version 1.7 level 8 PDF file with 128-bit AES encryption in less than a second.

I think PDF Password Remover Online is a better choice over PdfCrypt for PDF files smaller than 10 MB because the web interface is so easy to use. However, PdfCrypt is the perfect alternative to PDF Password Remover Online for larger PDF files.

PdfCrypt should work equally well in 32-bit and 64-bit versions of Windows 7, Windows Vista, Windows XP.

Download PdfCrypt 1.0 for Free
7. PDF Unlocker
PDF Unlocker - Free PDF Password Recovery Software
PDF Unlocker is a Windows installable program that will find the owner password of a PDF file. PDF Unlocker works much like PDFCrack but is instead a native Windows application, making it a bit easier to use though noticeably slower.

Method: PDF Unlocker sounds like it might be a PDF password remover tool but in reality it's a PDF password recovery program since it discovers the actual owner password from an encrypted PDF. PDF Unlocker uses a brute-force password recovery method.

Limits: PDF Unlocker works with PDF files up to version 1.7 level 8 with 128-bit AES encryption.

My Test: PDF Unlocker recovered the 5-digit owner password on a version 1.7 level 8 PDF with 128-bit AES encryption in about an hour and that's with me specifying the minimum and maximum password length, something you might not know. A longer password or a password where you don't know the length beforehand could take PDF Unlocker several days, weeks, or longer to crack.

If you need to know the actual owner password of an encrypted PDF file then PDF Unlocker is a good bet, especially if the PDF is encrypted at a level that the much faster PDFCrack can't handle. If you don't need to know the PDF owner password, but instead just want it removed, try one of the PDF password remover programs.

PDF Unlocker should work in Windows 7, Windows Vista, and Windows XP, including both 32-bit and 64-bit versions.

Note: PDF Unlocker requires that Java is installed before you can use the program. The program also tries to get you to install a browser toolbar during installation but you can cancel it and PDF Unlocker's install will continue fine.

Download PDF Unlocker 1.0 for Free