当前位置: 代码迷 >> 综合 >> LODOP 将多张图片拼接打印到同一张纸
  详细解决方案

LODOP 将多张图片拼接打印到同一张纸

热度:59   发布时间:2023-12-04 01:26:37.0
//看过很多资料没有找到将多个图片打印在同一张纸上的方法,经过设想加验证终于找到了以下方法实现且可设置图片间的间隙
function printImage() {LODOP = getLodop();LODOP.PRINT_INITA("10mm", "5mm", "775mm", "959mm", "你向往的远方");LODOP.SET_PRINT_PAGESIZE("1", "775mm", "959mm", "");var img = "<img src='https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1559134275105&di=a06c29793647f4e03f712c95a5be5b5f&imgtype=0&src=http%3A%2F%2Fpic8.nipic.com%2F20100626%2F2476235_102059530423_2.jpg'>" +"<img style='height: 300px'>" +"<img src='https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1559134275104&di=288e5f952a2f40a6d1b7b792837da014&imgtype=0&src=http%3A%2F%2Fpic163.nipic.com%2Ffile%2F20180421%2F7092831_140036752037_2.jpg'>";LODOP.ADD_PRINT_IMAGE(-10, 0, "790", "1000", img);LODOP.SET_PRINT_STYLEA(0, "Stretch", 2);//(不可变形)扩展缩放模式// LODOP.PRINT();//打印LODOP.PREVIEW();//预览
}

 

//中间那个image 没有指向图片地址 是为了让中间出现空白隔离,可根据自己的情况取舍

 

效果图: