JSPDF中的重叠文本 [英] Overlapping text in JSPDF

查看:304
本文介绍了JSPDF中的重叠文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用d3生成的仪表板页面,它显示带有样式和日期的不同html表.我正在使用JSPdf将表导出为最终用户的pdf,现在的问题是,当我在生产机(屏幕稍小的另一台笔记本电脑)上尝试使用pdf时,该表正在显示表,但某些文本在外部重叠它们的单元格,然后我最终看到了乱七八糟的文本,现在即使在我的屏幕中,所需要做的只是放大导航器中的结果,最后得到一个pdf文件,该pdf文件以乱序的方式显示了一些数据,任何人都可以通过此操作并得到任何的想法 ?我需要使用组织数据进行pdf导出,也许类似于浏览器中显示的内容,因为某种原因,pdf上的结果与html网页输出不同.

I have a dashboard page generated using d3, it shows different html tables with styles and date. I'm using JSPdf to export the tables to pdf for the end user, now the problem is when i tried this on a production machine (a different Laptop with a slightly smaller screen) the pdf is displaying the tables but some text is overlapping outside their cells and i end up with text scrabbeled, Now even in my screen, all it takes is a zoom in our out in my navigator to end up with a pdf that shows some data in a misordered ways, anyone has been through this and got any idea ? i need to get a pdf export with organized data perhaps something similar to what's displayed in my browser, because for some reason the result on the pdf is different from the html webpage output.

这是GitHub上的一个问题,其中的屏幕截图显示了该问题: https://github.com /MrRio/jsPDF/issues/879

Here's an issue on GitHub with a screenshot showing the problem : https://github.com/MrRio/jsPDF/issues/879

推荐答案

您是否看过样式表?可能有一个print.css可能会影响输出,并且可能与您实际呈现的内容有所不同.

Have you taken a look at the stylesheets? There may be a print.css that may be affecting the output and may be different to what you are actually rendering.

您还可以查看他们的字符串拆分"示例,他们遇到了类似的问题:

You can also look at their "String Splitting" sample, they are running into a similar issue:

示例的问题是垂直偏移

原始:

verticalOffset += (lines.length + 0.5) * size / 72

新功能:

verticalOffset += (lines.length + 2.5) * size / 72

这篇关于JSPDF中的重叠文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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