我正在使用文本7将html转换为pdf,但是它没有显示正确的字体样式您能帮助解决这个问题吗

f4t66c6m  于 2021-07-03  发布在  Java
关注(0)|答案(0)|浏览(206)

{file src=new文件(“/home/info/documents/prototypeimpl(1)/prototypeimpl/src/main/resources/templates/terms\u new.html”);file dest=new file(“/home/info/documents/prototypeimpl(1)/prototypeimpl/src/main/resources/generatedpdfs/termsa4112123size”);

PdfDocument pdf = new PdfDocument(new PdfWriter(dest));
    Document doc = new Document(pdf, PageSize.A4);
    InputStream stream = new FileInputStream(src);

    ConverterProperties converterProperties = new ConverterProperties();
    FontProvider dfp = new DefaultFontProvider(true, true, true);
    converterProperties.setFontProvider(dfp);
    PdfFont font = PdfFontFactory.createFont(FontConstants.HELVETICA_BOLD);

    HtmlConverter.convertToPdf(stream, pdf, converterProperties);
}

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题