html - Issue in download div as a PDF using javascript? -


i trying download specific div pdf not showing complete part of div.it showing first 2 columns , not showing complete height , width of div. how can export complete div html output of div?. better if page directly mail receiver in pdf format.

my div this

[1]: [https://i.stack.imgur.com/9t012.png][1] 

after export in pdf looking this

[2]: [https://i.stack.imgur.com/ereu9.png][1] 

my code is,

<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.4/jspdf.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.4/jspdf.debug.js"></script> <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/0.4.1/html2canvas.js"></script>  <script type="text/javascript" src="jspdf.min.js"></script>  <script type="text/javascript">  function genpdf()  {   html2canvas(document.body,{   onrendered:function(canvas){    var img=canvas.todataurl("image/png");   var doc = new jspdf();   doc.addimage(img,'jpeg',20,20);   doc.save('test.pdf');   }    });    }   </script>  <?php if ($this->helper('wishlist')->isallow()) : ?>     <div class="my-wishlist">     <div class="page-title title-buttons">         <?php if ($this->helper('wishlist')->isrssallow() && $this->haswishlistitems()): ?>             <a href="<?php echo $this->helper('wishlist')->getrssurl($this->getwishlistinstance()->getid()); ?>" class="link-rss"><?php echo $this->__('rss feed') ?></a>         <?php endif; ?>         <h1><?php echo $this->gettitle(); ?></h1>     </div>     <?php echo $this->getmessagesblock()->tohtml() ?>      <form id="wishlist-view-form" action="<?php echo $this->geturl('*/*/update', array('wishlist_id' => $this->getwishlistinstance()->getid())) ?>" method="post">         <?php echo $this->getchildhtml('top'); ?>         <div class="fieldset">             <?php if ($this->haswishlistitems()): ?>                     <?php echo $this->getblockhtml('formkey');?>                     <?php $this->getchild('items')->setitems($this->getwishlistitems()); ?>                     <?php echo $this->getchildhtml('items');?>                     <script type="text/javascript">decoratetable('wishlist-table')</script>             <?php else: ?>                 <p class="wishlist-empty"><?php echo $this->__('you have no items in quote.') ?></p>             <?php endif ?>             <div class="buttons-set buttons-set2">                 <?php echo $this->getchildhtml('control_buttons');?>             </div>         </div>     </form>      <form id="wishlist-allcart-form" action="<?php echo $this->geturl('*/*/allcart') ?>" method="post">         <?php echo $this->getblockhtml('formkey') ?>         <div class="no-display">             <input type="hidden" name="wishlist_id" id="wishlist_id" value="<?php echo $this->getwishlistinstance()->getid() ?>" />             <input type="hidden" name="qty" id="qty" value="" />         </div>     </form>      <script type="text/javascript">     //<![cdata[         var wishlistform = new validation($('wishlist-view-form'));         var wishlistallcartform = new validation($('wishlist-allcart-form'));          function calculateqty() {             var itemqtys = new array();             $$('#wishlist-view-form .qty').each(                 function (input, index) {                     var idxstr = input.name;                     var idx = idxstr.replace( /[^\d.]/g, '' );                     itemqtys[idx] = input.value;                 }             );              $$('#qty')[0].value = json.stringify(itemqtys);         }          function addallwitemstocart() {             calculateqty();             wishlistallcartform.form.submit();         }     //]]>     </script>  </div> <a href="javascript:genpdf()">download pdf</a> <?php echo $this->getchildhtml('bottom'); ?> <div class="buttons-set">     <p class="back-link"><a href="<?php echo $this->escapeurl($this->getbackurl()) ?>"><small>&laquo; </small><?php echo $this->__('back') ?></a></p> </div> <?php endif ?> 

thanks in advance

this exact div trying export

 <div class="my-wishlist"> <div class="page-title title-buttons">     <?php if ($this->helper('wishlist')->isrssallow() && $this->haswishlistitems()): ?>         <a href="<?php echo $this->helper('wishlist')->getrssurl($this->getwishlistinstance()->getid()); ?>" class="link-rss"><?php echo $this->__('rss feed') ?></a>     <?php endif; ?>     <h1><?php echo $this->gettitle(); ?></h1> </div> <?php echo $this->getmessagesblock()->tohtml() ?>  <form id="wishlist-view-form" action="<?php echo $this->geturl('*/*/update', array('wishlist_id' => $this->getwishlistinstance()->getid())) ?>" method="post">     <?php echo $this->getchildhtml('top'); ?>     <div class="fieldset">         <?php if ($this->haswishlistitems()): ?>                 <?php echo $this->getblockhtml('formkey');?>                 <?php $this->getchild('items')->setitems($this->getwishlistitems()); ?>                 <?php echo $this->getchildhtml('items');?>                 <script type="text/javascript">decoratetable('wishlist-table')</script>         <?php else: ?>             <p class="wishlist-empty"><?php echo $this->__('you have no items in quote.') ?></p>         <?php endif ?>         <div class="buttons-set buttons-set2">             <?php echo $this->getchildhtml('control_buttons');?>         </div>     </div> </form>  <form id="wishlist-allcart-form" action="<?php echo $this->geturl('*/*/allcart') ?>" method="post">     <?php echo $this->getblockhtml('formkey') ?>     <div class="no-display">         <input type="hidden" name="wishlist_id" id="wishlist_id" value="<?php echo $this->getwishlistinstance()->getid() ?>" />         <input type="hidden" name="qty" id="qty" value="" />     </div> </form>  <script type="text/javascript"> //<![cdata[     var wishlistform = new validation($('wishlist-view-form'));     var wishlistallcartform = new validation($('wishlist-allcart-form'));      function calculateqty() {         var itemqtys = new array();         $$('#wishlist-view-form .qty').each(             function (input, index) {                 var idxstr = input.name;                 var idx = idxstr.replace( /[^\d.]/g, '' );                 itemqtys[idx] = input.value;             }         );          $$('#qty')[0].value = json.stringify(itemqtys);     }      function addallwitemstocart() {         calculateqty();         wishlistallcartform.form.submit();     } //]]> </script>  </div> 


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -