danfickle / danfickle/openhtmltopdf

PDF creation from html string fails unless testMode(true)

Open
#107 12 comments 2 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
2.2k
Forks
423
PR merge metrics
No merged PRs in 30d

Description

My code:
```
private String test = "

Hello world!

";

PdfRendererBuilder builder = new PdfRendererBuilder();
builder.withW3cDocument(DOMBuilder.jsoup2DOM(Jsoup.parse(test)), "http://localhost:8888/");
builder.toStream(outputStream);
builder.testMode(true);
builder.run();
```

The above renders nicely -- thanks!!
[myfilename (16).pdf](https://github.com/danfickle/openhtmltopdf/files/1160845/myfilename.16.pdf)

However, if testMode isn't set to true, the PDF created renders what looks like an empty page. There is a /Filter /FlateDecode section in the actual file created, but, apparently the contents of the stream are not valid
[myfilename (15).pdf](https://github.com/danfickle/openhtmltopdf/files/1160842/myfilename.15.pdf)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.