Skip to content

Commit b4a2e93

Browse files
maayanb180MaayanBN
andauthored
Issue 1274 - HTML export - When image and text divs are rendered one after the other, they are placed NEXT TO each other, instead of one AFTER the other - Fixed. (#1275)
Co-authored-by: MaayanBN <maayanb@continuitysoftware.com>
1 parent eeb30c3 commit b4a2e93

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

openpdf/src/main/java/com/lowagie/text/html/HtmlWriter.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,7 @@ protected void write(Element element, int indent) throws IOException {
667667
case Element.PHRASE: {
668668
Phrase phrase = (Phrase) element;
669669
styleAttributes = new Properties();
670+
styleAttributes.setProperty(Markup.CSS_KEY_DISPLAY, Markup.CSS_VALUE_GRID);
670671
if (phrase.hasLeading()) {
671672
styleAttributes.setProperty(Markup.CSS_KEY_LINEHEIGHT, phrase.getLeading() + "pt");
672673
}
@@ -691,6 +692,7 @@ protected void write(Element element, int indent) throws IOException {
691692
case Element.ANCHOR: {
692693
Anchor anchor = (Anchor) element;
693694
styleAttributes = new Properties();
695+
styleAttributes.setProperty(Markup.CSS_KEY_DISPLAY, Markup.CSS_VALUE_GRID);
694696
if (anchor.hasLeading()) {
695697
styleAttributes.setProperty(Markup.CSS_KEY_LINEHEIGHT, anchor.getLeading() + "pt");
696698
}
@@ -721,9 +723,11 @@ protected void write(Element element, int indent) throws IOException {
721723
case Element.PARAGRAPH: {
722724
Paragraph paragraph = (Paragraph) element;
723725
styleAttributes = new Properties();
726+
styleAttributes.setProperty(Markup.CSS_KEY_DISPLAY, Markup.CSS_VALUE_GRID);
724727
if (paragraph.hasLeading()) {
725728
styleAttributes.setProperty(Markup.CSS_KEY_LINEHEIGHT, paragraph.getTotalLeading() + "pt");
726729
}
730+
727731
// start tag
728732
addTabs(indent);
729733
writeStart(HtmlTags.DIV);
@@ -990,6 +994,7 @@ protected void writeSection(Section section, int indent) throws IOException {
990994
depth = 5;
991995
}
992996
Properties styleAttributes = new Properties();
997+
styleAttributes.setProperty(Markup.CSS_KEY_DISPLAY, Markup.CSS_VALUE_GRID);
993998
if (section.getTitle().hasLeading()) {
994999
styleAttributes.setProperty(Markup.CSS_KEY_LINEHEIGHT, section.getTitle().getTotalLeading() + "pt");
9951000
}

openpdf/src/main/java/com/lowagie/text/html/Markup.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,11 @@ public class Markup {
320320
*/
321321
public static final String CSS_VALUE_BLOCK = "block";
322322

323+
/**
324+
* A possible value for the DISPLAY key
325+
*/
326+
public static final String CSS_VALUE_GRID = "grid";
327+
323328
/**
324329
* a CSS value for text font weight
325330
*/

0 commit comments

Comments
 (0)