jQuery(".auto_pdf").click(function () { var doc = new jsPDF(); <?php if( have_rows('image_gallery', $current_home) ): ?> <?php $count=1; while( have_rows('image_gallery', $current_home) ): the_row(); $imagep = get_sub_field('image'); $image_titlep = get_sub_field('image_title'); $image_infop = get_sub_field('image_info'); if($count>1){ ?> doc.addPage(); <?php }?> doc.text("<?php echo $image_titlep;?>", 10, 10); doc.text("<?php echo $image_infop;?>", 10, 20); <?php $ext = pathinfo($imagep, PATHINFO_EXTENSION);// get file extension?> imgurl<?php echo $count;?> = 'data:image/<?php echo $ext;?>;base64,<?php echo base64_encode(file_get_contents($imagep)) ?>'; doc.addImage(imgurl<?php echo $count;?>, 'JPEG', 10, 30, 160, 180); <?php $count++; endwhile; ?> doc.save("Floor-Plan.pdf"); <?php endif; ?> });
Jagdish Sarma Asked question August 8, 2021