Skip to content

Commit

Permalink
Table page break bug and PDFBOX character bug
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rototor committed Apr 12, 2016
1 parent 89ff4ff commit a53bf2e
Show file tree
Hide file tree
Showing 2 changed files with 495 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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();

}
}
Loading

0 comments on commit a53bf2e

Please sign in to comment.