public class Converter extends NativeObject
Modifier and Type | Class | Description |
---|---|---|
class |
Converter.ConversionEvent |
The event for errors, warnings, and informational messages that occur during conversion
|
static interface |
Converter.ConversionEventListener |
Listener interface for the
Converter.ConversionEvent event. |
Constructor | Description |
---|---|
Converter() |
Modifier and Type | Method | Description |
---|---|---|
void |
addConversionEventListener(Converter.ConversionEventListener listener) |
Add a listener for the
Converter.ConversionEvent event. |
Document |
convert(AnalysisResult analysis,
Document document,
Stream outStream) |
Convert a document to PDF/A.
|
Document |
convert(AnalysisResult analysis,
Document document,
Stream outStream,
ConversionOptions options) |
Convert a document to PDF/A.
|
Document |
convert(AnalysisResult analysis,
Document document,
Stream outStream,
ConversionOptions options,
OutputOptions outOptions) |
Convert a document to PDF/A.
|
void |
removeConversionEventListener(Converter.ConversionEventListener listener) |
Remove registered listener for the
Converter.ConversionEvent event. |
equals, hashCode
public void addConversionEventListener(Converter.ConversionEventListener listener)
Converter.ConversionEvent
event.listener
- Listener for the Converter.ConversionEvent
event.
If a listener is added that is already registered, it is ignored.public void removeConversionEventListener(Converter.ConversionEventListener listener)
Converter.ConversionEvent
event.listener
- Listener for the Converter.ConversionEvent
event that should be removed.
If the listener is not registered, it is ignored.public Document convert(AnalysisResult analysis, Document document, Stream outStream) throws java.io.IOException, NotFoundException, GenericException, LicenseException, CorruptException, ConformanceException, UnsupportedFeatureException
Converter.ConversionEventListener
to detect critical conversion events.analysis
- The result of the document's analysis using pdftools.pdfa.validation.Validator.analyze
.document
- The document to convertoutStream
- The stream where the converted document is written toLicenseException
- The license check has failed.java.lang.IllegalArgumentException
- The outOptions
argument is invalid.java.lang.IllegalArgumentException
- The output stream could not be opened for writing.java.lang.IllegalStateException
- The document
has already been closed.java.lang.IllegalArgumentException
- The analysis
has already been closed, e.g. due to a previous conversion.java.lang.IllegalArgumentException
- The PDF/A version of the analysis and the conversion options do not match.java.lang.IllegalArgumentException
- The analysis
is not the analysis result of document
.java.io.IOException
- Error reading from or writing to the outStream
.ConformanceException
- The conformance required by options
cannot be achieved.
ConformanceException
- The PDF/A version of the conformances of analysis
and options
differ.
The same PDF/A version must be used for the analysis and conversion.java.lang.IllegalArgumentException
- The outOptions
specifies document encryption, which is not allowed in PDF/A documents.GenericException
- The document cannot be converted to PDF/A.CorruptException
- The analysis has been stopped.UnsupportedFeatureException
- The document is not a PDF, but an XFA document.
See pdftools.pdf.Document.getXfa
for more information on how to detect and handle XFA documents.NotFoundException
- A required font is missing from the installed font directories.java.lang.IllegalArgumentException
- if analysis
is null
java.lang.IllegalArgumentException
- if document
is null
java.lang.IllegalArgumentException
- if outStream
is null
public Document convert(AnalysisResult analysis, Document document, Stream outStream, ConversionOptions options) throws java.io.IOException, NotFoundException, GenericException, LicenseException, CorruptException, ConformanceException, UnsupportedFeatureException
Converter.ConversionEventListener
to detect critical conversion events.analysis
- The result of the document's analysis using pdftools.pdfa.validation.Validator.analyze
.document
- The document to convertoutStream
- The stream where the converted document is written tooptions
- The conversion optionsLicenseException
- The license check has failed.java.lang.IllegalArgumentException
- The outOptions
argument is invalid.java.lang.IllegalArgumentException
- The output stream could not be opened for writing.java.lang.IllegalStateException
- The document
has already been closed.java.lang.IllegalArgumentException
- The analysis
has already been closed, e.g. due to a previous conversion.java.lang.IllegalArgumentException
- The PDF/A version of the analysis and the conversion options do not match.java.lang.IllegalArgumentException
- The analysis
is not the analysis result of document
.java.io.IOException
- Error reading from or writing to the outStream
.ConformanceException
- The conformance required by options
cannot be achieved.
ConformanceException
- The PDF/A version of the conformances of analysis
and options
differ.
The same PDF/A version must be used for the analysis and conversion.java.lang.IllegalArgumentException
- The outOptions
specifies document encryption, which is not allowed in PDF/A documents.GenericException
- The document cannot be converted to PDF/A.CorruptException
- The analysis has been stopped.UnsupportedFeatureException
- The document is not a PDF, but an XFA document.
See pdftools.pdf.Document.getXfa
for more information on how to detect and handle XFA documents.NotFoundException
- A required font is missing from the installed font directories.java.lang.IllegalArgumentException
- if analysis
is null
java.lang.IllegalArgumentException
- if document
is null
java.lang.IllegalArgumentException
- if outStream
is null
public Document convert(AnalysisResult analysis, Document document, Stream outStream, ConversionOptions options, OutputOptions outOptions) throws java.io.IOException, NotFoundException, GenericException, LicenseException, CorruptException, ConformanceException, UnsupportedFeatureException
Converter.ConversionEventListener
to detect critical conversion events.analysis
- The result of the document's analysis using pdftools.pdfa.validation.Validator.analyze
.document
- The document to convertoutStream
- The stream where the converted document is written tooptions
- The conversion optionsoutOptions
- The output options objectLicenseException
- The license check has failed.java.lang.IllegalArgumentException
- The outOptions
argument is invalid.java.lang.IllegalArgumentException
- The output stream could not be opened for writing.java.lang.IllegalStateException
- The document
has already been closed.java.lang.IllegalArgumentException
- The analysis
has already been closed, e.g. due to a previous conversion.java.lang.IllegalArgumentException
- The PDF/A version of the analysis and the conversion options do not match.java.lang.IllegalArgumentException
- The analysis
is not the analysis result of document
.java.io.IOException
- Error reading from or writing to the outStream
.ConformanceException
- The conformance required by options
cannot be achieved.
ConformanceException
- The PDF/A version of the conformances of analysis
and options
differ.
The same PDF/A version must be used for the analysis and conversion.java.lang.IllegalArgumentException
- The outOptions
specifies document encryption, which is not allowed in PDF/A documents.GenericException
- The document cannot be converted to PDF/A.CorruptException
- The analysis has been stopped.UnsupportedFeatureException
- The document is not a PDF, but an XFA document.
See pdftools.pdf.Document.getXfa
for more information on how to detect and handle XFA documents.NotFoundException
- A required font is missing from the installed font directories.java.lang.IllegalArgumentException
- if analysis
is null
java.lang.IllegalArgumentException
- if document
is null
java.lang.IllegalArgumentException
- if outStream
is null