Giter VIP home page Giter VIP logo

Comments (6)

a992681784 avatar a992681784 commented on July 17, 2024

@HinduLotus 碰到同样的问题了,你解决了吗

from render-html-to-pdf.

cfangxx avatar cfangxx commented on July 17, 2024

我的内容不是固定的。这样肯定不行。

from render-html-to-pdf.

Daiqiangdeveloper avatar Daiqiangdeveloper commented on July 17, 2024

怎么解决得呀 @zlLotus

from render-html-to-pdf.

panlufei avatar panlufei commented on July 17, 2024

貌似我也遇到了

from render-html-to-pdf.

is-liyiwei avatar is-liyiwei commented on July 17, 2024

图片也会被截取掉一半在下一页,悲剧,我想了一个计算的方法,不知道有没有大神能够实现,就是转换成canvas的时候,先计算每个dom的高度相加,例如我这里最后一个img标签是高度300px,然后200px是在第一页,100px在第二页,会被截断,然后就利用一个算法计算出来这个高度,然后动态插入一个高度200px的div把图片挤到下一页,后面的页面和其他的dom按钮或者什么的也可以使用此类方法,不知道有没有大神能够实现这个算法T-T

from render-html-to-pdf.

Anson2251 avatar Anson2251 commented on July 17, 2024

我最近正好写了一个库 toPage ,用于将一个简单的 HTML 页面分割为几个标准尺寸(如A4)的页面(代码很烂,正在考虑重构)。我的想法与 @is-liyiwei 差不多。但由于比较懒,不想计算height,就直接用 ele.scrollHeight > ele.clientHeight 判断是否溢出,估计可能会有性能问题。如果溢出的话,就查看他的子元素能否放置,如果不行就挪到第二页。可以先将HTML文件预处理成页面,然后再转成 canvas,这样文字就不会被裁剪

from render-html-to-pdf.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.