ImageGear v26.5 - Updated
ImageGear.Formats.Pdf Assembly / ImageGear.Formats.PDF Namespace / ImGearPDFPreflight Class
Members Example




In This Topic
    ImGearPDFPreflight Class
    In This Topic
    Provides preflight capabilities.
    Object Model
    ImGearPDFPreflight ClassImGearPDFPreflightConversionResult Class
    Syntax
    'Declaration
     
    Public NotInheritable Class ImGearPDFPreflight 
       Inherits ImGearPDFObject
    'Usage
     
    Dim instance As ImGearPDFPreflight
    public sealed class ImGearPDFPreflight : ImGearPDFObject 
    public __gc __sealed class ImGearPDFPreflight : public ImGearPDFObject 
    public ref class ImGearPDFPreflight sealed : public ImGearPDFObject 
    Remarks
    Class provides the functionality for conversion of PDF document to PDF/A standards. The following code example illustrates how the PDF file can be converted using the instance of this class. Notice, the saving of PDF document should be performed with ImGearPDFDocument.Save method.
    Example
    // Convert a PDF document to PDF/A-2B (2011).
    private void SavePdfDocumentAsPDFA2B2011(ImGearPDFDocument pdfDocument, string outputFilePathName)
    {
        // Create an ImGearPDFPreflight object from the source ImGearPDFDocument object, pdfDocument.
        using ImGearPDFPreflight preflight = new ImGearPDFPreflight(pdfDocument);
                
        // Create an ImGearPDFPreflightConversionOptions object for profile PDF/A-2B
        // with 300 DPI fallback rasterization resolution.
        using ImGearPDFPreflightConversionOptions options = new ImGearPDFPreflightConversionOptions(
            ImGearPDFPreflightProfile.PDFA_2B_2011, 300);
                
        // Attempt to create a new ImGearPDFDocument object from pdfDoc that is PDF/A-2B compliant.
        ImGearPDFPreflightConversionResult result = preflight.Convert(options);
        try
        {
            // Save the resulting PDF/A-2B compliant ImGearPDFDocument to a file.
            if (result.Succeeded)
            {
                using Stream stream = new FileStream(outputFilePathName, FileMode.Create, FileAccess.Write);
                result.Document.Save(stream, ImGearSavingFormats.PDF, 0, 0, (int)ImGearPDFPageRange.ALL_PAGES,
                    ImGearSavingModes.OVERWRITE);
            }
        }
        finally
        {
            // Dispose of the resulting ImGearPDFDocument.
            result.Document?.Dispose();
        }
    }
    Inheritance Hierarchy

    System.Object
       ImageGear.Formats.PDF.ImGearPDFObject
          ImageGear.Formats.PDF.ImGearPDFPreflight

    See Also