简体   繁体   中英

Drawing Bezier Curve with jsPDF

JsDoc Reference

It is stated in both source code and documentation that you can draw Bezier Curve with the function .lines. I have included the current version of jspdf.min.js and called the following method

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.

An error exists on this page. Acrobat may not display the page correctly. Please contact the person who created the PDF document to correct the problem.

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. 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]);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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