Click or drag to resize
Pdftools logo

ConverterConvert Method

Convert a document to PDF/A.

Note that it is highly recommended to use ConversionEvent to detect critical conversion events.

Namespace: PdfTools.PdfA.Conversion
Assembly: PdfTools (in PdfTools.dll) Version: 1.4.0+fc8bb87ea2616e7f35d94e0588d333abae862a7a
Syntax
C#
public Document Convert(
	AnalysisResult analysis,
	Document document,
	Stream outStream,
	ConversionOptions options = null,
	OutputOptions outOptions = null
)

Parameters

analysis  AnalysisResult
The result of the document's analysis using Analyze(Document, AnalysisOptions).
document  Document
The document to convert
outStream  Stream
The stream where the converted document is written
options  ConversionOptions  (Optional)
The conversion options
outOptions  OutputOptions  (Optional)
The output options object

Return Value

Document
The result of the conversion
Exceptions
ExceptionCondition
LicenseExceptionThe license check has failed.
ArgumentExceptionThe outOptions argument is invalid.
ArgumentExceptionThe output stream could not be opened for writing.
InvalidOperationExceptionThe document has already been closed.
ArgumentExceptionThe analysis has already been closed, e.g. due to a previous conversion.
ArgumentExceptionThe PDF/A version of the analysis and the conversion options do not match.
ArgumentExceptionThe analysis is not the analysis result of document.
IOExceptionError reading from or writing to the outStream.
ConformanceExceptionThe conformance required by options cannot be achieved.
  • PDF/A level U: All text of the input document must be extractable.
  • PDF/A level A: In addition to the requirements of level U, the input document must be tagged.
ConformanceExceptionThe PDF/A version of the conformances of analysis and options differ. The same PDF/A version must be used for the analysis and conversion.
ArgumentExceptionThe outOptions specifies document encryption, which is not allowed in PDF/A documents.
GenericExceptionThe document cannot be converted to PDF/A.
CorruptExceptionThe analysis has been stopped.
UnsupportedFeatureExceptionThe document is not a PDF, but an XFA document. See Xfa for more information on how to detect and handle XFA documents.
NotFoundExceptionA required font is missing from the installed font directories.
ArgumentNullExceptionif analysis is .
ArgumentNullExceptionif document is .
ArgumentNullExceptionif outStream is .
See Also