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

Error with Center Align and Split Text to Size #1545

Closed
everettglovier opened this issue Dec 10, 2017 · 8 comments
Closed

Error with Center Align and Split Text to Size #1545

everettglovier opened this issue Dec 10, 2017 · 8 comments

Comments

@everettglovier
Copy link

everettglovier commented Dec 10, 2017

Hi everyone! I keep getting an error when trying to open a PDF with center align and split text to size on only a specific set of letters!

My code:
doc.text("Smoke Bombs", 0, 392, null, null, 'center' );

I opened the raw PDF and saw this:
(Smoke) Tj 1.7763568394002505e-15 -8 Td (Bombs) Tj ET BT /F1 8 Tf

It is definitely the 1.7763568394002505e-15 value but I don't know how that is calculated or really what that value is for?

I am using 'pt' for units as well.

@everettglovier
Copy link
Author

Seems like on line 1524:
if (align === "center") delta /= 2;
There should be some limit of decimal place?

@Uzlopak
Copy link
Collaborator

Uzlopak commented Dec 10, 2017

Yeah. It is definitely an error. But the project owner doesn't merged some pull requests yet to fix those errors...

@Uzlopak
Copy link
Collaborator

Uzlopak commented Dec 10, 2017

But the fixing point is not the line you found... Wait

@Uzlopak
Copy link
Collaborator

Uzlopak commented Dec 10, 2017

The line is:

text += ") Tj\n" + ((left - prevX) + delta) + " -" + leading +

Change it to

text += ") Tj\n" + f2((left - prevX) + delta) + " -" + f2(leading) +

@everettglovier
Copy link
Author

@arasabbasi made the fix, thanks! Yeah, would hope it makes it to the official build.

@MrRio
Copy link
Member

MrRio commented Dec 12, 2017

@arasabbasi Hey, what's the open PR for this?

@Uzlopak
Copy link
Collaborator

Uzlopak commented Dec 13, 2017

@MrRio
I already modified everything in the PR #1448 and fully unit tested. But nothing is getting merged. It is just sad...

@Uzlopak
Copy link
Collaborator

Uzlopak commented Feb 20, 2018

Fixed by #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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants