Skip to content

Commit 3f6e47d

Browse files
author
Alexandr Fedorov
committed
Improve html2pdf readme
DEVSIX-9462
1 parent 4e56f84 commit 3f6e47d

File tree

2 files changed

+115
-24
lines changed

2 files changed

+115
-24
lines changed

README.md

Lines changed: 115 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,130 @@
1-
**[pdfHtml][pdfHtml]** is an [iText][itext] add on.
1+
<p align="center">
2+
<img src="./assets/iText_Logo_Small.png" alt="Logo iText">
3+
</p>
24

3-
This add on will allow you to easily convert HTML to PDF or iText objects.
45

5-
The **pdfHtml Community** source code is hosted on [Github][github], where you can also [download the latest releases][latest].
6+
[![Maven Central](https://img.shields.io/maven-central/v/com.itextpdf/html2pdf)](https://mvnrepository.com/artifact/com.itextpdf/html2pdf)
7+
[![AGPL License](https://img.shields.io/badge/license-AGPL-blue.svg)](https://github.com/itext/itext-pdfhtml-java/blob/develop/LICENSE.md)
8+
[![GitHub all releases](https://img.shields.io/github/downloads/itext/itext-pdfhtml-java/total)](https://github.com/itext/itext-pdfhtml-java/releases/latest)
9+
![GitHub commit activity (branch)](https://img.shields.io/github/commit-activity/m/itext/itext-pdfhtml-java)
610

7-
You can also [build pdfHtml Community from source][building].
11+
html2PDF is an iText Core add-on available for Java and C# (.NET) that allows you to easily convert HTML and CSS into
12+
standards
13+
compliant PDFs that are accessible, searchable and usable for indexing.
814

9-
Starting from version 6.1.0 **pdfHtml** supports native image compilation using GraalVM. See [building] for details.
15+
### The key features of html2PDF are:
1016

11-
If you have an idea on how to improve **pdfHtml** and you want to submit code,
12-
please read our [Contribution Guidelines][contributing].
17+
* Converting XML/HTML & CSS to PDF or PDF/A
18+
* Convert XML/HTML & CSS to iText objects
19+
* Good default support for HTML5 and CSS3
20+
* Easily configurable and extensible when needed
21+
* Not based on any browser engine implementation
1322

14-
**pdfHtml** is dual licensed as [AGPL][agpl]/[Commercial software][sales].
23+
For the full list of supported\unsupported features please refer to [Supported\Unsupported featues](https://kb.itextpdf.com/itext/what-features-are-supported-or-unsupported-in-pdfh)
1524

16-
AGPL is a free / open source software license.
1725

18-
This doesn't mean the software is [gratis][gratis]!
26+
Want to discover what's possible? Head over to
27+
our [Demo Lab](https://itextpdf.com/demos/convert-html-css-to-pdf-free-online)! It contains a collection of
28+
demo applications ready to use online!
1929

20-
Buying a license is mandatory as soon as you develop commercial activities
21-
distributing the iText software inside your product or deploying it on a network
22-
without disclosing the source code of your own applications under the AGPL license.
23-
These activities include:
30+
### Getting started
2431

25-
- offering paid services to customers as an ASP
26-
- serving PDFs on the fly in the cloud or in a web application
27-
- shipping iText with a closed source product
32+
The easiest way to get started is to use Maven, just add the following entries to your pom.xml file:
2833

29-
Contact [sales] for more info.
34+
```html
35+
36+
<properties>
37+
<html2pdf.version>REPLACE_WITH_DESIRED_VERSION</html2pdf.version>
38+
<pdfua.version>REPLACE_WITH_DESIRED_VERSION</pdfua.version>
39+
</properties>
40+
<dependencies>
41+
<dependency>
42+
<groupId>com.itextpdf</groupId>
43+
<artifactId>html2pdf</artifactId>
44+
<version>${html2pdf.version}</version>
45+
</dependency>
46+
<!-- optional dependency if you intend on creating PDF/UA documents -->
47+
<dependency>
48+
<groupId>com.itextpdf</groupId>
49+
<artifactId>pdfua</artifactId>
50+
<version>${pdfua.version}</version>
51+
</dependency>
52+
</dependencies>
53+
```
54+
55+
For more advanced use cases, please refer to
56+
the [Installation guidelines](https://kb.itextpdf.com/home/it7kb/installation-guidelines).
57+
You can also [build iText Community from source][building].
58+
59+
### Hello html2PDF!
60+
61+
The following code snippet shows how to convert HTML to PDF using the `HtmlConverter` class:
62+
63+
```java
64+
package com.itextpdf.hellohtml2pdf;
65+
66+
import com.itextpdf.html2pdf.HtmlConverter;
67+
import com.itextpdf.kernel.pdf.PdfWriter;
68+
69+
import java.io.FileInputStream;
70+
import java.io.IOException;
71+
72+
public class Html2PdfApp {
73+
74+
public static void main(String[] args) throws IOException {
75+
//Convert from String
76+
HtmlConverter.convertToPdf("<h1>Hello world</h1>", new PdfWriter("./out.pdf"));
77+
//Convert from File
78+
HtmlConverter.convertToPdf(new FileInputStream("./path-to-html-file.html"),
79+
new PdfWriter("./out2.pdf"));
80+
}
81+
}
82+
```
83+
84+
### Examples
85+
86+
| Description | Link |
87+
|-------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
88+
| Convert HTML to PDF/A-3B compliant document | [Java](https://github.com/itext/itext-publications-examples-java/blob/master/src/main/java/com/itextpdf/samples/sandbox/pdfhtml/HtmlToPdfA3Convert.java), [PDF](https://github.com/itext/itext-publications-examples-java/blob/master/cmpfiles/sandbox/pdfhtml/cmp_HtmlToPdfA3Convert.pdf) |
89+
| Convert HTML with custom QR code tags to PDF | [Java](https://github.com/itext/itext-publications-examples-java/blob/master/src/main/java/com/itextpdf/samples/sandbox/pdfhtml/ParseHtmlQRcode.java), [PDF](https://github.com/itext/itext-publications-examples-java/blob/master/cmpfiles/sandbox/pdfhtml/cmp_qrcode.pdf) |
90+
| Create accessible tagged PDF from HTML content | [Java](https://github.com/itext/itext-publications-examples-java/blob/master/src/main/java/com/itextpdf/samples/sandbox/pdfhtml/CreateAccessiblePDF.java), [PDF](https://github.com/itext/itext-publications-examples-java/blob/master/cmpfiles/sandbox/pdfhtml/cmp_Accessibility.pdf) |
91+
| Convert HTML to PDF simulating color blindness vision | [Java](https://github.com/itext/itext-publications-examples-java/blob/master/src/main/java/com/itextpdf/samples/sandbox/pdfhtml/ParseHtmlColorBlind.java), [PDF](https://github.com/itext/itext-publications-examples-java/blob/master/cmpfiles/sandbox/pdfhtml/cmp_rainbow_colourBlind.pdf) |
92+
| Register custom fonts for HTML to PDF | [Java](https://github.com/itext/itext-publications-examples-java/blob/master/src/main/java/com/itextpdf/samples/sandbox/pdfhtml/UsingCustomFonts.java) |
93+
| Convert HTML forms to tagged PDF with custom roles | [Java](https://github.com/itext/itext-publications-examples-java/blob/master/src/main/java/com/itextpdf/samples/sandbox/pdfhtml/PdfHtmlFormTagging.java), [PDF](https://github.com/itext/itext-publications-examples-java/blob/master/cmpfiles/sandbox/pdfhtml/cmp_changeFormRole.pdf) |
94+
| Convert HTML file with assets | [Java](https://github.com/itext/i7js-examples/blob/master/src/main/java/com/itextpdf/samples/sandbox/layout/ParagraphTextWithStyle.java), [PDF](https://github.com/itext/i7js-examples/blob/master/cmpfiles/sandbox/layout/cmp_paragraphTextWithStyle.pdf) |
95+
| Enable formfield interactivity | [Java](https://github.com/itext/i7js-examples/blob/master/src/main/java/com/itextpdf/samples/sandbox/layout/ParagraphTextWithStyle.java), [PDF](https://github.com/itext/i7js-examples/blob/master/cmpfiles/sandbox/layout/cmp_paragraphTextWithStyle.pdf) |
96+
| Convert HTML containing arabic and hebrew | [Java](https://kb.itextpdf.com/itext/how-to-convert-html-containing-arabic-hebrew-chara), [PDF](https://github.com/itext/i7js-examples/blob/master/cmpfiles/sandbox/layout/cmp_paragraphTextWithStyle.pdf) |
97+
98+
### FAQs, tutorials, etc. ###
99+
Check out the [iText Knowledge Base](https://kb.itextpdf.com) for the [iText Jump-start tutorial](https://kb.itextpdf.com/home/it7kb/ebooks/itext-jump-start-tutorial-for-java) and other tutorials, [FAQs](https://kb.itextpdf.com/home/it7kb/faq) and more.
100+
101+
Many common questions have already been answered
102+
on [Stack Overflow](https://stackoverflow.com/questions/tagged/itext+html2pdf), so make sure to also check there.
103+
104+
### Contributing
105+
106+
Many people have contributed to **iText Community** over the years. If you've found a bug, a mistake in documentation, or have a hot new feature you want to implement, we welcome your contributions.
107+
108+
Small changes or fixes can be submitted as a [Pull Request](https://github.com/itext/itext-pdfhtml-java/pulls), while for major changes we request you contact us at community@apryse.com so we can better coordinate our efforts and prevent duplication of work.
109+
110+
Please read our [Contribution Guidelines][contributing] for details on code submissions, coding rules, and more.
111+
112+
### Licensing
113+
114+
**html2Pdf** is dual licensed as [AGPL][agpl]/[Commercial software][sales].
115+
116+
AGPL is a free/open-source software license, however, this doesn't mean the software is [gratis][gratis]!
117+
118+
The AGPL is a copyleft license, which means that any derivative work must also be licensed under the same terms. If you’re using iText in software or a service which cannot comply with the AGPL terms, we have a commercial license available that exempts you from such obligations.
119+
120+
Contact [Sales] for more info.
30121

31122
[agpl]: LICENSE.md
123+
32124
[building]: BUILDING.md
33-
[contributing]: https://github.com/itext/itext7/blob/develop/CONTRIBUTING.md
34-
[itext]: http://itextpdf.com/
35-
[github]: https://github.com/itext/i7j-pdfhtml/
36-
[latest]: https://github.com/itext/i7j-pdfhtml/releases/latest
37-
[sales]: http://itextpdf.com/sales
125+
126+
[contributing]: CONTRIBUTING.md
127+
128+
[sales]: https://itextpdf.com/sales
129+
38130
[gratis]: https://en.wikipedia.org/wiki/Gratis_versus_libre
39-
[pdfHtml]: https://itextpdf.com/products/convert-html-css-to-pdf-pdfhtml

assets/iText_Logo_Small.png

9.56 KB
Loading

0 commit comments

Comments
 (0)