masteryi
V2EX  ›  问与答

Java 导出简历 pdf 怎么实现?

  •  
  •   masteryi · Jun 14, 2018 · 2143 views
    This topic created in 3082 days ago, the information mentioned may be changed or developed.

    主要是样式问题
    1.html 转 pdf,项目是前后端分离的,前端能传带 css 的 html 到后端吗?
    2.后端自己生成,样式怎么写?
    什么方法好点?用什么工具

    6 replies  •  2018-06-14 22:57:55 +08:00
    ss098
    ss098
    Jun 14, 2018 via Android
    1
    wkhtmltopdf
    yukiww233
    yukiww233
    Jun 14, 2018
    2
    直接调用系统的打印不行么
    mdluo
    mdluo
    Jun 14, 2018
    3
    要让访问者直接在网页上打印,为了排版不至于太糟糕,需要写一些 CSS media query 的东西,参考: https://www.smashingmagazine.com/2011/11/how-to-set-up-a-print-style-sheet/

    如果是动态把网页生成一个 pdf,可以用 Puppeteer,参考: https://pptr.dev/#?product=Puppeteer&version=v1.5.0&show=api-pagepdfoptions
    doctorwei
    doctorwei
    Jun 14, 2018
    4
    itextpdf 了解下
    jiqing
    jiqing
    Jun 14, 2018
    6
    @luffysup #5 这个东西怎么实现的
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1764 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 15:39 · PVG 23:39 · LAX 07:39 · JFK 10:39
    ♥ Do have faith in what you're doing.