Java - openpdf - Splitting words using hyphens

We are currently utilizing openpdf 1.3.26 template 2.1 to create PDFs from HTML and CSS. Within our coding, there is a div element styled as follows:

.text-block{
         display:block;
         text-align:justify;
         word-wrap: break-word;
         hyphens: auto;
         width:50px
         
        }
<span lang="de"  class="text-block" >myyyextraaaaaaaaalong text </span>

Interestingly, the hyphens appear when testing in my browser, but do not show up in the generated PDF file.

Answer №1

It appears that your PDF processor may only support CSS 2.1, while the hyphens property is from CSS3.

Answer №2

Give this code snippet a try. Check out the article here.

.text-block {
  display: block;
  text-align: justify;
  word-wrap: break-word;
  hyphens: none;
  width: 50px
}
<span lang="de" class="text-block" >myyyextraaaaaaaaalong text</span>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the method for defining a CSS property for the ::before pseudo element within an Angular component?

Can TypeScript variables be accessed in SCSS code within an Angular component? I am looking to achieve the following: <style type="text/css"> .source-status-{{ event.status.id }}::before { border-left: 20px solid {{ event.status.colo ...

Toggling jQuery to show or hide content depending on the selector

I am looking to implement a jQuery-based animation and here is the code I have so far: >items=document.querySelectorAll("#customers td span"); [<span alt=​" 02,Counter,11,2013-04-06 14:​59:​16">​ 02​</span>​, <span>​11 ...

Executing Java program from a Node.js application

After researching, I discovered a few methods for running `java` files within a `node.js` application. One option is to spawn a child process: (where the java code is contained with dependencies in an executable `jar`). var exec = require('child_proc ...

Personalized element IDs and unique CSS styles

After editing the code snippet below... <div id="rt-utility"><div class="rt-block fp-roksprocket-grids-utility title5 jmoddiv"> I applied the changes in my custom.css file like this: #rt-utility .rt-block {CODE HERE} However, when attemptin ...

Employing jQuery for adding a class to the initial TD in every table row

Currently, I am dealing with a table structured like this: <table width="100%" border="0" cellspacing="0" cellpadding="0" id="tablecontent"> <tr class="tablerow"> <td>This is the td I want to add a class to.</td> <td c ...

What steps can I take to ensure a website designed for Firefox will work seamlessly on Safari and Chrome browsers as well?

As someone who is still learning about web development, I find myself struggling with browser compatibility issues. It's frustrating to see my website looking different in Chrome compared to Safari. While I know that browsers interpret code differentl ...

Inconsistency with Mobile Viewport Problem

Apologies for the chaos below, but I've spent quite some time attempting to fix this on my own. It's time to surrender and seek assistance! Here are some screenshots to illustrate the issue: The problem is that sometimes the webpage functions c ...

What steps can I take to ensure my CSS selector for the element is functioning properly?

Here is an example of some code: <html> <head> <style> .test{ background-color: red; p { background-color: yellow; } } </style> </head> <body> <div class="test"> ...

Adjust the positioning of a class element

I have an eye icon that changes position when clicked. Initially, it is set to left: 10%;, but if there is a DOM element with the ID login-section, it should be repositioned to left: 50%;. I attempted to use document.getElementsByClassName('fa-eye-sl ...

After obtaining two IDs, I am required to add the first ID to the URL and click on the accept button. However, I am facing difficulties in adding the second ID to the URL afterwards

I am facing an issue with appending the second id to the URL after clicking on the accept button. The first id appends successfully, but the second one does not. Here is my current code: String confirmationURL = "https://test-website/#/email?type=proposa ...

PHP - designate a separate folder for script and style resources

There seems to have been some discussion about this issue before, but I am struggling to find a solution. I want to add css, js, and asset files to my php framework. However, when calling these files, the path must always match the folder structure like t ...

Is there a child missing? If so, add a class

I need to add the class span.toggle if the parent element of li does not have a child ul element. click here to view on codepen Snippet of HTML: <html lang="en"> <head> <meta charset="UTF-8> <title>No Title</title>& ...

Hide Scrollbar in CSS

Looking for a way to conceal the vertical scrollbar on my website, especially on mobile devices with touch scrolling capabilities. I attempted using CSS but didn't get satisfactory results, especially on older browser versions. ...

Adjusting the size of an image based on the size of the window

I'm currently working on my first website project. I have successfully implemented a large image banner, however, I am facing an issue with setting its height. Whenever I try to adjust the height using percentage values, the banner disappears. My goal ...

Retrieving text from a collection of Web Elements can be time-consuming

I have written a code to extract data from a web table, where each row is read as text and added to another list before being sent to a method for writing to an excel file. However, this process of reading approximately 200 rows and writing the data to a n ...

Help! The CSS height property is not working properly and I'm not sure how to resolve

I'm facing an issue with the height property of a specific div and I can't seem to fix it. SCSS: .security{ border: 3px #1D3176 solid; display: flex; h2{ position: ...

Creating a three-column layout in HTML5 with resizable left and center columns, and a fixed right column

Looking to create a full screen layout with three columns, where the left/center column is resizable and the right column remains fixed. Currently using the resize style for the left area, but running into issues as the center area does not adjust in size ...

Clearing up confusion around identifying checkbox elements using XPath in Selenium WebDriver with Java, specifically within a

HTML code <div class="modal-footer slds-modal__footer" data-aura-rendered-by="2805:0"> <div class="rssDialogText grantAccessCheckbox packagingSetupUIRssDialogFooter" data-aura-rendered-by="2595:0" data-aura-class="packagingSetupUIRssDialogFooter" ...

Retrieving fresh CSS data from earlier animated elements within a Greensock timeline

In my code, I am using a TimelineLite() to perform a series of sequential tweens with .to(). What I want to achieve is accessing the output value from one of the early tweens in order to use it for constructing later tweens. Is there any way to retrieve t ...

After the page is reloaded, apply a class to the divs by selecting them based on the "data" attribute

I have a set of four cards labeled "card", each representing different body parts: eyes, torso, arms, and legs. <div class="card" data-lesson="eyes">eyes</div> <div class="card" data-lesson="torso">torso</div> <div class="card" ...