Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

PDF Fillable form make field bold using sn_pdfgeneratorutils.PDFGenerationAPI

Dazler
Mega Sage

Hi,

 

I have created a PDF Fillable form using Adobe Acrobat.  I am using a script include to populate this PDF form using sn_pdfgeneratorutils.PDFGenerationAPI.fillDocumentFields.

 

I have a field on the form that would need to be bold.   

 

 

var v = new sn_pdfgeneratorutils.PDFGenerationAPI;

var fieldMap = new Object();
fieldMap["transaction_header"] = 'Test returned on note ending in 1234';
   									
var result = v.fillDocumentFields(fieldMap, "XXXXXXXXXXXXXXXXXXXX106a", "x_new_app_request", 'XXXXXXXXXXXXXXXXXXXXdccd', "Test");
        
gs.info(JSON.stringify(result));

 

 

In the above script, I am trying to get the fieldMap["transaction_header"] value to be bold.  I set up the PDF Fillable form font for that pdf field to be arial bold, but I don't think that the string is passing it so that it recognizes the font for that field.  If I manually fill out the form, then the bold is working.

 

Does anyone know of a way to do this?  

 

Any help would be appreciated.

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

@Dazler 

did you try this

var v = new sn_pdfgeneratorutils.PDFGenerationAPI;

var fieldMap = new Object();
fieldMap["transaction_header"] = '<html><body><b>Test returned on note ending in 1234</b></body></html>';
   									
var result = v.fillDocumentFields(fieldMap, "XXXXXXXXXXXXXXXXXXXX106a", "x_new_app_request", 'XXXXXXXXXXXXXXXXXXXXdccd', "Test");
        
gs.info(JSON.stringify(result));

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Ankur Bawiskar 

 

I apologize for the delay, but no this is not working as servicenow passes the data as a plain text.  It doesn't recognize html tags inIt is not recognizing  I don't know how, but on some of my other PDFs I am using I made the adobe acrobat field font bold and that worked.  For some reasons a couple of my other PDFs is not working with the same function on the Adobe field.