Skip to content

Commit ff2abae

Browse files
committed
[RELEASE] iText pdfHtml 6.3.2
2 parents d0aa178 + 13d1a77 commit ff2abae

File tree

4,332 files changed

+5621
-5964
lines changed

Some content is hidden

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

4,332 files changed

+5621
-5964
lines changed

.github/workflows/createpr.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: CreatePR
2+
3+
on:
4+
create:
5+
6+
jobs:
7+
call-createpr:
8+
uses: XodoDocs/itext-github-workflows/.github/workflows/createpr.yml@master
9+
secrets: inherit

.github/workflows/createrebase.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: "Create rebased branch"
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- develop
7+
types:
8+
- assigned
9+
- synchronize
10+
11+
jobs:
12+
call-createrebase:
13+
uses: XodoDocs/itext-github-workflows/.github/workflows/createrebase.yml@master
14+
secrets: inherit

.github/workflows/licensecheck.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: LicenseCheck
2+
3+
on:
4+
push:
5+
# 'branches-ignore' or 'branches' can be used to filter specific branches.
6+
# By default, without any filters, it runs on every push to all branches.
7+
# To be explicit, you can use:
8+
branches-ignore:
9+
- 'develop'
10+
- 'master'
11+
- 'rebased/*'
12+
13+
jobs:
14+
call-licensecheck:
15+
uses: XodoDocs/itext-github-workflows/.github/workflows/licensecheck.yml@master
16+
secrets: inherit

pom.xml

Lines changed: 9 additions & 2 deletions
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>9.5.0</version>
8+
<version>9.6.0</version>
99
<relativePath />
1010
</parent>
1111

1212
<artifactId>html2pdf</artifactId>
13-
<version>6.3.1</version>
13+
<version>6.3.2</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
@@ -192,6 +192,13 @@
192192
--initialize-at-build-time=org.junit.validator.PublicClassValidator
193193
--initialize-at-build-time=org.junit.platform.engine.TestTag
194194

195+
--initialize-at-build-time=org.junit.jupiter.engine
196+
--initialize-at-build-time=org.junit.platform.launcher
197+
--initialize-at-build-time=org.junit.jupiter.engine.extension.TimeoutExtension
198+
--initialize-at-build-time=org.junit.jupiter.engine.extension.RepeatedTestExtension
199+
--initialize-at-build-time=org.junit.platform.commons.util.LruCache
200+
--initialize-at-build-time=org.junit.jupiter.api.extension.ExtensionContext$Namespace
201+
195202
--enable-url-protocols=http,https,ftp
196203

197204
-H:+AddAllCharsets

src/main/java/com/itextpdf/html2pdf/ConverterProperties.java

Lines changed: 84 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
This file is part of the iText (R) project.
3-
Copyright (c) 1998-2025 Apryse Group NV
3+
Copyright (c) 1998-2026 Apryse Group NV
44
Authors: Apryse Software.
55
66
This program is offered under a commercial and under the AGPL license.
@@ -27,17 +27,21 @@ This file is part of the iText (R) project.
2727
import com.itextpdf.html2pdf.attach.impl.OutlineHandler;
2828
import com.itextpdf.html2pdf.attach.util.AlternateDescriptionResolver;
2929
import com.itextpdf.html2pdf.css.apply.ICssApplierFactory;
30+
import com.itextpdf.kernel.exceptions.KernelExceptionMessageConstant;
3031
import com.itextpdf.kernel.pdf.PdfAConformance;
3132
import com.itextpdf.kernel.pdf.PdfConformance;
3233
import com.itextpdf.kernel.pdf.PdfOutputIntent;
3334
import com.itextpdf.kernel.pdf.PdfUAConformance;
35+
import com.itextpdf.kernel.pdf.WellTaggedPdfConformance;
3436
import com.itextpdf.layout.font.FontProvider;
3537
import com.itextpdf.styledxmlparser.css.media.MediaDeviceDescription;
3638
import com.itextpdf.styledxmlparser.resolver.resource.IResourceRetriever;
3739

3840
import java.io.InputStream;
3941
import java.util.HashMap;
4042
import java.util.Map;
43+
import java.util.Set;
44+
import java.util.function.Supplier;
4145

4246
/**
4347
* Properties that will be used by the {@link com.itextpdf.html2pdf.HtmlConverter}.
@@ -49,7 +53,7 @@ public class ConverterProperties {
4953
*/
5054
private static final int DEFAULT_LIMIT_OF_LAYOUTS = 10;
5155

52-
private final HashMap<Class<?>, Object> dependencies = new HashMap<>();
56+
private final Map<Class<?>, Supplier<Object>> dependencies = new HashMap<>();
5357

5458
/**
5559
* The media device description.
@@ -130,7 +134,7 @@ public class ConverterProperties {
130134
* Instantiates a new {@link ConverterProperties} instance.
131135
*/
132136
public ConverterProperties() {
133-
this.dependencies.put(AlternateDescriptionResolver.class, new AlternateDescriptionResolver());
137+
this.dependencies.put(AlternateDescriptionResolver.class, () -> new AlternateDescriptionResolver());
134138
}
135139

136140
/**
@@ -155,9 +159,7 @@ public ConverterProperties(ConverterProperties other) {
155159
this.continuousContainerEnabled = other.continuousContainerEnabled;
156160
this.conformance = other.conformance;
157161
this.outputIntent = other.outputIntent;
158-
for (Class<?> aClass : other.dependencies.keySet()) {
159-
this.dependencies.put(aClass, other.dependencies.get(aClass));
160-
}
162+
this.dependencies.putAll(other.dependencies);
161163
}
162164

163165
/**
@@ -486,13 +488,40 @@ public PdfUAConformance getPdfUaConformance() {
486488
* Required parameter, when converting to PDF/UA one has to specify an explicit PDF/UA conformance.
487489
*
488490
* @param uaConformance a {@link PdfUAConformance} constant
491+
*
489492
* @return the {@link ConverterProperties} instance
490493
*/
491494
public ConverterProperties setPdfUAConformance(PdfUAConformance uaConformance) {
492495
this.conformance = new PdfConformance(conformance.getAConformance(), uaConformance);
493496
return this;
494497
}
495498

499+
/**
500+
* Sets the generation and strictness level of the WTPDF that must be followed.
501+
* Required parameter, when converting to WTPDF one has to specify an explicit WTPDF conformance.
502+
* <p>
503+
* For pdfHtml currently we only support 1 WTPDF conformance level.
504+
*
505+
* @param wtPdfConformance a {@link WellTaggedPdfConformance} constant
506+
*
507+
* @return the {@link ConverterProperties} instance
508+
*/
509+
public ConverterProperties setWtPdfConformance(WellTaggedPdfConformance wtPdfConformance) {
510+
this.conformance = new PdfConformance(conformance.getAConformance(), conformance.getUAConformance(),
511+
wtPdfConformance);
512+
return this;
513+
}
514+
515+
/**
516+
* Gets the generation and strictness level of the conformance that must be followed.
517+
*
518+
* @return The conformance level
519+
*/
520+
public PdfConformance getPdfConformance() {
521+
return conformance;
522+
}
523+
524+
496525
/**
497526
* Checks if immediateFlush is set.
498527
* <p>
@@ -571,8 +600,56 @@ public ConverterProperties setContinuousContainerEnabled(boolean value) {
571600
* Gets the dependencies.
572601
*
573602
* @return the dependencies
603+
*
604+
* @deprecated in favor of {@link ConverterProperties#getDependenciesClasses()},
605+
* {@link ConverterProperties#getDependencySupplier(Class)}
574606
*/
607+
@Deprecated
575608
public Map<Class<?>, Object> getDependencies() {
576-
return dependencies;
609+
Map<Class<?>, Object> currentInstances = new HashMap<>();
610+
for (Map.Entry<Class<?>, Supplier<Object>> entry : dependencies.entrySet()) {
611+
currentInstances.put(entry.getKey(), entry.getValue().get());
612+
}
613+
return currentInstances;
614+
}
615+
616+
/**
617+
* Register custom dependency for the document.
618+
*
619+
* @param clazz type of the dependency
620+
* @param instanceSupplier the instance of the supplier for the dependency
621+
*
622+
* @return this {@link ConverterProperties} instance
623+
*/
624+
public ConverterProperties registerDependency(Class<?> clazz, Supplier<Object> instanceSupplier) {
625+
if (clazz == null) {
626+
throw new IllegalArgumentException(KernelExceptionMessageConstant.TYPE_SHOULD_NOT_BE_NULL);
627+
}
628+
if (instanceSupplier == null) {
629+
throw new IllegalArgumentException(KernelExceptionMessageConstant.INSTANCE_SUPPLIER_SHOULD_NOT_BE_NULL);
630+
}
631+
dependencies.put(clazz, instanceSupplier);
632+
return this;
633+
}
634+
635+
/**
636+
* Get all dependencies classes.
637+
*
638+
* @return the set of dependencies classes
639+
*/
640+
public Set<Class<?>> getDependenciesClasses() {
641+
return dependencies.keySet();
642+
}
643+
644+
/**
645+
* Get specific dependency supplier.
646+
*
647+
* @param clazz the dependency class to return supplier for
648+
*
649+
* @return supplier for the dependency.
650+
* May return {code null} if no dependency supplier is present for specified class.
651+
*/
652+
public Supplier<Object> getDependencySupplier(Class<?> clazz) {
653+
return dependencies.get(clazz);
577654
}
578655
}

0 commit comments

Comments
 (0)