内联链接文档将html转换为pdf [英] Convert html to pdf with linked documents inline

查看:130
本文介绍了内联链接文档将html转换为pdf的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要最好使用批处理在Java/J2EE平台的服务器端以编程方式将一堆静态HTML文档转换为单个PDF文件. pdf文件将分发给站点用户,以供离线浏览网页.

I need to convert a bundle of static HTML documents into a single PDF file programmatically on the server side on a Java/J2EE platform using a batch process preferably. The pdf files would be distributed to site users for offline browsing of the web pages.

要求的要点是:

  1. 最终的pdf文档中不应出现顶部的横幅.
  2. 应该将左侧的导航栏从html超链接转换为pdf书签.
  3. 网页中存在的所有超链接内容(html/pdf/doc/docx等)应该是带有pdf书签的最终pdf文档的一部分.

是否有任何标准的开源方法?

Is there any standard open source way of doing this?

推荐答案

尝试 Apache FOP .我只是用它来将XML转换为PDF ,我认为您可以对HTML/DOM执行相同的操作.该网站有整节有关在Java应用程序中运行FOP的内容,一个href ="http://xmlgraphics.apache.org/fop/0.95/embedding.html#ExampleDOM2PDF" rel ="nofollow noreferrer">将DOM转换为PDF的示例代码.

Try Apache FOP. I just used it to convert XML to PDF and I think you can do the same with HTML/DOM. The website has a whole section on running FOP in a Java application and there's example code for DOM to PDF.

这篇关于内联链接文档将html转换为pdf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆