我正在使用 wkhtmltoPDF 从 html 字符串生成 pdf 并且它按预期对我来说工作正常,但现在我必须将输出生成为 Image 并且我无法找到示例代码或任何库。
我已经参考 了https://github.com/jhonnymertz/java-wkhtmltopdf-wrapper来生成 pdf。
import com.github.jhonnymertz.wkhtmltopdf.wrapper.Pdf;
public class WKhtmlToPdf
{
Pdf pdf = new Pdf();
pdf.addPageFromString("html code");
pdf.addToc();
try{
pdf.saveAs("Output.pdf");
}
catch (IOException e)
{
}
catch (InterruptedException e)
{
}
}
我想要一个输出图像。谁能告诉我,我不想使用 Runtime.getRuntime().exe()方法来生成输出。
提前致谢。