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

Text right alignment not working with text array #1310

Closed
rcwwilliams opened this issue Jun 2, 2017 · 12 comments
Closed

Text right alignment not working with text array #1310

rcwwilliams opened this issue Jun 2, 2017 · 12 comments

Comments

@rcwwilliams
Copy link

Hi

Really appreciate how you are continuing to improve this great library.

Text right alignment works fine with a single string passed to doc.text, but does not seem to line up correctly with an array passed.

Quite easy to reproduce.

Thanks

Robin

@Uzlopak
Copy link
Collaborator

Uzlopak commented Jun 3, 2017

If it easy to reproduce you should be able to give us a code sample.

@rcwwilliams
Copy link
Author

doc.text(200, 10, ['One', 'Two', 'Three'], null, null, 'right');

@Uzlopak
Copy link
Collaborator

Uzlopak commented Jun 3, 2017

I really dont know if I should laugh or cry. Do you have respect for your colleagues? Because you give me one line and expect from me to build a working code sample. Is my time less worth than yours? I dont think so.

Unless you provide a working code sample in jsfiddle or jsbin.com I am out.

@rcwwilliams
Copy link
Author

Just paste that line in http://rawgit.com/MrRio/jsPDF/master/

that only takes a few seconds

@MrRio
Copy link
Member

MrRio commented Jun 3, 2017 via email

@Uzlopak
Copy link
Collaborator

Uzlopak commented Jun 3, 2017

@MrRio

for (var i = 1, len = da.length; i < len; i++) {
           var delta = maxLineLength - lineWidths[i];
           if (align === "center") delta /= 2;
           // T* = x-offset leading Td ( text )
           text += ") Tj\n" + (left - prevX + delta) + " -" + leading + " Td (" + da[i];
           prevX = left + delta;
         }

Seems to be a problem in that area....

@Kyderman
Copy link

Has this been looked at?

@Uzlopak
Copy link
Collaborator

Uzlopak commented Nov 17, 2017

Yeah. Code is not working. I fixed it in #1448.

@Kyderman
Copy link

Alright, I'll wait for the merge. Assuming that wouldnt take too long?

@Uzlopak
Copy link
Collaborator

Uzlopak commented Nov 17, 2017

I can't see it getting merged any time soon

@Uzlopak
Copy link
Collaborator

Uzlopak commented Feb 18, 2018

Hopefully we will merge fix it soon.

@Uzlopak
Copy link
Collaborator

Uzlopak commented Feb 20, 2018

Fixed in #1433
Will be part of next release

@Uzlopak Uzlopak closed this as completed Feb 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants