danfickle / danfickle/openhtmltopdf
Generate PDF from multiple HTML
- Dominant language
- Java
- Stars
- 2.2k
- Forks
- 423
- PR merge metrics
- No merged PRs in 30d
Description
I am using this library to generate PDF from multiple HTML files. I can do so but it starts new PDF on a new page instead of existing page. Can anyone help me?
Attaching my code here :
```
PDDocument doc = new PDDocument();
File file = File.createTempFile("temp_openhtmltopdf_", ".pdf");
PdfRendererBuilder builder = new PdfRendererBuilder();
builder.useDefaultPageSize(210, 297, PageSizeUnits.MM);
builder.useSVGDrawer(new BatikSVGDrawer());
builder.usePDDocument(doc);
for (String html : uris) {
builder.withHtmlContent(html, "UTF-8");
PdfBoxRenderer renderer = builder.buildPdfRenderer();
renderer.createPDFWithoutClosing();
}
doc.save(file);
doc.close();
```
It generates 2 page PDF. I want to start the 2nd page from the ending of the 1st page.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the PdfRendererBuilder and PdfBoxRenderer flow shown in the report, especially repeated createPDFWithoutClosing() calls against one PDDocument. Trace how each HTML input is laid out and where the new page begins; done means later HTML can continue in remaining space instead of always starting on a new page, with a regression test if the project’s existing tests cover this path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- html, java
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100