How to Save as PDF - Content control.

  • 15 February 2022
  • 0 replies
  • 162 views

Userlevel 2
Badge +10

Topic

How to use "Save as PDF control" with Content controls. For example, a form has 3 content controls (iframes), each content control loads a Smartforms list view. When the form is loaded on screen and the PDF file is printed, it should show embedded contents inside the content controls.

 

Warning: This approach will only work with embedded Smartforms view/form urls.

Instructions

1. Drop a label on the form, give it a nice descriptive name, and mark it as literal.

20134iB253FCA367D937CB.png

 

2. Directly before you call the "Save as PDF" controls method action, set the properties on the label created in step 1.

20133iE712F8FB742ACCA9.png

Keep all the script in one single line. (Do not add carriage return characters).

//----- Start jscript ----- <script>$('.SourceCode-Forms-Controls-Web-Content-Content iframe').toArray().map(function(a){var b = $(a.contentWindow.document.getElementsByTagName('html'));b.find("input").each(function (){this.setAttribute("value", this.value);});b.find('textarea').each(function (){this.innerHTML = this.value});});$('.SourceCode-Forms-Controls-Web-Content-Content iframe').toArray().map(a=>a.srcdoc=$(a.contentWindow.document.getElementsByTagName('html'))[0].outerHTML)</script> //----- Stop jscript -----

 

20135i0D0CCAFF36305183.png

 

3. Call the "Save as PDF" control's "Save PDF" method.

20136i647E257FE7E7C32B.png
 
4. Result from PDF print.
20137i7F9CB86C5524C71B.png

 

Additional Information

 

 

Related Links


0 replies

Be the first to reply!

Reply