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

PLText rendering problem when horizontal alignment is set to JUSTIFY #36

Closed
istvangaal opened this issue May 23, 2024 · 12 comments
Closed
Assignees

Comments

@istvangaal
Copy link

istvangaal commented May 23, 2024

There is a problem with rendering PLText when its horizontal alignment is set to "JUSTIFY" like this:

PLText.setHorzAlign(EHorzAlignment.JUSTIFY)

It seems that the space between the characters are stretched, not between the words. You can see it when there is line break (e.g. after "Hello Alex") and at the page break:

image

Could you please fix it or is there any workaround for this issue?

Regards,
Istvan

@phax phax self-assigned this May 23, 2024
@istvangaal
Copy link
Author

I have found a topic related to this problem, this may help:
https://stackoverflow.com/questions/20680430/is-it-possible-to-justify-text-in-pdfbox

Regards,
Istvan

@phax
Copy link
Owner

phax commented May 24, 2024

From my Word user perspective I would say that is the difference between "justify" (as the image above) and "block" mode, like justify but with an exemption for the last line. Let me see what I can do....

@istvangaal
Copy link
Author

istvangaal commented May 24, 2024

Not only for the last line: for the last line of EACH PARAGRAPH (at line breaks)

And at the automatic PAGE BREAK there should be justified, currently it is not, see above image (the text continues on the next page, I forgot to copy here that page, sorry)

@istvangaal
Copy link
Author

@phax: how do you see: is this a big issue or can be implemented soon?

Regards,
István

@phax
Copy link
Owner

phax commented May 28, 2024

Shouldn't be too hard to do, but you caught me in the middle of the conference and vacation phase. Please stay patient :)
The solution will most likely be a new enum entry BLOCK or so to deal with that.

@phax
Copy link
Owner

phax commented May 29, 2024

@istvangaal I created the updated version with the new EHorzAlignment.BLOCK enum entry and this outcome:
horz-alignment.pdf

I assume that suits your needs, right? If so, I will buid a release version asap

@istvangaal
Copy link
Author

Wow, thank you, that looks good! Please notify me when the new release is available!

@phax
Copy link
Owner

phax commented May 29, 2024

Release 7.3.3 is out, and will be on Maven Central soon.

@phax phax closed this as completed May 29, 2024
@istvangaal
Copy link
Author

@phax Thank you for the quick release, I tried it and works almost perfectly! The only problem is at the PAGE BREAKs, because the last line at the end of a page is not justified. Here is an example:
End of a page:
image
Next page:
image

This problem occures at least in BLOCK and JUSTIFY horizontal alignments (PLText)

Could you do something with this?

Regards,
Istvan

@phax
Copy link
Owner

phax commented May 30, 2024

Ah yes - that makes sense. Let me check

@phax phax reopened this May 30, 2024
@phax
Copy link
Owner

phax commented May 30, 2024

Build 7.3.4 now

@phax phax closed this as completed May 30, 2024
@istvangaal
Copy link
Author

It works, thank you!

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

2 participants