java转pdf工具对比

itext之html2pdf

java 复制代码
BufferedOutputStream outputStream = FileUtil.getOutputStream(dirName + "/" + sElUser.getUserid() + "-" + personName + "XXX.pdf");   
 private void writeToOutputStream(String htmlStr, OutputStream outputStream) {
        try {
            ConverterProperties converterProperties = new ConverterProperties();
            converterProperties.setCharset("UTF-8");
            FontProvider fontProvider = new FontProvider();
            fontProvider.addSystemFonts();
            converterProperties.setFontProvider(fontProvider);
            HtmlConverter.convertToPdf(htmlStr, outputStream, converterProperties);
        } catch (Exception e) {
            log.error("writeToOutputStream 生成模板内容失败", e);
        }
    }
相关推荐
草莓base14 分钟前
【JUC】Future + CompletableFuture详解
java·juc·1024程序员节
极光雨雨36 分钟前
Java Spring MVC 中 WebMvcConfigurer 和 HandlerInterceptor之间的关系和用法案例
java·spring·mvc
侧耳42937 分钟前
android11禁止安装apk
android·java·1024程序员节
R.lin1 小时前
OSS服务模块-基于数据库配置的Java OSS服务解决方案,支持MinIO、七牛云、阿里云和腾讯云
java·数据库·后端·mysql
_extraordinary_1 小时前
Java SpringAOP --- AOP的使用,AOP的源码
java·spring·1024程序员节
R.lin1 小时前
使用 Undertow 替代 Tomcat
java·后端·tomcat
冬夜戏雪2 小时前
[学习日记]看书笔记
java·学习
初级程序员Kyle2 小时前
开始改变第一天 JVM的原理到调优(2)
java·面试
程序员三明治2 小时前
Spring AOP:注解配置与XML配置双实战
java·后端·spring·代理模式·aop·1024程序员节