Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #2938: textWithLink -> link centered correctly #3026

Merged
merged 9 commits into from
Dec 22, 2020
7 changes: 7 additions & 0 deletions src/modules/annotations.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,13 @@ import { jsPDF } from "../jspdf.js";
//TODO We really need the text baseline height to do this correctly.
// Or ability to draw text on top, bottom, center, or baseline.
y += height * 0.2;
//handle x position based on the align option
if(options.align == 'center'){
x = x - (width / 2); //since starting from center move the x position by half of text width
}
if(options.align == 'right'){
x = x - width;
}
this.link(x, y - height, width, height, options);
return width;
};
Expand Down