Difference between revisions of "Create PDF Document with JavaScript"

From SmartWiki
Jump to: navigation, search
(Created page with ' Many SmartSimple components can be easily converted to PDF using baseline functionality such as the Web Page View Field. It is also possible to generate PDF documents from…')
(No difference)

Revision as of 13:48, 4 January 2013

Many SmartSimple components can be easily converted to PDF using baseline functionality such as the Web Page View Field.

It is also possible to generate PDF documents from any HTML encoded text. For example:

  • Reports
  • Web Page View Field if you wish to manipulate the HTML using JavaScript prior to generating the PDF. (Using the standard feature to convert Web Page View into a PDF will will render using the initial HTML and not the HTML after being manipulated by JavaScript)


This is accomplished by submitting a form containing an input named "txt" to the SmartSimple pdfWriter page.


For example, to convert a report to PDF you could add the following code to the

<div style="pd4ml-display:none">
<form name="CreatePDF" action="/pdfWriter" method="POST">
    <input type="hidden" id="PDFcontent" name="txt"/>
    <input type=submit class="Button" value="Create PDF" onclick="this.form.txt.value=document.getElementsByTagName('HTML')[0].outerHTML;">
</form>
</div>
[Category:JavaScript]]