GdPicture.NET.14
GdPicture14 Namespace / GdPicturePDF Class / ConvertToPDFUA Method / ConvertToPDFUA(String,PdfConversionConformance,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. Currently, PDF_UA_1 is the only valid option.
The time interval, in other words timeout, in milliseconds, that specifies the maximum time allowed for the whole conversion process before it is automatically interrupted. Use 0 to specify no timeout.
Example





In This Topic
ConvertToPDFUA(String,PdfConversionConformance,Int32) Method
In This Topic
Converts the currently loaded PDF document to a brand new PDF document that meets the PDF/UA conformance.
Syntax
'Declaration
 
Public Overloads Function ConvertToPDFUA( _
   ByVal FilePath As String, _
   ByVal Conformance As PdfConversionConformance, _
   ByVal TimeoutMillisec As Integer _
) As GdPictureStatus
public function ConvertToPDFUA( 
    FilePath: String;
    Conformance: PdfConversionConformance;
    TimeoutMillisec: Integer
): GdPictureStatus; 
public function ConvertToPDFUA( 
   FilePath : String,
   Conformance : PdfConversionConformance,
   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. Currently, PDF_UA_1 is the only valid option.
TimeoutMillisec
The time interval, in other words timeout, in milliseconds, that specifies the maximum time allowed for the whole conversion process before it is automatically interrupted. Use 0 to specify no timeout.

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/UA Conversion component to run.

Example
How to convert the loaded PDF document to the PDF/UA-1 compliant document.
Dim caption As String = "Example: ConvertToPDFUA"
Using gdpicturePDF As GdPicturePDF = New GdPicturePDF()
    Dim status As GdPictureStatus = gdpicturePDF.LoadFromFile("test.pdf", False)
    If status = GdPictureStatus.OK Then
        status = gdpicturePDF.ConvertToPDFUA("converted.pdf", PdfConversionConformance.PDF_UA_1, 20000)
        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: ConvertToPDFUA";
using (GdPicturePDF gdpicturePDF = new GdPicturePDF())
{
    GdPictureStatus status = gdpicturePDF.LoadFromFile("test.pdf", false);
    if (status == GdPictureStatus.OK)
    {
        status = gdpicturePDF.ConvertToPDFUA("converted.pdf", PdfConversionConformance.PDF_UA_1, 20000);
        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