纯前端 vue 实现 选择照片转换为pdf文件 终于解决了图片被分割成多个页面,只能生产一张,图片重叠等多个问题,

js 实现 选择照片转换为pdf文件

本文耗时0.5个工作日,终于解决了,vue 图片转pdf 时,图片被分割成多个页面的问题,只能生产一张,图片重叠等多个问题,
本来时给同事做的一个小工具,刚开始直接粘贴网上别人的代码,发现有问题,于是开始研究代码,经过多次尝试,终于完美解决。(-_-)

<template>
  <div style="text-align: center">

    <h1>图片转pdf</h1>
    <div>
      <input style="display: none" id="choice" ref="hiddenfile" accept="image/*" class="hiddenInput" multiple type="file" @change="handleFile"/>
      <el-button @click="choice">选择图片</el-button>
      <el-button @click="start">开始转换</el-button>
      <div id="pdfDom" style="margin:auto;width: 700px;margin-top: 20px">
        <div v-for="(item,i) in selFiles">
          <img width="100%" :id="'fg'+item.id" :src="item.fileimg"  alt=""/>
        </div>
      </div>
    </div>

  </div>
</template>

<script>
import {jsPDF} from 'jspdf';

export default {
  name: "pdf",
  components: {},
  data() {
    retu
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值