LibrePDF / OpenPDF

OpenPDF is a free Java library for creating and editing PDF files, with a LGPL and MPL open source license. OpenPDF is based on a fork of iText. We welcome contributions from other developers. Please feel free to submit pull-requests and bugreports to this GitHub repository.
Other
3.61k stars 597 forks source link

styleSheet.loadTagStyle for A href link with underscore in PDF #1232

Open wider2 opened 2 weeks ago

wider2 commented 2 weeks ago

Sorry for style question, but library cannot provide right behavior

if I try to add rules about link with underscore, it will never be rendered in PDF as link with underscore. it is look like text-decoration does not work

    final StyleSheet styleSheet = new StyleSheet();
    styleSheet.loadTagStyle("a", "color", "blue");
    **styleSheet.loadTagStyle("a", "text-decoration", "underline");**
    final Map<String, Object> interfaceProps = new HashMap<>();
    try {
        final List<Element> pdfElements = HTMLWorker.parseToList(reader, styleSheet, interfaceProps);
        for (final Element elem : pdfElements) {
            textCell.addElement(elem);
        }
    } catch (IOException e) {
wider2 commented 2 weeks ago

The only 1 solution i have found is styleSheet.loadTagStyle("a", "style", "text-decoration:underline;");

natl-set commented 2 weeks ago

Sounds like it works as expected. text-decoration is only applicable with style attribute.