danfickle / danfickle/openhtmltopdf

Add a way to resolve Images/Css locally

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

Description

Currently it would be great if there was a way to have a CssProvider and a ImageProvider,
that can actually resolve images and fonts.

Consider a HTML with multiple Images that have relative paths like: `images/my_image.png` it would be amazing if one could resolve them locally without making a URL request, like it's done in iText via:
```java
new AbstractImageProvider() {
@Override
public String getImageRootPath() {
return environmentPath("/my_path");
}

@Override
public Image retrieve(String src) {
if (src.startsWith("/barcode/delivery/")) {
String type = src.substring(18);
return barcode((DeliveryRequest) data, writer, type);
} else {
return super.retrieve(src);
}
}
}
```

this would also give the possibility to create a image dynamically.

Same goes for CSS. (Currently the only way is to override the httpStreamImplementation, which works for Images only I guess. And a CSS should be providable without being inside the html)

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.