From a53bf2e84f273f1117465ddb685e7124537fe995 Mon Sep 17 00:00:00 2001 From: Emmeran Seehuber Date: Tue, 12 Apr 2016 14:55:54 +0200 Subject: [PATCH] Table page break bug and PDFBOX character bug This is a reduced testcase which shows two things: - The repeated table header is broken on pagebreak - The arrow symbol is not correctly resolved from the unicode character. --- .../testcases/RepeatedTableSample.java | 33 ++ .../testcases/RepeatedTableSample.html | 462 ++++++++++++++++++ 2 files changed, 495 insertions(+) create mode 100644 openhtmltopdf-examples/src/main/java/com/openhtmltopdf/testcases/RepeatedTableSample.java create mode 100644 openhtmltopdf-examples/src/main/resources/testcases/RepeatedTableSample.html diff --git a/openhtmltopdf-examples/src/main/java/com/openhtmltopdf/testcases/RepeatedTableSample.java b/openhtmltopdf-examples/src/main/java/com/openhtmltopdf/testcases/RepeatedTableSample.java new file mode 100644 index 000000000..9b17fd537 --- /dev/null +++ b/openhtmltopdf-examples/src/main/java/com/openhtmltopdf/testcases/RepeatedTableSample.java @@ -0,0 +1,33 @@ +package com.openhtmltopdf.testcases; + +import com.openhtmltopdf.bidi.support.ICUBidiReorderer; +import com.openhtmltopdf.bidi.support.ICUBidiSplitter; +import com.openhtmltopdf.pdfboxout.PdfBoxRenderer; +import com.openhtmltopdf.pdfboxout.PdfRendererBuilder; +import com.openhtmltopdf.pdfboxout.PdfRendererBuilder.TextDirection; +import org.apache.pdfbox.io.IOUtils; +import org.apache.pdfbox.util.Charsets; + +import java.io.FileOutputStream; + +public class RepeatedTableSample { + public static void main(String[] args) throws Exception { + byte[] htmlBytes = IOUtils.toByteArray(RepeatedTableSample.class + .getResourceAsStream("/testcases/RepeatedTableSample.html")); + String html = new String(htmlBytes, Charsets.UTF_8); + FileOutputStream outputStream = new FileOutputStream("RepeatedTableSample.pdf"); + PdfRendererBuilder builder = new PdfRendererBuilder(); + builder.useBidiSplitter(new ICUBidiSplitter.ICUBidiSplitterFactory()); + builder.useBidiReorderer(new ICUBidiReorderer()); + builder.defaultTextDirection(TextDirection.LTR); + builder.withHtmlContent(html, ""); + builder.toStream(outputStream); + PdfBoxRenderer pdfBoxRenderer = builder.buildPdfRenderer(); + // Add Noto Sans Font + // pdfBoxRenderer.getFontResolver().addFont(tempFile.getPath(), null); + pdfBoxRenderer.layout(); + pdfBoxRenderer.createPDF(); + outputStream.close(); + + } +} diff --git a/openhtmltopdf-examples/src/main/resources/testcases/RepeatedTableSample.html b/openhtmltopdf-examples/src/main/resources/testcases/RepeatedTableSample.html new file mode 100644 index 000000000..b66aedadc --- /dev/null +++ b/openhtmltopdf-examples/src/main/resources/testcases/RepeatedTableSample.html @@ -0,0 +1,462 @@ + + + + + + + + + + +

+
 
+

+
+ + + + + + + +
ABC5 + + Lorem ipsum dolor site
+ + + + + +
  +
+ + + + + + + + + + + + + + +
+
Aliquyam
+
+
+ Voluptua aliquyam +
+
+
Stet clita kasd gubergren, no + sea takimata sanctus est Lorem ipsum dolor sit amet: +
+
    +
  • + + + + + +
    +
    Lorem + ipsum dolor sit amet, consetetur sadipscing elitr, + sed diam nonumy eirmod tempor invidunt ut labore et + dolore magna aliquyam erat, sed diam voluptua. At + vero eos et accusam et justo duo dolores et ea + rebum. Stet clita kasd gubergren, no sea takimata + sanctus est Lorem ipsum dolor sit amet. +
    +
    +
  • +
+
+
+
    +
  • + + + + + +
    +
    Bacon + ipsum dolor amet beef ribs bacon short ribs ribeye + prosciutto cow biltong tri-tip capicola fatback + short loin. Pork chop tongue sirloin picanha ribeye + ham hock. Short loin prosciutto ground round + meatball tri-tip, shank venison chicken pork loin + tongue fatback ham hock bresaola leberkas pastrami. + Hamburger t-bone cow ball tip beef turducken. +
    +
    +
  • +
+
+
+
Does your lorem ipsum text long + for something a little meatier? Give our generator a try… it’s tasty! +
+
    +
  • + + + + + +
    +
    Beef + ribs boudin tri-tip landjaeger, tail picanha spare + ribs turkey frankfurter flank cow meatloaf rump. + Tail beef ribs short ribs pastrami boudin, porchetta + meatloaf biltong. Tenderloin pork loin cow corned + beef, brisket prosciutto porchetta ham hock + turducken kevin hamburger pancetta ribeye shankle + bresaola. Andouille t-bone corned beef ground round + meatloaf. +
    +
    +
  • +
+
+
+
    +
  • + + + + + +
    +
    + Bresaola turkey pig chuck, cupim turducken filet + mignon kielbasa t-bone shankle alcatra landjaeger + pork belly doner. Beef ribs prosciutto jowl, + frankfurter meatball biltong hamburger short loin + picanha. Beef pork belly salami kevin, ham hock + brisket tongue landjaeger strip steak pork chop + sausage jowl meatloaf venison prosciutto. Cupim + flank beef porchetta short loin prosciutto tri-tip + hamburger picanha ham swine spare ribs tenderloin + pork loin corned beef. +
    +
    +
  • +
+
+
+
+
+
+
+
+
End of Document
+
+ + +