简体   繁体   English

使用jsPDF绘制贝塞尔曲线

[英]Drawing Bezier Curve with jsPDF

JsDoc Reference JsDoc参考

It is stated in both source code and documentation that you can draw Bezier Curve with the function .lines. 在源代码和文档中都说明可以使用.lines函数绘制Bezier曲线。 I have included the current version of jspdf.min.js and called the following method 我已经包含了当前版本的jspdf.min.js并称为以下方法

var doc = new jsPDF();
doc.lines([[2,2],[-2,2],[1,1,2,2,3,3],[2,1]], 212,110, 10);
doc.save();

The pdf file is generated, but when I open it, it doesn't have any drawing and gives you the following error message. 生成了pdf文件,但是当我打开它时,它没有任何图形,并显示以下错误消息。

An error exists on this page. 此页面上有错误。 Acrobat may not display the page correctly. Acrobat可能无法正确显示页面。 Please contact the person who created the PDF document to correct the problem. 请与创建PDF文档的人联系以解决问题。

Is this happening to everyone or am I doing it wrong? 这是每个人都发生的还是我做错了?

Thank you in advance. 先感谢您。

I have no idea what's up with those docs, but it looks like there's an error their scale argument. 我不知道这些文档是怎么回事,但是看起来他们的scale参数有误。 It's supposed to be a list of two elements, but they're only providing a single number. 它应该是两个元素的列表,但是它们仅提供一个数字。 Try something like this: 尝试这样的事情:

doc.lines([[2,2], [-2,2], [1,1,2,2,3,3], [2,1]], 0, 0, [10,10]);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM