The new full PDF version number you want to increase to. You have to set the full version number here, for example, 1.6 or 2.0.
Example





In This Topic
GdPicture14 Namespace / GdPicturePDF Class / IncreaseVersion Method

IncreaseVersion Method (GdPicturePDF)

In This Topic
Increases the full PDF version number of the currently loaded PDF document to the version number you have specified.

The PDF version number uses a form M.m, where M is the major version number and m is the minor version number. This version is stated in the PDF header, which is the first line in the PDF file.

Please note that you have to specify the full version number using this method. For example, for increasing to the version 1.6, you have to set the Version parameter to 1.6, or for increasing to 2.0 you have to set the Version parameter to 2.0.

Syntax
'Declaration
 
Public Function IncreaseVersion( _
   ByVal Version As Single _
) As GdPictureStatus
public GdPictureStatus IncreaseVersion( 
   float Version
)
public function IncreaseVersion( 
    Version: Single
): GdPictureStatus; 
public function IncreaseVersion( 
   Version : float
) : GdPictureStatus;
public: GdPictureStatus IncreaseVersion( 
   float Version
) 
public:
GdPictureStatus IncreaseVersion( 
   float Version
) 

Parameters

Version
The new full PDF version number you want to increase to. You have to set the full version number here, for example, 1.6 or 2.0.

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 if the required version you specify is not supported by the toolkit, this method will fail.

Just to inform you, that this method can be useful to convert your input PDF/A 1.4 compliant document to be PDF 1.6 compliant in order to decrease its resulting file size.

Example
How to increase the PDF version of your document to be compliant with PDF 1.6 version.
Dim caption As String = "Example: IncreaseVersion"
Using gdpicturePDF As New GdPicturePDF()
    If gdpicturePDF.LoadFromFile("test.pdf", False) = GdPictureStatus.OK Then
        Dim version As String = gdpicturePDF.GetVersion()
        Dim status As GdPictureStatus = gdpicturePDF.GetStat()
        If status = GdPictureStatus.OK Then
            MessageBox.Show("The original version of this PDF is: " + version, caption)
            If version.Equals("1.4", StringComparison.Ordinal) OrElse version.Equals("1.5", StringComparison.Ordinal) Then
                status = gdpicturePDF.IncreaseVersion(1.6F)
                If status = GdPictureStatus.OK Then
                    If gdpicturePDF.SaveToFile("test_IncreaseVersion.pdf") = GdPictureStatus.OK Then
                        MessageBox.Show("The version has been increased successfully.", caption)
                    Else
                        MessageBox.Show("The new file can't be saved.", caption)
                    End If
                Else
                    MessageBox.Show("The IncreaseVersion() method has failed with the status: " + status.ToString(), caption)
                End If
            Else
                If version.Equals("1.6", StringComparison.Ordinal) Then
                    MessageBox.Show("This PDF file already conforms to PDF version 1.6.", caption)
                End If
            End If
        Else
            MessageBox.Show("The GetVersion() method has failed with the status: " + status.ToString(), caption)
        End If
    Else
        MessageBox.Show("The file can't be loaded.", caption)
    End If
End Using
string caption = "Example: IncreaseVersion";
using (GdPicturePDF gdpicturePDF = new GdPicturePDF())
{
    if (gdpicturePDF.LoadFromFile("test.pdf", false) == GdPictureStatus.OK)
    {
        string version = gdpicturePDF.GetVersion();
        GdPictureStatus status = gdpicturePDF.GetStat();
        if (status == GdPictureStatus.OK)
        {
            MessageBox.Show("The original version of this PDF is: " + version, caption);
            if (version.Equals("1.4", StringComparison.Ordinal) || version.Equals("1.5", StringComparison.Ordinal))
            {
                status = gdpicturePDF.IncreaseVersion(1.6f);
                if (status == GdPictureStatus.OK)
                {
                    if (gdpicturePDF.SaveToFile("test_IncreaseVersion.pdf") == GdPictureStatus.OK)
                    {
                        MessageBox.Show("The version has been increased successfully.", caption);
                    }
                    else
                    {
                        MessageBox.Show("The new file can't be saved.", caption);
                    }
                }
                else
                {
                    MessageBox.Show("The IncreaseVersion() method has failed with the status: " + status.ToString(), caption);
                }
            }
            else
            {
                if (version.Equals("1.6", StringComparison.Ordinal))
                {
                    MessageBox.Show("This PDF file already conforms to PDF version 1.6.", caption);
                }
            }
        }
        else
        {
            MessageBox.Show("The GetVersion() method has failed with the status: " + status.ToString(), caption);
        }
    }
    else
    {
        MessageBox.Show("The file can't be loaded.", caption);
    }
}
See Also