Skip to content

Commit f913add

Browse files
committed
[RELEASE] iText pdfHtml 6.0.0
2 parents 913de2b + a850e51 commit f913add

File tree

283 files changed

+691
-565
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

283 files changed

+691
-565
lines changed

Diff for: SECURITY.md

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# iText Security Policy
2+
3+
## Reporting a Vulnerability
4+
5+
We are committed to maintaining the security of our software. If you discover a security vulnerability, we encourage you to report it to us as soon as possible.
6+
7+
To report a vulnerability, please visit our [Vulnerability Reporting Page](https://itextpdf.com/report-vulnerability), or email [[email protected]]([email protected]). If you do not receive a response in 2 business days, please follow up as we may not have received your message.
8+
9+
We follow the procedure of Coordinated Vulnerability Disclosure (CVD) and, to protect the ecosystem, we request that those reporting do the same. Please visit the above page for more information, and follow the steps below to ensure that your report is handled promptly and appropriately:
10+
11+
1. **Do not disclose the vulnerability publicly** until we have had a chance to address it.
12+
2. **Provide a detailed description** of the vulnerability, including steps to reproduce it, if possible.
13+
3. **Include any relevant information** such as the version of pdfHTML you are using, your operating system, and any other pertinent details.
14+
15+
## Security Updates and Patches
16+
17+
When a vulnerability is reported, we will:
18+
19+
1. **Investigate and verify** the vulnerability.
20+
2. **Develop and test** a fix for the vulnerability.
21+
3. **Release a patch** as soon as possible.
22+
23+
## Known Vulnerabilities
24+
25+
The iText Knowledge Base has a page for known [Common Vulnerabilities and Exposures](https://kb.itextpdf.com/itext/cves) (CVEs), please check it to ensure your vulnerability has not already been disclosed or addressed.
26+
27+
## Supported product lines
28+
29+
See [Compatibility Matrix](https://kb.itextpdf.com/itext/compatibility-matrix)
30+
31+
32+
## Security Best Practices
33+
34+
To help ensure the security of your applications using pdfHTML, we recommend the following best practices:
35+
36+
1. **Keep pdfHTML up to date** by regularly checking for and applying updates.
37+
2. **Review and follow** our security guidelines for secure usage.
38+
3. **Monitor your applications** for any unusual activity and investigate any anomalies promptly.
39+
40+
Thank you for helping us keep iText secure!

Diff for: pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
<parent>
66
<groupId>com.itextpdf</groupId>
77
<artifactId>root</artifactId>
8-
<version>8.0.5</version>
8+
<version>9.0.0</version>
99
<relativePath />
1010
</parent>
1111

1212
<artifactId>html2pdf</artifactId>
13-
<version>5.0.5</version>
13+
<version>6.0.0</version>
1414

1515
<name>pdfHTML</name>
1616
<description>pdfHTML is an iText add-on that lets you to parse (X)HTML snippets and the associated CSS and converts

Diff for: src/main/java/com/itextpdf/html2pdf/ConverterProperties.java

+10-10
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ This file is part of the iText (R) project.
2626
import com.itextpdf.html2pdf.attach.ITagWorkerFactory;
2727
import com.itextpdf.html2pdf.attach.impl.OutlineHandler;
2828
import com.itextpdf.html2pdf.css.apply.ICssApplierFactory;
29-
import com.itextpdf.kernel.pdf.PdfAConformanceLevel;
29+
import com.itextpdf.kernel.pdf.PdfAConformance;
3030
import com.itextpdf.kernel.pdf.PdfOutputIntent;
3131
import com.itextpdf.layout.font.FontProvider;
3232
import com.itextpdf.styledxmlparser.css.media.MediaDeviceDescription;
@@ -115,9 +115,9 @@ public class ConverterProperties {
115115
private PdfOutputIntent outputIntent;
116116

117117
/**
118-
* Conformance level for conversion to pdf/a.
118+
* Conformance for conversion to pdf/a.
119119
*/
120-
private PdfAConformanceLevel conformanceLevel;
120+
private PdfAConformance aConformance;
121121

122122
/**
123123
* Instantiates a new {@link ConverterProperties} instance.
@@ -429,14 +429,14 @@ public ConverterProperties setDocumentOutputIntent(PdfOutputIntent outputIntent)
429429

430430
/**
431431
* Sets the generation and strictness level of the PDF/A that must be followed.
432-
* Required parameter, when converting to pdf/a one have to specify an explicit pdf/a conformance level.
432+
* Required parameter, when converting to pdf/a one have to specify an explicit pdf/a conformance.
433433
*
434-
* @param conformanceLevel a {@link PdfAConformanceLevel} constant
434+
* @param conformance a {@link PdfAConformance} constant
435435
*
436436
* @return the {@link ConverterProperties} instance
437437
*/
438-
public ConverterProperties setPdfAConformanceLevel(PdfAConformanceLevel conformanceLevel) {
439-
this.conformanceLevel = conformanceLevel;
438+
public ConverterProperties setPdfAConformance(PdfAConformance conformance) {
439+
this.aConformance = conformance;
440440
return this;
441441
}
442442

@@ -456,10 +456,10 @@ public PdfOutputIntent getDocumentOutputIntent() {
456456
/**
457457
* Gets the generation and strictness level of the PDF/A that must be followed.
458458
*
459-
* @return pdf/a conformance level
459+
* @return pdf/a conformance
460460
*/
461-
public PdfAConformanceLevel getConformanceLevel() {
462-
return conformanceLevel;
461+
public PdfAConformance getPdfAConformance() {
462+
return aConformance;
463463
}
464464

465465
/**

Diff for: src/main/java/com/itextpdf/html2pdf/HtmlConverter.java

+7-23
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,8 @@ This file is part of the iText (R) project.
2828
import com.itextpdf.html2pdf.exceptions.Html2PdfException;
2929
import com.itextpdf.html2pdf.resolver.font.DefaultFontProvider;
3030
import com.itextpdf.kernel.pdf.DocumentProperties;
31-
import com.itextpdf.kernel.pdf.PdfAConformanceLevel;
3231
import com.itextpdf.kernel.pdf.PdfDocument;
33-
import com.itextpdf.kernel.pdf.PdfVersion;
3432
import com.itextpdf.kernel.pdf.PdfWriter;
35-
import com.itextpdf.kernel.pdf.WriterProperties;
3633
import com.itextpdf.layout.Document;
3734
import com.itextpdf.layout.element.IElement;
3835
import com.itextpdf.layout.properties.Property;
@@ -48,8 +45,6 @@ This file is part of the iText (R) project.
4845
import java.io.IOException;
4946
import java.io.InputStream;
5047
import java.io.OutputStream;
51-
import java.util.ArrayList;
52-
import java.util.Arrays;
5348
import java.util.List;
5449

5550
/**
@@ -61,9 +56,6 @@ This file is part of the iText (R) project.
6156
* {@link PdfDocument} instance.
6257
*/
6358
public class HtmlConverter {
64-
65-
private static final List<PdfAConformanceLevel> pdf2ConformanceLevels = new ArrayList<>(Arrays. asList(PdfAConformanceLevel.PDF_A_4, PdfAConformanceLevel.PDF_A_4E, PdfAConformanceLevel.PDF_A_4F));
66-
6759
/**
6860
* Instantiates a new HtmlConverter instance.
6961
*/
@@ -90,10 +82,6 @@ public static void convertToPdf(String html, OutputStream pdfStream) {
9082
* @param converterProperties a {@link ConverterProperties} instance
9183
*/
9284
public static void convertToPdf(String html, OutputStream pdfStream, ConverterProperties converterProperties) {
93-
if (converterProperties != null && pdf2ConformanceLevels.contains(converterProperties.getConformanceLevel())) {
94-
convertToPdf(html, new PdfWriter(pdfStream, new WriterProperties().setPdfVersion(PdfVersion.PDF_2_0)), converterProperties);
95-
return;
96-
}
9785
convertToPdf(html, new PdfWriter(pdfStream), converterProperties);
9886
}
9987

@@ -117,16 +105,16 @@ public static void convertToPdf(String html, PdfWriter pdfWriter) {
117105
* @param converterProperties a {@link ConverterProperties} instance
118106
*/
119107
public static void convertToPdf(String html, PdfWriter pdfWriter, ConverterProperties converterProperties) {
120-
if (converterProperties == null || converterProperties.getConformanceLevel() == null) {
108+
if (converterProperties == null || converterProperties.getPdfAConformance() == null) {
121109
convertToPdf(html, new PdfDocument(pdfWriter, new DocumentProperties()
122110
.setEventCountingMetaInfo(resolveMetaInfo(converterProperties))), converterProperties);
123111
return;
124112
}
125-
PdfDocument document = new PdfADocument(pdfWriter, converterProperties.getConformanceLevel(),
113+
PdfDocument document = new PdfADocument(pdfWriter, converterProperties.getPdfAConformance(),
126114
converterProperties.getDocumentOutputIntent(), new DocumentProperties()
127115
.setEventCountingMetaInfo(resolveMetaInfo(converterProperties)));
128116
converterProperties = setDefaultFontProviderForPdfA(document, converterProperties);
129-
if ("A".equals(converterProperties.getConformanceLevel().getConformance())) {
117+
if ("A".equals(converterProperties.getPdfAConformance().getLevel())) {
130118
document.setTagged();
131119
}
132120
convertToPdf(html, document, converterProperties);
@@ -202,10 +190,6 @@ public static void convertToPdf(InputStream htmlStream, OutputStream pdfStream)
202190
* @throws IOException Signals that an I/O exception has occurred.
203191
*/
204192
public static void convertToPdf(InputStream htmlStream, OutputStream pdfStream, ConverterProperties converterProperties) throws IOException {
205-
if (converterProperties != null && pdf2ConformanceLevels.contains(converterProperties.getConformanceLevel())) {
206-
convertToPdf(htmlStream, new PdfWriter(pdfStream, new WriterProperties().setPdfVersion(PdfVersion.PDF_2_0)), converterProperties);
207-
return;
208-
}
209193
convertToPdf(htmlStream, new PdfWriter(pdfStream), converterProperties);
210194
}
211195

@@ -245,16 +229,16 @@ public static void convertToPdf(InputStream htmlStream, PdfWriter pdfWriter) thr
245229
* @throws IOException Signals that an I/O exception has occurred.
246230
*/
247231
public static void convertToPdf(InputStream htmlStream, PdfWriter pdfWriter, ConverterProperties converterProperties) throws IOException {
248-
if (converterProperties == null || converterProperties.getConformanceLevel() == null) {
232+
if (converterProperties == null || converterProperties.getPdfAConformance() == null) {
249233
convertToPdf(htmlStream, new PdfDocument(pdfWriter, new DocumentProperties().setEventCountingMetaInfo(
250234
resolveMetaInfo(converterProperties))), converterProperties);
251235
return;
252236
}
253-
PdfDocument document = new PdfADocument(pdfWriter, converterProperties.getConformanceLevel(),
237+
PdfDocument document = new PdfADocument(pdfWriter, converterProperties.getPdfAConformance(),
254238
converterProperties.getDocumentOutputIntent(), new DocumentProperties()
255239
.setEventCountingMetaInfo(resolveMetaInfo(converterProperties)));
256240
converterProperties = setDefaultFontProviderForPdfA(document, converterProperties);
257-
if ("A".equals(converterProperties.getConformanceLevel().getConformance())) {
241+
if ("A".equals(converterProperties.getPdfAConformance().getLevel())) {
258242
document.setTagged();
259243
}
260244
convertToPdf(htmlStream, document, converterProperties);
@@ -446,7 +430,7 @@ private static ConverterProperties setDefaultFontProviderForPdfA(PdfDocument doc
446430
if (properties.getFontProvider() == null) {
447431
properties.setFontProvider(new DefaultFontProvider(false, true, false));
448432
}
449-
} else if (document == null && properties != null && properties.getConformanceLevel() != null) {
433+
} else if (document == null && properties != null && properties.getPdfAConformance() != null) {
450434
if (properties.getFontProvider() == null) {
451435
properties.setFontProvider(new DefaultFontProvider(false, true, false));
452436
}

Diff for: src/main/java/com/itextpdf/html2pdf/actions/data/PdfHtmlProductData.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ This file is part of the iText (R) project.
3030
*/
3131
public final class PdfHtmlProductData {
3232
private static final String PDF_HTML_PUBLIC_PRODUCT_NAME = "pdfHTML";
33-
private static final String PDF_HTML_VERSION = "5.0.5";
33+
private static final String PDF_HTML_VERSION = "6.0.0";
3434
private static final int PDF_HTML_COPYRIGHT_SINCE = 2000;
3535
private static final int PDF_HTML_COPYRIGHT_TO = 2024;
3636

Diff for: src/main/java/com/itextpdf/html2pdf/attach/ProcessorContext.java

+8-9
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ This file is part of the iText (R) project.
3636
import com.itextpdf.html2pdf.resolver.form.RadioCheckResolver;
3737
import com.itextpdf.html2pdf.resolver.resource.HtmlResourceResolver;
3838
import com.itextpdf.io.font.FontProgram;
39-
import com.itextpdf.kernel.pdf.IConformanceLevel;
40-
import com.itextpdf.kernel.pdf.PdfAConformanceLevel;
39+
import com.itextpdf.kernel.pdf.PdfConformance;
4140
import com.itextpdf.kernel.pdf.PdfDocument;
4241
import com.itextpdf.layout.font.FontInfo;
4342
import com.itextpdf.layout.font.FontProvider;
@@ -134,9 +133,9 @@ public class ProcessorContext {
134133
private PdfDocument pdfDocument;
135134

136135
/**
137-
* PDF/A conformance level from {@link ConverterProperties} instance.
136+
* PDF/A conformance from {@link ConverterProperties} instance.
138137
*/
139-
private final PdfAConformanceLevel pdfAConformanceLevelFromProperties;
138+
private final PdfConformance pdfAConformanceFromProperties;
140139

141140
/**
142141
* The Processor meta info
@@ -206,7 +205,7 @@ public ProcessorContext(ConverterProperties converterProperties) {
206205
formFieldNameResolver = new FormFieldNameResolver();
207206
radioCheckResolver = new RadioCheckResolver();
208207
immediateFlush = converterProperties.isImmediateFlush();
209-
pdfAConformanceLevelFromProperties = converterProperties.getConformanceLevel();
208+
pdfAConformanceFromProperties = new PdfConformance(converterProperties.getPdfAConformance());
210209
processingInlineSvg = false;
211210
continuousContainerEnabled = converterProperties.isContinuousContainerEnabled();
212211
}
@@ -248,12 +247,12 @@ public PdfDocument getPdfDocument() {
248247
}
249248

250249
/**
251-
* Get the PDF document conformance level if specified.
250+
* Get the PDF document conformance.
252251
*
253-
* @return the {@link PdfAConformanceLevel} will be null if the processing result won't follow PDF/A strictness
252+
* @return the {@link PdfConformance}
254253
*/
255-
public IConformanceLevel getConformanceLevel() {
256-
return pdfDocument == null ? pdfAConformanceLevelFromProperties : pdfDocument.getConformanceLevel();
254+
public PdfConformance getConformance() {
255+
return pdfDocument == null ? pdfAConformanceFromProperties : pdfDocument.getConformance();
257256
}
258257

259258
/**

0 commit comments

Comments
 (0)