VintaSoft Imaging .NET SDK 14.0: Documentation for .NET developer
Vintasoft.Imaging.Pdf Namespace / PdfDocument Class / RuntimeMessages Property
Syntax Example Requirements SeeAlso
In This Topic
    RuntimeMessages Property (PdfDocument)
    In This Topic
    Gets a collection of runtime messages, which occured during loading of this PDF document or rendering of PDF pages in current thread.
    Syntax
    Example

    Here is an example that shows how to get information about the errors and warnings, which occur during loading/rendering of PDF document:

    
    ''' <summary>
    ''' Saves PDF document as a PDF/A document.
    ''' </summary>
    Public Shared Sub SaveAsPdfADocument(sourceFilename As String, destFilename As String, ByRef errors As Integer, ByRef warnings As Integer)
        ' load PDF document
        Using document As New Vintasoft.Imaging.Pdf.PdfDocument(sourceFilename)
            errors = 0
            warnings = 0
            ' clear runtime errors and warnings
            document.ClearRuntimeMessages()
    
            ' save PDF document as PDF/A document
            document.Pack(destFilename, Vintasoft.Imaging.Pdf.PdfFormat.Pdf_A)
    
            ' check runtime errors and warnings
            For Each message As Vintasoft.Imaging.Pdf.PdfRuntimeMessage In document.RuntimeMessages
                If TypeOf message Is Vintasoft.Imaging.Pdf.PdfRuntimeWarning Then
                    warnings += 1
                ElseIf TypeOf message Is Vintasoft.Imaging.Pdf.PdfRuntimeError Then
                    errors += 1
                End If
            Next
        End Using
    End Sub
    
    
    
    /// <summary>
    /// Saves PDF document as a PDF/A document.
    /// </summary>
    public static void SaveAsPdfADocument(
        string sourceFilename, string destFilename, out int errors, out int warnings)
    {
        // load PDF document
        using (Vintasoft.Imaging.Pdf.PdfDocument document = 
            new Vintasoft.Imaging.Pdf.PdfDocument(sourceFilename))
        {
            errors = 0;
            warnings = 0;
            // clear runtime errors and warnings
            document.ClearRuntimeMessages();
    
            // save PDF document as PDF/A document
            document.Pack(destFilename, Vintasoft.Imaging.Pdf.PdfFormat.Pdf_A);
    
            // check runtime errors and warnings
            foreach (Vintasoft.Imaging.Pdf.PdfRuntimeMessage message in document.RuntimeMessages)
            {
                if (message is Vintasoft.Imaging.Pdf.PdfRuntimeWarning)
                    warnings++;
                else if (message is Vintasoft.Imaging.Pdf.PdfRuntimeError)
                    errors++;
            }
        }
    }
    
    

    Requirements

    Target Platforms: .NET9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

    See Also