No ratings

How to Save as PDF - Content control.


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.


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



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


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 -----




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

4. Result from PDF print.


Additional Information



Related Links

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