No ratings

How to Save as PDF - Content control.

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.

khanh_0-1634597131550.png

 

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

khanh_1-1634597131554.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 -----

 

khanh_2-1634597257449.png

 

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

khanh_3-1634597286855.png
 
4. Result from PDF print.
khanh_4-1634597314810.png

 

Additional Information

 

 

Related Links

Labels: (3)
Version history
Last update:
‎03-15-2022 07:55 AM
Updated by:
Contributors