We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
pdfbox-layout supports underline styled text. I would like this feature exposed by easy-table through an AnnotationStyleTextBuilder.
The text was updated successfully, but these errors were encountered:
I have coded something similar for annotations with destination. U can find it here - https://github.com/grasshopper7/cucumber-pdf-report/tree/master/cucumber-pdf-report/src/main/java/tech/grasshopper/pdf/annotation/cell. This is kind of coupled to other code but if u r interested to build upon it, feel free.
Sorry, something went wrong.
Perhaps, we could have something like this:
package org.vandeseer.easytable.structure.cell.paragraph;
import lombok.Builder; import lombok.Getter; import lombok.NonNull; import lombok.SneakyThrows; import lombok.experimental.SuperBuilder; import org.apache.pdfbox.pdmodel.font.PDFont; import org.vandeseer.easytable.settings.Settings; import org.vandeseer.easytable.util.PdfUtil; import rst.pdfbox.layout.elements.Paragraph; import rst.pdfbox.layout.text.FontDescriptor; import rst.pdfbox.layout.text.NewLine;
import java.awt.*;
@SuperBuilder(toBuilder = true) @getter public class StyledText implements ParagraphProcessable {
@NonNull private String text; private Float fontSize; private PDFont font; private Color color; @SneakyThrows @Override public void process(Paragraph paragraph, Settings settings) { final Float actualFontSize = getFontSize() != null ? getFontSize() : settings.getFontSize(); final PDFont actualFont = getFont() != null ? getFont() : settings.getFont(); final Color actualColor = getColor() != null ? getColor() : settings.getTextColor(); // Handle new lines properly ... String[] lines = getText().split(PdfUtil.NEW_LINE_REGEX); for (int i = 0; i < lines.length; i++) { paragraph.add(new rst.pdfbox.layout.text.StyledText(lines[i], actualFontSize, actualFont, actualColor)); if (i < lines.length - 1) { paragraph.add(new NewLine(new FontDescriptor(actualFont, actualFontSize))); } } }
}
PS: I am very grateful for this great API. Thank you!
No branches or pull requests
pdfbox-layout supports underline styled text. I would like this feature exposed by easy-table through an AnnotationStyleTextBuilder.
The text was updated successfully, but these errors were encountered: