Changing font at runtime for all controls (fileds) in adobe form is quite painful, because till now there is no provision is given by adobe. I have done some RND on how to change fonts in our adobe forms dynamically. This will change font of whole pdf.
Requirement: Want to change font of whole pdf (all pages, master pages).
Solution:
First go through Loop through all controls (fields) in adobe forms blog for more information.
Below all listed controls (fileds) are effected,
Use below script on data node.
Requirement: Want to change font of whole pdf (all pages, master pages).
Solution:
First go through Loop through all controls (fields) in adobe forms blog for more information.
Below all listed controls (fileds) are effected,
- Button, Check Box, Date/Time Field, Drop-down List, Signature Field, Image Field, List Box, Numeric Field, Password Field, Radio Button, and Text Field.
- Circle, Line, Rectangle, Static Image, and Static Text.
Use below script on data node.
data::ready:layout - (JavaScript, client)
var totalPages = xfa.layout.pageCount();
var i = 0;
for (i = 0; i < totalPages; i++) {
setFont("field", 0);
setFont("draw", 0);
setFont("field", 1);
setFont("draw", 1);
}
function setFont(type, page) {
var oField = xfa.layout.pageContent(i, type, page);
var n = oField.length;
var j = 0;
for (j = 0; j < n; j++) {
oField.item(j).font.typeface = "Courier"; //any valid font name
}
}Hope this helps.