Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular.min.js"></script>
 <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.2.60/jspdf.min.js"></script>
  <title>JS Bin</title>
</head>
<body ng-app="myApp" ng-controller="myCtrl">
  <div id="test">
  <div ng-if='display'>
      <p>some message </p>
      <p>some validation </p>
  </div>
  </div>
<a ng-href='#here' ng-click='download()' >download</a>
</body>
</html>
 
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
    $scope.display= false;
   
    $scope.download = function() {
      var doc = new jsPDF();
      var element = document.getElementById("test");
      doc.setFontSize(40);
      doc.fromHTML(element, 10, 10, {'width': 180});    
      doc.save('Testy.pdf');
    }
});
Output

This bin was created anonymously and its free preview time has expired (learn why). — Get a free unrestricted account

Dismiss x
public
Bin info
anonymouspro
0viewers