openj9-jdk8-wkhtmltox
Based on semeru-runtimes(openJ9)-jre8 & wkhtmltox image for built html to pdf java environment.
629
Based on openJ9-jre8(semeru-runtimes) & wkhtmltox image for built html to pdf java environment.
use the image to build your own html to pdf (image) java service.
docker pull trifolium0/openj9-jdk17-wkhtmltox:latestFROM trifolium0/openj9-jdk17-wkhtmltox:latest as build_app_image
LABEL app="test-htmltopdf" version="1.0.0" by="trifolium.wang"
MAINTAINER trifolium <[email protected]>
ENV APP_VERSION 1.0.0
RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone \
&& rm -rf /app \
&& mkdir /app
WORKDIR /app
COPY target/test-htmltopdf.jar /app/app.jar
ENTRYPOINT ["java", "-XX:+UseContainerSupport", "-XX:InitialRAMPercentage=70.0", \
"-XX:MaxRAMPercentage=70.0", "-jar", "app.jar"]
EXPOSE 8080
<dependency>
<groupId>com.github.jhonnymertz</groupId>
<artifactId>java-wkhtmltopdf-wrapper</artifactId>
<version>1.3.0-RELEASE</version>
</dependency>
private String generatePDFFile(String html) throws Exception {
// 自动查找wkhtmltopdf可执行,找不到手动指定吧
String executable = WrapperConfig.findExecutable();
Pdf pdf = new Pdf(new WrapperConfig(executable));
pdf.setTimeout(30);
pdf.addParam(new Param("--enable-javascript"));
Page page = pdf.addPageFromString(html);
//TODO 设置page参数
String pdfPath = "pdf/test.pdf";
pdf.saveAs(pdfPath);
return pdfPath;
}
Content type
Image
Digest
sha256:a75a39c26…
Size
211.6 MB
Last updated
about 2 years ago
docker pull trifolium0/openj9-jdk8-wkhtmltox