Skip to content
DemoSampleAPI ReferenceFAQ

PDF Generation Template Editor

Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.

View on GitHub

Status and Diagnostics ​

GetStatus() returns the status of the last operation (conversion, HTML export or PDF output). A value greater than or equal to 0 means success, and a negative value means failure. IsSuccess() returns true when the result is valid and the status is greater than or equal to 0.

Status (CEmailStatus)Description
EMAIL_SUCCESSSuccess
EMAIL_SUCCESS_WITH_WARNINGSSuccess with degradation or recovery; see the diagnostics
EMAIL_ERROR_INVALID_PARAMETERInvalid parameter, for example an empty path or invalid options
EMAIL_ERROR_READFailed to read the input, for example the file does not exist
EMAIL_ERROR_PARSEFailed to parse the email, including empty input
EMAIL_ERROR_HTMLFailed to generate the HTML
EMAIL_ERROR_WRITEFailed to write the output, including when the target file already exists
EMAIL_ERROR_PDFFailed to generate the PDF; use GetPdfError() for the detailed error
EMAIL_ERROR_LICENSEThe license is not initialized, invalid, expired or without permission; use GetPdfError() for the detailed error
EMAIL_ERROR_LIMITA size limit or an internal structural limit was exceeded
EMAIL_ERROR_CANCELLEDThe cancel callback requested cancellation
EMAIL_ERROR_OUT_OF_MEMORYOut of memory
EMAIL_ERROR_INTERNALInternal error

Degradation, recovery and errors during conversion are recorded as diagnostics. We recommend writing them to your application log:

csharp
foreach (CEmailDiagnostic diagnostic in result.GetDiagnostics())
{
    Console.WriteLine($"[{(diagnostic.IsError ? "Error" : "Warning")}] {diagnostic.Code}: {diagnostic.Detail} ({diagnostic.FallbackAction})");
}

Use the status to decide success or failure, and do not base business logic on diagnostic codes. Diagnostic codes containing limit can be used to report that a file is too large.