如何将HTML内容转换为PDF而不会丢失使用Java的格式? [英] How to convert an HTML content to PDF without losing the formatting using Java?

查看:381
本文介绍了如何将HTML内容转换为PDF而不会丢失使用Java的格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些HTML内容(包括格式标签,例如 strong ,图片等)。在我的Java代码中,我想将此HTML内容转换为PDF文档而不用丢失HTML格式。

I have some HTML content (including formatting tags such as strong, images etc).In my Java code, I want to convert this HTML content into a PDF document without losing the HTML formatting.

无论如何在Java中使用iText或任何其他库吗?

Is there anyway to do it in Java (using iText or any other library)?

推荐答案

我会尝试 DocRaptor.com 。它以任何语言将html转换为pdf或html为xls,并且因为它使用Prince XML(不需要支付昂贵的许可费),所以质量比其他选项好很多。它也是一个网络应用程序,因此无需下载。轻松解决漫长而令人沮丧的编码问题。

I would try DocRaptor.com. It converts html to pdf or html to xls in any language, and since it uses Prince XML (without making you pay the expensive license fee), the quality is a lot better than the other options out there. It's also a web app, so there's nothing to download. Easy way to get around long, frustrating coding.

以下是一些例子:
https:/ /docraptor.com/documentation#coding_examples

这篇关于如何将HTML内容转换为PDF而不会丢失使用Java的格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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