Adobe Forms are PDF (Portable Document Format) documents containing data from various core systems represented in a well-known structuring method for data output. Adobe forms can be both static as well as interactive and can be printed, distributed via email and saved locally.
The reasons behind using Adobe Forms are it provides security options like digital signatures, disabling print option and the major reason is PDF document is an open standard.
1) Interactive Forms: - Interactive Forms are PDF documents that require forms to be filled by the users which can be either done online or offline and the data entered can be used for further processing. Thus interactive forms can be classified into two types:-
Online:-Here the user displays and fills the form via WebDynpro which can be accessed via a portal or web Application Server.
Offline:-Here the user downloads and saves the form in local hard drive for filling it up later and uploading the completed one
back to the server.
2)PDF-Based Print Forms:-The PDF-based Print forms are similar to SMARTFORMS used to print Invoices, salary, etc. They are static in nature as there is no user interaction.Now in this document we will learn how to use Dynamic fonts in a single Adobe Forms.
Prerequisites of using fonts in Adobe Forms:-
The font to be used should be installed in the system where the Adobe Form is developed and also in the system where it is viewed.
ADS (Adobe Document Services) require access to fonts that are installed in thefont manager module. So the new font to be used has to be placed in the font manager module of the ADS.
Steps to be followed to use multiple font using java script:-
1.Go to the TCODE SFP to open the adobe form.
2. Go to the interface and add the following field of string type. Here wf_font will hold the font type that is to be used in the form.
3. In the context of the form add the field wf_font from the interface.
4. Go to the form layout and add normal text field from the object library to the main page and design view for holding the value of the field wf_font. Ensure that you have the field as invisible (presence in object properties).
WF_FONT field in Master Page.
WF_Font in the design view.
5.Now the most important part is writing the JAVA SCRIPT to change the font at each and every element. We will write the JAVA SCRIPT at the initialize event. The script we are going to write is “this.font.typeface = “NAME OF THE FONT”.
The “this” in the above script refers to the specific field (wf_vblen,wf_mat,etc).Now we are sending the font dynamically from the print program and we have the same in the field wf_font of the form.
Where xfa.resolveNode () evaluates the specified reference syntax expression and returns the value of the object specified in the reference syntax expression.
As a result we will get the value (like ‘Times New Roman’, Etc.) we have passed from the print program and the same is assigned to the font of the element in the form layout.
The same script is to be placed at all the elements in the layout.
JAVA SCRIPT at one node in the master page.
JAVA SCRIPT at one node in the Design View.
NOTE: - We are using a different field in design view as the value of the field in the master page can’t be accessed in the design view.
Changes in code:-
Apart from the normal logic to fetch and display data in the adobe form we need to pass the font name to the form interface.
Here when you right click and check the document properties you can see the fonts. That is CorpoS (corporateS).
Same for using the font “Times New Roman”.
Problem Areas of using Dynamic font:-
Using dynamic fonts in Adobe Forms has some restriction. Few are discussed below:-
We can use the JAVA SCRIPTS only for fields that we send value from print program and not hard coded text. So all the hard coded text has to replaced by the text fields.
In Adobe Form we have the default Page no. and we don’t have to place any logic for that. But the same is hard coded text( page ). So we have to replace that with a text field and place the below java script to ensure we get the page no. in different fonts.
Another issue that we face is when we use fonts with a bigger size. As a result the text field behaves only with the original assigned font and not the dynamically assigned font thus resulting in overflowed or truncated text.