GdPicture.NET.14.API
GdPicture14 Namespace / GdPicturePDF Class / ConvertToPDFA Method / ConvertToPDFA(String,PdfConversionConformance,Boolean,Boolean,Int32) Method
The file path where the converted PDF document will be saved. If the specified file already exists, it will be overwritten.

You are allowed to overwrite the currently opened PDF document only if the document has been loaded into memory setting the LoadInMemory parameter to true in the previously called GdPicturePDF.LoadFromFile method.

A member of the PdfConversionConformance enumeration. Specifies the required conformance level of the converted PDF document.
Set this parameter to true, if you want to let the conversion engine use the page vectorization when the direct conversion is not possible. Otherwise set it to false. Vectorization produces vector based graphic elements where applicable, for example, fonts and paths, and combines them with image resources.

The recommended value is true.

Set this parameter to true, if you want to let the conversion engine use the page rasterization when the direct conversion and vectorization are not possible or allowed. Otherwise set it to false. Rasterization renders the document content using the raster (pixel-based) approach.

The recommended value is true.

Example





In This Topic
ConvertToPDFA(String,PdfConversionConformance,Boolean,Boolean,Int32) Method
In This Topic
Converts the currently loaded PDF document to a brand new PDF document that meets the PDF/A conformance level according to what you have specified. Please refer to this example for more details about our native PDF to PDF/A converter.

Be aware that both Vectorization and Rasterization approaches, when used, result in loss of fonts and text information because the text converts into shapes and raster images. Text information can be later recovered using OCR features.

Syntax
'Declaration
 
Public Overloads Function ConvertToPDFA( _
   ByVal FilePath As String, _
   ByVal Conformance As PdfConversionConformance, _
   ByVal AllowVectorization As Boolean, _
   ByVal AllowRasterization As Boolean, _
   ByVal TimeoutMillisec As Integer _
) As GdPictureStatus
public function ConvertToPDFA( 
    FilePath: String;
    Conformance: PdfConversionConformance;
    AllowVectorization: Boolean;
    AllowRasterization: Boolean;
    TimeoutMillisec: Integer
): GdPictureStatus; 
public function ConvertToPDFA( 
   FilePath : String,
   Conformance : PdfConversionConformance,
   AllowVectorization : boolean,
   AllowRasterization : boolean,
   TimeoutMillisec : int
) : GdPictureStatus;

Parameters

FilePath
The file path where the converted PDF document will be saved. If the specified file already exists, it will be overwritten.

You are allowed to overwrite the currently opened PDF document only if the document has been loaded into memory setting the LoadInMemory parameter to true in the previously called GdPicturePDF.LoadFromFile method.

Conformance
A member of the PdfConversionConformance enumeration. Specifies the required conformance level of the converted PDF document.
AllowVectorization
Set this parameter to true, if you want to let the conversion engine use the page vectorization when the direct conversion is not possible. Otherwise set it to false. Vectorization produces vector based graphic elements where applicable, for example, fonts and paths, and combines them with image resources.

The recommended value is true.

AllowRasterization
Set this parameter to true, if you want to let the conversion engine use the page rasterization when the direct conversion and vectorization are not possible or allowed. Otherwise set it to false. Rasterization renders the document content using the raster (pixel-based) approach.

The recommended value is true.

TimeoutMillisec

Return Value

A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK.

We strongly recommend always checking this status first.

Remarks
This method is only allowed for use with non-encrypted documents.

Be aware that you have to specify a full file path with the correct file extension, which is "pdf".

This method requires the PDF/A Conversion & Validation component to run.

Example
How to convert the loaded PDF document to the PDF/A-1b compliant document.
Dim caption As String = "Example: ConvertToPDFA"
Using gdpicturePDF As GdPicturePDF = New GdPicturePDF()
    Dim status As GdPictureStatus = gdpicturePDF.LoadFromFile("test.pdf", False)
    If status = GdPictureStatus.OK Then
        status = gdpicturePDF.ConvertToPDFA("converted.pdf", PdfConversionConformance.PDF_A_1b, True, True)
        If status = GdPictureStatus.OK Then
            MessageBox.Show("The PDF file has been converted successfully.", caption)
        Else
            MessageBox.Show("The file can't be converted. Status: " + status.ToString(), caption)
        End If
        gdpicturePDF.CloseDocument()
    Else
        MessageBox.Show("The file can't be loaded. Status: " + status.ToString(), caption)
    End If
End Using
string caption = "Example: ConvertToPDFA";
using (GdPicturePDF gdpicturePDF = new GdPicturePDF())
{
    GdPictureStatus status = gdpicturePDF.LoadFromFile("test.pdf", false);
    if (status == GdPictureStatus.OK)
    {
        status = gdpicturePDF.ConvertToPDFA("converted.pdf", PdfConversionConformance.PDF_A_1b, true, true);
        if (status == GdPictureStatus.OK)
            MessageBox.Show("The PDF file has been converted successfully.", caption);
        else
            MessageBox.Show("The file can't be converted. Status: " + status.ToString(), caption);
        gdpicturePDF.CloseDocument();
    }
    else
        MessageBox.Show("The file can't be loaded. Status: " + status.ToString(), caption);
}
See Also