(Show Contents)
Adobe PDF LiveCycle Forms Integration - Calling LiveCycle Dialog Action
There are two ways to call the Adobe PDF export action from a view:
- Using a view command, or
- Using JavaScript code.
Calling PDF export action using a view command
Add a command to the form panel in AXVW:
<action id="PDF_LiveCycle">
<title>PDF LiveCycle Export</title>
<command type="openLiveCycleDialog"
viewName="view_name"
dataSourceId="ds_1[;ds_2]"
restrictions="restriction_for_ds_1[;restriction_for_ds2]"
fieldNames="tablename.fieldname1;tablename.fieldname2; …"
pdfFieldNames="full_pdf_fieldname1;full_pdf_fieldname2; …"
pdfControlTypes="ControlType_For_Fieldname1;ControlType_for_Fieldname2;"
pdfTemplate="pdf_template_name"/>
</action>
The command parameters are:
- viewName – The view name that the data sources are defined. Typically this is the current view.
- dataSourceId – The data source ID(s) that are defined in the view and used to obtain the record from the database. This can be one data source id or two data source ids (owner and assigned) that are separated with “;”.
- restrictions – The generic SQL restriction(s) for the data source(s). If there are separate restrictions corresponding to the owner and assigned data sources, use “;” to separate them. For example, restrictions="project_id = 'AAA';em_id LIKE 'A%’".
- fieldnames – a set of full field names in format of tablename.fieldname of data source for the PDF input values.
- pdfFieldNames - a set of full field names from the PDF template that match the fieldnames parameter, and are to be filled inwith the values from the data sources.
Note that the field names need to be the full field names that contains form name, sub form name etc. For instance, pdfFieldNames="form1[0].wrForm[0].wr_wr_id[0]; form1[0].wrForm[0].wr_bl_id[0];…”. For more information about how to find out the full PDF field name, refer to the following article: http://www.aspose.com/documentation/java-components/aspose.pdf.kit-for-java/field-name-in-adobe-designer-7-0.html (this is for Adobe Designer 7.0, but should be similar for other versions).
- pdfControlTypes - a list of control types that corresponding to the types of pdfFieldNames. The possible enumeration values are:
- TextField
- ListBox
- DropdownList
- RadioBox
- CheckBox[FieldName1|FieldName2|FieldName3|…], where FieldName1 is the PDF field binding name of the checkbox field
- CheckBoxEnum
- Table[Cell1|Cell2|Cell3…], where Cell1 is the PDF table’s column name for each row. By default they are Cell1, Cell2… etc. For example, a list of controls for a text field, list box, and a series of check boxes that enumerate the days of the week would be:pdfControlTypes="TextField;ListBox;CheckBox[Sun|Mon|Tues|Wed|Thurs|Fri|Sat];”.
- pdfTemplate – the PDF template name that located under the schema\ab-products\common\resources\pdf-forms folder. You only need to specify the file name without path.
Calling PDF export action from JavaScript
Your Java script code can also call the comment with parameters described above:
var parameters = {};
parameters.target = 'opener';
parameters.type ='openLiveCycleDialog';
parameters.parentPanelId = this.id;
parameters.viewName = ‘test-view.axvw';
parameters.dataSourceId = 'your ds';
parameters.restrictions = ' your_restriction';
// add other args here
var command = new Ab.command.openLiveCycleDialog (args);
// call the dialog
command.handle();
Tips and Tricks
- For PDF template file, you must define a default value for radio button. Otherwise, the radio button group will not be activated for setting the value.
- For CheckBox type of PDF template, the fields in database are usually not enumeration type, but a “,” separated string. You will need to specify each value for the checkbox field in order. The value has to match the “field name” of the check box defined in PDF template.
- For PDF field, when you enter the binding name according to the enumeration values in database for PDF object using Adobe Designer, you will notice many special characters, i.e. \, -, :, “ etc are automatically escaped. This is to meet Adobe PDF field name binding convention. You can continue typing other characters.There are two special characters that are allowed in Designer but you need to escape manually:
Empty space
Character Dot “.”
For example, the field with enumeration value of “New Const.” will be named as “NewConst” in PDF field binding name. The field name is case-insensitive.
- To specify the restrictions for different data sources in Javascript, you can:
- Restrict to both owner and assigned data sources, i.e. parameters.restrictions = "project_id = '"+projectId+"'; project_id = '"+projectId+"'";
- Restrict to single data source or owner data source only, i.e. parameters.restrictions = "project_id = '"+projectId+"';
- Restrict to assigned data source only, i.e. parameters.restrictions = "; project_id = '"+projectId+"'";
- 5. When you define check boxes for enumeration field (CheckBoxEnum) in PDF, you need to use the database neutral value instead of display value as the PDF field name. If the neutral value is a number, which is not accepted by PDF Designer as a field name, you need to prefix “CheckBox” before the value. You also need to remove all the special characters including space and underscore etc. For instance, if the enumeration field in database has a list of values as: 1;Repair;2;Replace;3;Relocate;4;New Installation; then in the PDF file, you need to define the checkbox names as:
CheckBox1 (value:Repair)
CheckBox2 (value:Replace)
CheckBox3 (value:Relocate)
CheckBox4 (value:New Installation)