Skip to content

Commit eeafe31

Browse files
committed
Provide high level api for PDF/UA document generation
DEVSIX-8478
1 parent 021f107 commit eeafe31

File tree

72 files changed

+433
-417
lines changed

Some content is hidden

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

72 files changed

+433
-417
lines changed

pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@
6262
<groupId>com.itextpdf</groupId>
6363
<artifactId>pdfua</artifactId>
6464
<version>${itext.version}</version>
65-
<scope>test</scope>
6665
</dependency>
6766
</dependencies>
6867

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

Lines changed: 43 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ This file is part of the iText (R) project.
2828
import com.itextpdf.html2pdf.attach.util.AlternateDescriptionResolver;
2929
import com.itextpdf.html2pdf.css.apply.ICssApplierFactory;
3030
import com.itextpdf.kernel.pdf.PdfAConformance;
31+
import com.itextpdf.kernel.pdf.PdfConformance;
3132
import com.itextpdf.kernel.pdf.PdfOutputIntent;
33+
import com.itextpdf.kernel.pdf.PdfUAConformance;
3234
import com.itextpdf.layout.font.FontProvider;
3335
import com.itextpdf.styledxmlparser.css.media.MediaDeviceDescription;
3436
import com.itextpdf.styledxmlparser.resolver.resource.IResourceRetriever;
@@ -122,7 +124,7 @@ public class ConverterProperties {
122124
/**
123125
* Conformance for conversion to pdf/a.
124126
*/
125-
private PdfAConformance aConformance;
127+
private PdfConformance conformance = new PdfConformance();
126128

127129
/**
128130
* Instantiates a new {@link ConverterProperties} instance.
@@ -151,7 +153,8 @@ public ConverterProperties(ConverterProperties other) {
151153
this.limitOfLayouts = other.limitOfLayouts;
152154
this.immediateFlush = other.immediateFlush;
153155
this.continuousContainerEnabled = other.continuousContainerEnabled;
154-
156+
this.conformance = other.conformance;
157+
this.outputIntent = other.outputIntent;
155158
for (Class<?> aClass : other.dependencies.keySet()) {
156159
this.dependencies.put(aClass, other.dependencies.get(aClass));
157160
}
@@ -354,7 +357,6 @@ public boolean isCreateAcroForm() {
354357
* When enabling this acroform creation, it will disable the immediateFlushing property.
355358
*
356359
* @param createAcroForm true if an AcroForm needs to be created
357-
*
358360
* @return the {@link ConverterProperties} instance
359361
*/
360362
public ConverterProperties setCreateAcroForm(boolean createAcroForm) {
@@ -420,16 +422,28 @@ public ConverterProperties setCharset(String charset) {
420422
return this;
421423
}
422424

425+
/**
426+
* Gets pdf document output intent (final destination device) to reproduce the color in the PDF.
427+
*
428+
* <p>
429+
* Note, output intent isn't applicable for HtmlConverter#convertToElements methods
430+
* (e.g. {@link HtmlConverter#convertToElements(InputStream, ConverterProperties)})
431+
*
432+
* @return pdf output intent
433+
*/
434+
public PdfOutputIntent getDocumentOutputIntent() {
435+
return outputIntent;
436+
}
437+
423438
/**
424439
* Sets pdf document output intent (final destination device) to reproduce the color in the PDF.
425-
* Required parameter, when converting to pdf/a one have to specify an explicit output intent.
440+
* Required parameter, when converting to pdf/a one has to specify an explicit output intent.
426441
*
427442
* <p>
428443
* Note, output intent isn't applicable for HtmlConverter#convertToElements methods
429444
* (e.g. {@link HtmlConverter#convertToElements(InputStream, ConverterProperties)})
430445
*
431446
* @param outputIntent a {@link PdfOutputIntent} instance
432-
*
433447
* @return the {@link ConverterProperties} instance
434448
*/
435449
public ConverterProperties setDocumentOutputIntent(PdfOutputIntent outputIntent) {
@@ -438,38 +452,45 @@ public ConverterProperties setDocumentOutputIntent(PdfOutputIntent outputIntent)
438452
}
439453

440454
/**
441-
* Sets the generation and strictness level of the PDF/A that must be followed.
442-
* Required parameter, when converting to pdf/a one have to specify an explicit pdf/a conformance.
455+
* Gets the generation and strictness level of the PDF/A that must be followed.
443456
*
444-
* @param conformance a {@link PdfAConformance} constant
457+
* @return pdf/a conformance
458+
*/
459+
public PdfAConformance getPdfAConformance() {
460+
return conformance.getAConformance();
461+
}
462+
463+
/**
464+
* Sets the generation and strictness level of the PDF/A that must be followed.
465+
* Required parameter, when converting to pdf/a one has to specify an explicit pdf/a conformance.
445466
*
467+
* @param aConformance a {@link PdfAConformance} constant
446468
* @return the {@link ConverterProperties} instance
447469
*/
448-
public ConverterProperties setPdfAConformance(PdfAConformance conformance) {
449-
this.aConformance = conformance;
470+
public ConverterProperties setPdfAConformance(PdfAConformance aConformance) {
471+
this.conformance = new PdfConformance(aConformance, conformance.getUAConformance());
450472
return this;
451473
}
452474

453475
/**
454-
* Gets pdf document output intent (final destination device) to reproduce the color in the PDF.
476+
* Gets the generation and strictness level of the PDF/UA that must be followed.
455477
*
456-
* <p>
457-
* Note, output intent isn't applicable for HtmlConverter#convertToElements methods
458-
* (e.g. {@link HtmlConverter#convertToElements(InputStream, ConverterProperties)})
459-
*
460-
* @return pdf output intent
478+
* @return The PDF/UA conformance level.
461479
*/
462-
public PdfOutputIntent getDocumentOutputIntent() {
463-
return outputIntent;
480+
public PdfUAConformance getPdfUaConformance() {
481+
return conformance.getUAConformance();
464482
}
465483

466484
/**
467-
* Gets the generation and strictness level of the PDF/A that must be followed.
485+
* Sets the generation and strictness level of the PDF/UA that must be followed.
486+
* Required parameter, when converting to PDF/UA one has to specify an explicit PDF/UA conformance.
468487
*
469-
* @return pdf/a conformance
488+
* @param uaConformance a {@link PdfUAConformance} constant
489+
* @return the {@link ConverterProperties} instance
470490
*/
471-
public PdfAConformance getPdfAConformance() {
472-
return aConformance;
491+
public ConverterProperties setPdfUAConformance(PdfUAConformance uaConformance) {
492+
this.conformance = new PdfConformance(conformance.getAConformance(), uaConformance);
493+
return this;
473494
}
474495

475496
/**

0 commit comments

Comments
 (0)