Я генерирую HTML-код на лету для каталога, и я хотел бы также создать PDF.Я подумал о том, чтобы просто напечатать HTML-страницу в PDF-документ, но я теряю некоторую затененность фона и другие вещи, и это распределяет контент по страницам.
Я немного читал об iText, но я этого не сделалвыяснил, как правильно отформатировать его, и я не знаю, как сделать так, чтобы он не разбивал мой контент по страницам.
Это начало моей HTML-страницы, я включил несколько элементов, чтобы выможно увидеть, как содержание разбито.Я прошу прощения за уродливый HTML, я не могу на самом деле получить таблицу div, чтобы выглядеть правильно!
<style type="text/css">
<!--
tr#odd {
background-color:#e2e2e2;
vertical-align:top;
}
tr#even {
vertical-align:top;
}
div#title {
font-size:16px;
font-weight:bold;
}
div#mpaa {
font-size:10px;
}
div#genre {
font-size:12px;
font-style:italic;
}
div#plot {
height: 63px;
font-size:12px;
overflow:hidden;
}
-->
</style>
<html>
<title>Movie Catalog</title>
<body>
718 Movies
<br />
<br />
<table>
<tr id="odd">
<td>
<img src=".\images\10,000BCDVDrip.jpg" width="75" height="110">
</td>
<td>
<div id="title">10,000 BC</div>
<div id="mpaa"> </div>
<div id="genre">Adventure, Drama</div>
<div id="plot">A prehistoric epic that follows a young mammoth hunter's journey through uncharted territory to secure the future of his tribe.</div>
</td>
</tr>
<tr id="even">
<td>
<img src=".\images\101Dalmatians1961PlatinumEditionDVDRipXviD.jpg" width="75" height="110">
</td>
<td>
<div id="title">101 Dalmatians (Platinum Edition)</div>
<div id="mpaa">G </div>
<div id="genre">Comedy, Family, Disney</div>
<div id="plot">The Live action adaptation of a Disney Classic. When a litter of dalmatian puppies are abducted by the minions of Cruella De Vil, the parents must find them before she uses them for a diabolical fashion statement.</div>
</td>
</tr>
<tr id="odd">
<td>
<img src=".\images\102DalmationsDVDrip.jpg" width="75" height="110">
</td>
<td>
<div id="title">102 Dalmations</div>
<div id="mpaa">G </div>
<div id="genre">Family</div>
<div id="plot">After a spot of therapy Cruella De Vil is released from prison a changed woman. Devoted to dogs and good causes, she is delighted that Chloe, her parole officer, has a dalmatian family and connections with a dog charity. But the sound of Big Ben can reverse the treatment so it is only a matter of time before Ms De Vil is back to her incredibly ghastly ways, using her new-found connections with Chloe and friends</div>
</td>
</tr>
<tr id="even">
<td>
<img src=".\images\127Hours2010720pBluRayx264.jpg" width="75" height="110">
</td>
<td>
<div id="title">127 Hours</div>
<div id="mpaa">R Rated R for language and some disturbing violent content/bloody images.</div>
<div id="genre">Action, Adventure, Drama, Suspense, Thriller</div>
<div id="plot">127 Hours is the true story of mountain climber Aron Ralston's (James Franco) remarkable adventure to save himself after a fallen boulder crashes on his arm and traps him in an isolated canyon in Utah. Over the next five days Ralston examines his life and survives the elements to finally discover he has the courage and the wherewithal to extricate himself by any means necessary, scale a 65 foot wall and hike over eight miles before he is finally rescued. Throughout his journey, Ralston recalls friends, lovers (Clemence Poesy), family, and the two hikers (Amber Tamblyn and Kate Mara) he met before his accident. Will they be the last two people he ever had the chance to meet?</div>
</td>
</tr>
<tr id="odd">
<td>
<img src=".\images\13GoingOn30DVDrip.jpg" width="75" height="110">
</td>
<td>
<div id="title">13 Going On 30</div>
<div id="mpaa">PG-13 for some sexual content and brief drug references</div>
<div id="genre">Comedy, Fantasy, Romance</div>
<div id="plot">After total humiliation at her thirteenth birthday party, Jenna Rink wants to just hide until she's thirty. Thanks to some wishing dust, Jenna's prayer has been answered. With a knockout body, a dream apartment, a fabulous wardrobe, an athlete boyfriend, a dream job, and superstar friends, this can't be a better life. Unfortunetly, Jenna realizes that this is not what she wanted. The only one that she needs is her childhood best friend, Matt, a boy that she thought destroyed her party. But when she finds him, he's a grown up, and not the same person that she knew.</div>
</td>
</tr>
...
...
</table>
</body>
</html>
Вы можете увидеть, как это выглядит: http://timelessdesigncafe.com/movies/catalog.html Обратите внимание, что фонзатенение чередуется.Когда я печатаю в PDF, я теряю затенение, и что еще более важно, он разбивает «строку» / фильм на две страницы, и мне нужно этого избегать.
Заранее спасибо !!