如何在jspdf中添加图像? [英] How to add Image in jspdf?

查看:2201
本文介绍了如何在jspdf中添加图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经尝试过使用此代码添加图片,但是此处图片并未添加pdf.

I have tried this code for add a image,but here Image has been not adding with pdf.

  function RunCode() {
       var imgData = 'data:pubali.jpg/jpeg;';
       var doc = new jsPDF();
       doc.setFontSize(10);
       doc.text(20, 20, 'Hello world!');
       doc.text(20, 30, 'This is client-side Javascript, pumping out a PDF.');
       doc.addImage(imgData, 'JPEG', 15, 40, 180, 160);
       doc.output('datauri');
     }

如何使用jspdf添加图像.

How can I add image with jspdf.

推荐答案

  1. 您将使图像成为数据URL.
  2. 转到此链接 http://dopiaza.org/tools/datauri/index.php 将图片转换为网址.
  3. 然后点击此链接 http://mrrio.github.io/jsPDF/添加数据像这样的网址.
  1. You Will make your image into a Data url.
  2. Go to this link http://dopiaza.org/tools/datauri/index.php for convert your image into a url.
  3. Then follow this link http://mrrio.github.io/jsPDF/ add your data url like this.

这篇关于如何在jspdf中添加图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆