使用Itext将Html转换为Pdf,使用iText将HTML转换为PDF

我发布这个问题是因为许多开发人员以不同的形式提出或多或少相同的问题.我将自己回答这个问题(我是iText集团的创始人/首席技术官),因此它可以成为"维基答案".如果Stack Overflow"文档"功能仍然存在,那么这将是文档主题的一个很好的候选者.

源文件:

我想将以下HTML文件转换为PDF:

Colossal (movie)

.poster { width: 120px;float: right; }

.director { font-style: italic; }

.description { font-family: serif; }

.imdb { font-size: 0.8em; }

a { color: red; }

Colossal (2016)

Directed by Nacho Vigalondo
Gloria is an out-of-work party girl

forced to leave her life in New York City, and move back home.

When reports surface that a giant creature is destroying Seoul,

she gradually comes to the realization that she is somehow connected

to this phenomenon.

Read more about this

你可能感兴趣的:(使用Itext将Html转换为Pdf,使用iText将HTML转换为PDF)