Skip to content

Commit 85914c1

Browse files
committed
updated
updated
1 parent 60c7b60 commit 85914c1

File tree

5 files changed

+33
-51
lines changed

5 files changed

+33
-51
lines changed

itext-java-html-pdf/.classpath

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" path="src/main/java" including="**/*.java"/>
4+
<classpathentry kind="output" path="target/classes"/>
5+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
6+
<classpathentry kind="var" path="M2_REPO/com/itextpdf/itextpdf/5.4.2/itextpdf-5.4.2.jar"/>
7+
<classpathentry kind="var" path="M2_REPO/com/itextpdf/tool/xmlworker/5.4.1/xmlworker-5.4.1.jar"/>
8+
</classpath>

itext-java-html-pdf/index.html

Lines changed: 20 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,23 @@
11
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
22
<html>
3-
<head>
4-
<title>HTML to PDF</title>
5-
<link href="style.css" rel="stylesheet" type="text/css" />
6-
</head>
7-
<body>
8-
<h1>HTML to PDF</h1>
9-
<table>
10-
<tr>
11-
<th>Id</th>
12-
<th>Name</th>
13-
</tr>
14-
<tr>
15-
<td>1</td>
16-
<td>Brit</td>
17-
</tr>
18-
<tr>
19-
<td>2</td>
20-
<td>John</td>
21-
</tr>
22-
</table>
23-
24-
<p>
25-
<span class="itext">itext</span> 5.4.2 <span class="description"> converting HTML to PDF</span>
26-
</p>
27-
<p>
28-
<div class="label">Title</div>
29-
<span class="">iText - Java HTML to PDF</span>
30-
<br/>
31-
32-
</p>
33-
34-
</body>
3+
<head>
4+
<title>HTML to PDF</title>
5+
<link href="style.css" rel="stylesheet" type="text/css" />
6+
</head>
7+
<body>
8+
<h1>HTML to PDF</h1>
9+
<p>
10+
<span class="itext">itext</span> 5.4.2 <span class="description"> converting HTML to PDF</span>
11+
</p>
12+
<table>
13+
<tr>
14+
<th class="label">Title</th>
15+
<td>iText - Java HTML to PDF</td>
16+
</tr>
17+
<tr>
18+
<th>URL</th>
19+
<td>http://hmkcode.com/itext-html-to-pdf-using-java</td>
20+
</tr>
21+
</table>
22+
</body>
3523
</html>

itext-java-html-pdf/pdf.pdf

1.67 KB
Binary file not shown.

itext-java-html-pdf/src/main/java/com/hmkcode/App.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@
33
import java.io.FileInputStream;
44
import java.io.FileOutputStream;
55
import java.io.IOException;
6-
76
import com.itextpdf.text.Document;
87
import com.itextpdf.text.DocumentException;
98
import com.itextpdf.text.pdf.PdfWriter;
109
import com.itextpdf.tool.xml.XMLWorkerHelper;
11-
import com.itextpdf.tool.xml.pipeline.css.CSSResolver;
1210

1311
public class App
1412
{
@@ -21,8 +19,6 @@ public static void main( String[] args ) throws DocumentException, IOException
2119
// step 3
2220
document.open();
2321
// step 4
24-
//CSSResolver cssResolver = XMLWorkerHelper.getInstance().getDefaultCssResolver(true);
25-
2622
XMLWorkerHelper.getInstance().parseXHtml(writer, document,
2723
new FileInputStream("index.html"));
2824
//step 5

itext-java-html-pdf/style.css

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,21 @@
11
h1 {
22
color:#ccc;
33
}
4-
5-
table tr td,th{
6-
width: 100px;
7-
height: 50px;
4+
table tr td{
85
text-align:center;
96
border:1px solid gray;
7+
padding:4px;
108
}
11-
129
table tr th{
13-
background-color: gray;
10+
background-color:#84C7FD;
1411
color:#fff;
12+
width: 100px;
1513
}
16-
1714
.itext{
1815
color:#84C7FD;
1916
font-weight:bold;
2017
}
21-
2218
.description{
2319
color:gray;
2420
}
25-
.label{
26-
width:70px;
27-
height:30px;
28-
display:inline-block;
29-
background-color:#84C7FD;
30-
color:#fff;
31-
}
21+

0 commit comments

Comments
 (0)