相关疑难解决方法(0)

PDF中的图像截止:如何使画布完全适合PDF页面?

使用jspdf库将画布放置在PDF中时会切断图像.

html2canvas(myContainer, {background: 'red'}).then (canvas) ->
  imgData = canvas.toDataURL('image/jpeg', 1.0)
  window.open(imgData) # this is just a test that opens the image in a new tab and it displays nicely, the entire image
  pdf = new jsPDF("l", "pt", "b1") # tried a variety of formats but no luck
  pdf.addImage(imgData, 'JPEG', 0, 0)
  pdf.save('file.pdf') # the generated pdf that contains the image gets trimmed
Run Code Online (Sandbox Code Playgroud)

有没有人有任何想法如何使画布适合?

canvas html2canvas jspdf

6
推荐指数
3
解决办法
2万
查看次数

标签 统计

canvas ×1

html2canvas ×1

jspdf ×1