JSFiddle - React, Tailwind, and code Playground

by godhong

HTML

<script src="https://raw.github.com/MrRio/jsPDF/master/examples/js/jquery/jquery-ui-1.8.17.custom.min.js"></script>
<script src="https://raw.github.com/MrRio/jsPDF/master/jspdf.js"></script>
<script src="https://raw.github.com/eligrey/FileSaver.js/master/FileSaver.js"></script>
<script src="https://raw.github.com/eligrey/Blob.js/master/BlobBuilder.js"></script>
<script src="https://raw.github.com/MrRio/jsPDF/master/jspdf.plugin.addimage.js"></script>
<script src="https://raw.github.com/MrRio/jsPDF/master/jspdf.plugin.from_html.js"></script>
<script src="http://jspdf.com/jspdf.plugin.ie_below_9_shim.js"></script>
<script src="http://jspdf.com/jspdf.plugin.sillysvgrenderer.js"></script>
<script src="http://jspdf.com/jspdf.plugin.split_text_to_size.js"></script>
<script src="http://jspdf.com/jspdf.plugin.standard_fonts_metrics.js"></script>
<div class="articles">
    	<h2 class="model_header">PFAM Output</h2>
        <table align="center">
            <!--end 04uberoutput_start-->
            <table class="out_chemical" width="550" border="1">
                <tr>
                    <th scope="col" colspan="5">
                        <div align="center">Chemical Inputs</div>
                    </th>
                </tr>
                <tr>
                    <th scope="col" width="250">
                        <div align="center">Variable</div>
                    </th>
                    <th scope="col" width="150">
                        <div align="center">Unit</div>
                    </th>
                    <th scope="col" width="150">
                        <div align="center">Value</div>
                    </th>
                </tr>
                <tr>
                    <td>
                        <div align="center">Water Column Half life @20 &#8451</div>
                    </td>
                    <td>
                        <div align="center">days</div>
                    </td>
                    <td>
                        <div...

JavaScript

var jq_html = $("div.articles").html();

var doc = new jsPDF();

// We'll make our own renderer to skip this editor
var specialElementHandlers = {
    '#editor': function (element, renderer) {
        return true;
    }
};

// All units are in the set measurement for the document
// This can be changed to "pt" (points), "mm" (Default), "cm", "in"
doc.fromHTML(jq_html, 15, 15, {
    'width': 170,
        'elementHandlers': specialElementHandlers
});


doc.save('Test.pdf');