I am using jsPDF to create a PDF from existing objects in my canvas. Thus I have the coordinates and the rotation angle of my objects, I want to then add to my PDF. However, every image doesn't rotate around its own center, thus it changes the coordinates drastically.
var doc = new jsPDF('p', 'mm', 'a3');
doc.addImage(image, 'PNG', 100, 100, 52.916667, 52.916667, null, null, 45);
doc.save('a3.pdf');
Can somebody help me rotate the image around its own center?
Here is a jsFiddle https://jsfiddle.net/bx0ucszo/6/
I have the same Issue, You can solve it by playing with the degrees in X and Y for the position.
Meaning that if when you rotate your img 45 degrees it descends some pixels on Y, my solution was to put a negative value for Y, for example -100 instead of 100
Hope it's usefull for you
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.