ultimate js2fuckinPDF

this fiddle allows you to create a PDF from a JS

by arvillarruel

HTML

<script src="//cdnjs.cloudflare.com/ajax/libs/jspdf/0.9.0rc1/jspdf.js"></script>

      <div id="dialog-pdf" title="pdf" stye="display:none;">
        <div id="content">
        </div>
        <div id="editor"></div>
        <a href="#" id="cmd" class="button">generate PDF</a>
      </div>

JavaScript

/*
 * Creates new jsPDF document object instance from xpectus.com/engagement.
 * @author Alejandro Rivas.

*Engagement PDF Document creation from JavaScript

Table of contents:

0. Function
1.Engagement
 1.1
 1.2
 1.3
 1.4 Highcharts
2.Base Styles
3.Typography
4.Shapes
8.Tweets
  8.1 Username
  8.2 Followers
  8.3 Black Line
  8.4 Tweet
  @Renderer
function
 
*/

//0. Function
$(document).ready(function() {
  var doc = new jsPDF();

  /*PAGE 1 (Stakeholders)  /////////////////////////////////////////////////////////////////////////////////////////////////////*/
  doc.setFont("helvetica");
  //Engagement
  doc.setTextColor(0, 0, 0);
  // Black line

  //1.Reach
  doc.setFontSize(18);
  doc.text(15, 40, 'Reach');
  //1.1 Reach Value
  doc.text(50, 40, '345678');
  //2.Users
  doc.text(15, 50, 'Users');
  //2.1Users Value
  doc.text(50, 50, '8976545');
  //3.Mentions
  doc.text(15, 60, 'Mentions');
  //3.1 Mentions Value
  doc.text(50, 60, '3523566');

  //3.Stakeholders
  doc.setFontSize(12);
  doc.text(15, 133, 'Reach');
  //1.1 Reach Value
  doc.text(40, 133, '345678');

  //2.Users
  doc.text(15, 142, 'Users');
  //2.1Users Value
  doc.text(40, 142, '8976545');
  //3.Mentions
  doc.text(15, 151, 'Mentions');
  //3.1 Mentions Value
  doc.text(40, 151, '3523566');
  // General Participation table
 doc.setFontSize(12);
  //General Participation table 1.Engagement
  doc.text(20, 100, 'Engagement');
  //General Participation table 2.Users
  doc.text(88, 100, 'Participant');
  //General Participation table 3.Mentions
  doc.text(160, 100, 'Reach');

  //Stakeholders Participation table
  //Stakeholders Participation table 1.Engagement
  doc.text(20, 185, 'Engagement');
  //Stakeholders Participation table 2.Users
  doc.text(88, 185, 'Participant');
  //Stakeholders Participation table 3.Mentions
  doc.text(160, 185, 'Reach');

  //Tweets description

  doc.setFontSize(9);
  //Followers 1
  doc.text(155, 205, 'Followers:');
  //Followers 2
  doc.text(155, 225,...