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.7.0+cfcc11b476b3e1eb4320f0f37269191f64e36bd8
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.
ProcessingExceptionFailed to add the invoice file. Possible reasons include an invalid XML format, or that the invoice type conflicts with the content of the XML file.
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