Generating PDF from ‘qute’ HTML template in Quarkus: any alternatives to flying-saucer-pdf?

huangapple go评论49阅读模式
英文:

Generating PDF from 'qute' HTML template in Quarkus: any alternatives to flying-saucer-pdf?

问题

生成PDF的方法是从使用“qute”模板生成的HTML中生成PDF(在原生模式下工作)。我使用的是flying-saucer-pdf,但似乎与原生构建不兼容。ITextRenderer在GraalVM中抛出异常:“在解析过程中发现未解决的方法:org.xhtmlrenderer.layout.BoxBuilder.createRootBox”。

英文:

is there a way to generate pdf from an html generated with "qute" templating ? (Works in native mode)

My point is that I use flying-saucer-pdf but it seems incompatible with native build. ITextRenderer throw an exception in graalvm : "Discovered unresolved method during parsing: org.xhtmlrenderer.layout.BoxBuilder.createRootBox".

答案1

得分: 3

我正在使用openhtmltopdf:

String result = transformersPDF.data("equipments", infoList, "filters", filterList).render();
PdfRendererBuilder builder = new PdfRendererBuilder();
builder.useFastMode();
builder.withHtmlContent(result, imagePath);
builder.toStream(baos);

transformersPDF 被注入:

@Inject
Template transformersPDF;

在Kubernetes环境中出现问题:
即使在本地工作时,图像也无法呈现。

希望有所帮助
(我很匆忙,抱歉无法进一步详细说明)

英文:

I'm using openhtmltopdf:

String result = transformersPDF.data("equipments", infoList, "filters", filterList).render();
PdfRendererBuilder builder = new PdfRendererBuilder();
builder.useFastMode();
builder.withHtmlContent(result, imagePath);
builder.toStream(baos);

transformersPDF is injected

@Inject
Template transformersPDF;

It works fine, but now I'm facing issues in kubernetes environment:
Images are not being rendered even when worked locally.

Hope it helps
(I'm in a hurry, sorry I can't elaborate further)

huangapple
  • 本文由 发表于 2023年5月22日 22:32:04
  • 转载请务必保留本文链接:https://go.coder-hub.com/76307254.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定