Create PDF Document with JavaScript

From SmartWiki
Revision as of 14:48, 4 January 2013 by Cameron (talk | contribs) (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…')

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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