PDF Generation Template Editor
Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.
Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.
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_SUCCESS | Success |
EMAIL_SUCCESS_WITH_WARNINGS | Success with degradation or recovery; see the diagnostics |
EMAIL_ERROR_INVALID_PARAMETER | Invalid parameter, for example an empty path or invalid options |
EMAIL_ERROR_READ | Failed to read the input, for example the file does not exist |
EMAIL_ERROR_PARSE | Failed to parse the email, including empty input |
EMAIL_ERROR_HTML | Failed to generate the HTML |
EMAIL_ERROR_WRITE | Failed to write the output, including when the target file already exists |
EMAIL_ERROR_PDF | Failed to generate the PDF; use GetPdfError() for the detailed error |
EMAIL_ERROR_LICENSE | The license is not initialized, invalid, expired or without permission; use GetPdfError() for the detailed error |
EMAIL_ERROR_LIMIT | A size limit or an internal structural limit was exceeded |
EMAIL_ERROR_CANCELLED | The cancel callback requested cancellation |
EMAIL_ERROR_OUT_OF_MEMORY | Out of memory |
EMAIL_ERROR_INTERNAL | Internal error |
Degradation, recovery and errors during conversion are recorded as diagnostics. We recommend writing them to your application log:
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.