ImageGear .NET
ImGearPDFPreflight Class
Members  Example 




Provides preflight capabilities.
Object Model
ImGearPDFPreflight ClassImGearPDFPreflightReport ClassImGearPDFPreflightReport 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 verification and conversion of PDF document to PDFA standards. The following code example illustrates how the PDF file can be verified and converted using the instance of this class. Notice, the saving of PDF document should be performed with ImGearPDFDocument.Save method because ImageGear.Formats.ImGearFileFormats.SaveDocument does not support thi functionality.
Example
// Stores PDF document to a file as PDFA standard.
   private void SavePdfDocumentAsPDFA(ImGearPDFDocument document, ImGearPDFPreflightProfile profile, string outputFilePathName)
   {
       // Create object-converter. 
       using (ImGearPDFPreflight preflight = new ImGearPDFPreflight((ImGearPDFDocument)document))
       {
        ImGearPDFPreflightReport report = preflight.VerifyCompliance(profile, 0, -1);
        if (report.Code == ImGearPDFPreflightReportCodes.SUCCESS)
        {
            // PDF document is already compliant to PDFA standard.
            // Nothing is performed.
        }
        else
        {
            if (report.Status == ImGearPDFPreflightStatusCode.Fixable)
            {
                // Create conversion options. We need to be sure the "ig_rgb_profile.icm" color profile
                // is placed in executable file directory of this application.
                ImGearPDFPreflightConvertOptions conversionOptions = new ImGearPDFPreflightConvertOptions(profile, 0, -1);
                // Perform the conversion.
                report = preflight.Convert(conversionOptions);
                if (report.Code == ImGearPDFPreflightReportCodes.SUCCESS)
                {
                    // Store converted document to a file.
                    using (Stream stream = new FileStream(outputFilePathName, FileMode.Create, FileAccess.Write))
                        pdfDocument.Save(stream, ImGearSavingFormats.UNKNOWN, 0, 0, (int)ImGearPDFPageRange.ALL_PAGES, ImGearSavingModes.OVERWRITE);
                }
                else
                    throw new ApplicationException("PDF document cannot be converted to APDF standard.");
            }
            else
                throw new ApplicationException("PDF document cannot be converted to APDF standard.");
        }
    }
}
' Stores PDF document to a file as PDFA standard.
Private Sub SavePdfDocumentAsPDFA(document As ImGearPDFDocument, profile As ImGearPDFPreflightProfile, outputFilePathName As String)
	' Create object-converter. 
	Using preflight As New ImGearPDFPreflight(DirectCast(document, ImGearPDFDocument))
		Dim report As ImGearPDFPreflightReport = preflight.VerifyCompliance(profile, 0, -1)
				' PDF document is already compliant to PDFA standard.
				' Nothing is performed.
		If report.Code = ImGearPDFPreflightReportCodes.SUCCESS Then
		Else
			If report.Status = ImGearPDFPreflightStatusCode.Fixable Then
				' Create conversion options. We need to be sure the "ig_rgb_profile.icm" color profile
				' is placed in executable file directory of this application.
				Dim conversionOptions As New ImGearPDFPreflightConvertOptions(profile, 0, -1)
				' Perform the conversion.
				report = preflight.Convert(conversionOptions)
				If report.Code = ImGearPDFPreflightReportCodes.SUCCESS Then
					' Store converted document to a file.
					Using stream As Stream = New FileStream(outputFilePathName, FileMode.Create, FileAccess.Write)
						pdfDocument.Save(stream, ImGearSavingFormats.UNKNOWN, 0, 0, DirectCast(ImGearPDFPageRange.ALL_PAGES, Integer), ImGearSavingModes.OVERWRITE)
					End Using
				Else
					Throw New ApplicationException("PDF document cannot be converted to APDF standard.")
				End If
			Else
				Throw New ApplicationException("PDF document cannot be converted to APDF standard.")
			End If
		End If
	End Using
End Sub
Inheritance Hierarchy

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

See Also

Reference

ImGearPDFPreflight Members
ImageGear.Formats.PDF Namespace
ImGearPDEObject Class

 

 


©2016. Accusoft Corporation. All Rights Reserved.

Send Feedback