Reference Guide
GdPicture14 Namespace / GdPicturePDF Class / SetOCGZoomMin Method
The unique identifier of the required OCG entry. You can obtain this identifier using the GetOCG method.
The new value of the minimum magnification factor to be set. Please use the value 0.1 to define the 10% or 1 to define the 100% zoom factor.
Example





In This Topic
    SetOCGZoomMin Method (GdPicturePDF)
    In This Topic
    Sets up the minimum magnification factor of an optional content group, specified by its unique identifier.

    It is the minimum value of a defined range of magnifications at which the content of this optional content group is best viewed.

    Syntax
    'Declaration
     
    
    Public Function SetOCGZoomMin( _
       ByVal OCGId As Integer, _
       ByVal ZoomMin As Single _
    ) As GdPictureStatus
    public GdPictureStatus SetOCGZoomMin( 
       int OCGId,
       float ZoomMin
    )
    public function SetOCGZoomMin( 
        OCGId: Integer;
        ZoomMin: Single
    ): GdPictureStatus; 
    public function SetOCGZoomMin( 
       OCGId : int,
       ZoomMin : float
    ) : GdPictureStatus;
    public: GdPictureStatus SetOCGZoomMin( 
       int OCGId,
       float ZoomMin
    ) 
    public:
    GdPictureStatus SetOCGZoomMin( 
       int OCGId,
       float ZoomMin
    ) 

    Parameters

    OCGId
    The unique identifier of the required OCG entry. You can obtain this identifier using the GetOCG method.
    ZoomMin
    The new value of the minimum magnification factor to be set. Please use the value 0.1 to define the 10% or 1 to define the 100% zoom factor.

    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.

    To define the 10% to 200% zoom range, please set the ZoomMin parameter to 0.1 using the SetOCGZoomMin method and the ZoomMax parameter to 2 using the SetOCGZoomMax method.

    Be aware that some viewers can interpret this value as the minimum value of a defined range of magnifications below which the content of this optional content group is viewed, meaning that when zooming lower the content will not display.

    Example
    How to change the range of magnifications for the specified layer in the PDF document. The layer in this example is best viewed (in some viewers it is only viewed) when zooming between 0% and 100%.
    Dim caption As String = "Example: SetOCGZoomMin"
    Dim oGdPicturePDF As New GdPicturePDF()
    'Please see the example of the SetImageOptional() method for the test_ImageLayer.pdf file.
    If oGdPicturePDF.LoadFromFile("test_ImageLayer.pdf", False) = GdPictureStatus.OK Then
        Dim ocgCount As Integer = oGdPicturePDF.GetOCGCount()
        Dim status As GdPictureStatus = oGdPicturePDF.GetStat()
        If (status = GdPictureStatus.OK) AndAlso (ocgCount > 0) Then
            Dim ocgID As Integer = oGdPicturePDF.GetOCG(0)
            status = oGdPicturePDF.GetStat()
            If status = GdPictureStatus.OK Then
                If (oGdPicturePDF.SetOCGTitle(ocgID, "Updated layer") = GdPictureStatus.OK) AndAlso
                   (oGdPicturePDF.SetOCGLockedState(ocgID, False) = GdPictureStatus.OK) AndAlso
                   (oGdPicturePDF.SetOCGZoomMin(ocgID, 0) = GdPictureStatus.OK) AndAlso
                   (oGdPicturePDF.SetOCGZoomMax(ocgID, 1) = GdPictureStatus.OK) Then
                    If oGdPicturePDF.SaveToFile("test_UpdatedLayer.pdf") = GdPictureStatus.OK Then
                        MessageBox.Show("The example HAS been followed successfully and the file has been saved.", caption)
                    Else
                        MessageBox.Show("The example HAS been followed successfully, but the file can't be saved. Status: " + oGdPicturePDF.GetStat().ToString(), caption)
                    End If
                Else
                    MessageBox.Show("Setting up layer's options has failed with the status: " + oGdPicturePDF.GetStat().ToString(), caption)
                End If
            Else
                MessageBox.Show("The GetOCG() method has failed with the status: " + status.ToString(), caption)
            End If
        Else
            MessageBox.Show("The GetOCGCount() method has failed with the status: " + status.ToString(), caption)
        End If
    Else
        MessageBox.Show("The file can't be loaded.", caption)
    End If
    oGdPicturePDF.Dispose()
    string caption = "Example: SetOCGZoomMin";
    GdPicturePDF oGdPicturePDF = new GdPicturePDF();
    //Please see the example of the SetImageOptional() method for the test_ImageLayer.pdf file.
    if (oGdPicturePDF.LoadFromFile("test_ImageLayer.pdf", false) == GdPictureStatus.OK)
    {
        int ocgCount = oGdPicturePDF.GetOCGCount();
        GdPictureStatus status = oGdPicturePDF.GetStat();
        if ((status == GdPictureStatus.OK) && (ocgCount > 0))
        {
            int ocgID = oGdPicturePDF.GetOCG(0);
            status = oGdPicturePDF.GetStat();
            if (status == GdPictureStatus.OK)
            {
                if ((oGdPicturePDF.SetOCGTitle(ocgID, "Updated layer") == GdPictureStatus.OK) &&
                    (oGdPicturePDF.SetOCGLockedState(ocgID, false) == GdPictureStatus.OK) &&
                    (oGdPicturePDF.SetOCGZoomMin(ocgID, 0) == GdPictureStatus.OK) &&
                    (oGdPicturePDF.SetOCGZoomMax(ocgID, 1) == GdPictureStatus.OK))
                {
                    if (oGdPicturePDF.SaveToFile("test_UpdatedLayer.pdf") == GdPictureStatus.OK)
                    {
                        MessageBox.Show("The example HAS been followed successfully and the file has been saved.", caption);
                    }
                    else
                    {
                        MessageBox.Show("The example HAS been followed successfully, but the file can't be saved. Status: " + oGdPicturePDF.GetStat().ToString(), caption);
                    }
                }
                else
                {
                    MessageBox.Show("Setting up layer's options has failed with the status: " + oGdPicturePDF.GetStat().ToString(), caption);
                }
            }
            else
            {
                MessageBox.Show("The GetOCG() method has failed with the status: " + status.ToString(), caption);
            }
        }
        else
        {
            MessageBox.Show("The GetOCGCount() method has failed with the status: " + status.ToString(), caption);
        }
    }
    else
    {
        MessageBox.Show("The file can't be loaded.", caption);
    }
    oGdPicturePDF.Dispose();
    See Also