The unique identifier of the required OCG entry. You can obtain this identifier using the GetOCG method.
Example





In This Topic
GdPicture14 Namespace / GdPicturePDF Class / GetOCGZoomMin Method

GetOCGZoomMin Method (GdPicturePDF)

In This Topic
Returns 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 GetOCGZoomMin( _
   ByVal OCGId As Integer _
) As Double
public double GetOCGZoomMin( 
   int OCGId
)
public function GetOCGZoomMin( 
    OCGId: Integer
): Double; 
public function GetOCGZoomMin( 
   OCGId : int
) : double;
public: double GetOCGZoomMin( 
   int OCGId
) 
public:
double GetOCGZoomMin( 
   int OCGId
) 

Parameters

OCGId
The unique identifier of the required OCG entry. You can obtain this identifier using the GetOCG method.

Return Value

The minimum recommended magnification factor at which the content of the specified OCG is best viewed. The GetStat method can be subsequently used to determine if this method has been successful.
Remarks
This method is only allowed for use with non-encrypted documents.

It is recommend to use the GetStat method to identify the specific reason for the method's failure, if any.

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 find out the range of magnifications of the specified layer in the PDF document.
Dim gdpicturePDF As New GdPicturePDF()
Dim status As GdPictureStatus = gdpicturePDF.LoadFromFile("test.pdf", False)
If status = GdPictureStatus.OK Then
    Dim output As String = ""
    Dim ocgCount As Integer = gdpicturePDF.GetOCGCount()
    status = gdpicturePDF.GetStat()
    If status = GdPictureStatus.OK Then
        output = "The number of OCG layers: " + ocgCount.ToString()
        Dim OcgId As Integer = 0
        Dim title As String = ""
        Dim onOff As Boolean = False
        Dim zoom As Double = 0
        For i As Integer = 0 To ocgCount - 1
            output = output + vbCrLf + "Layer nr." + (i + 1).ToString() + ": "
            OcgId = gdpicturePDF.GetOCG(i)
            status = gdpicturePDF.GetStat()
            If status = GdPictureStatus.OK Then
                title = gdpicturePDF.GetOCGTitle(OcgId)
                status = gdpicturePDF.GetStat()
                If status = GdPictureStatus.OK Then
                    output = output + "Title = " + title.ToString()
                Else
                    output = output + "Title = Error (" + status.ToString() + ")"
                End If
            
                onOff = gdpicturePDF.GetOCGIntentView(OcgId)
                status = gdpicturePDF.GetStat()
                If status = GdPictureStatus.OK Then
                    If onOff Then
                        output = output + "    Intent = View"
                    Else
                        output = output + "    Intent = Design"
                    End If
                Else
                    output = output + "    Intent = Error (" + status.ToString() + ")"
                End If
            
                zoom = gdpicturePDF.GetOCGZoomMin(OcgId)
                status = gdpicturePDF.GetStat()
                If status = GdPictureStatus.OK Then
                    output = output + vbCrLf + "       zoomMin = " + String.Format("{0:0.00}", zoom)
                Else
                    output = output + vbCrLf + "       zoomMin = Error (" + status.ToString() + ")"
                End If
            
                zoom = gdpicturePDF.GetOCGZoomMax(OcgId)
                status = gdpicturePDF.GetStat()
                If status = GdPictureStatus.OK Then
                    output = output + "    zoomMax = " + String.Format("{0:0.00}", zoom)
                Else
                    output = output + "    zoomMax = Error (" + status.ToString() + ")"
                End If
            Else
                output = output + "The GetOCG() method has failed with the status: " + status.ToString()
            End If
        Next
        MessageBox.Show(output, "Example: GetOCGZoomMin")
    Else
        MessageBox.Show("The GetOCGCount() method has failed with the status: " + status.ToString(), "Example: GetOCGZoomMin")
    End If
Else
    MessageBox.Show("The file can't be loaded.", "Example: GetOCGZoomMin")
End If
gdpicturePDF.Dispose()
GdPicturePDF gdpicturePDF = new GdPicturePDF();
GdPictureStatus status = gdpicturePDF.LoadFromFile("test.pdf", false);
if (status == GdPictureStatus.OK)
{
    string output = "";
    int ocgCount = gdpicturePDF.GetOCGCount();
    status = gdpicturePDF.GetStat();
    if (status == GdPictureStatus.OK)
    {
        output = "The number of OCG layers: " + ocgCount.ToString();
        int OcgId = 0;
        string title = "";
        bool onOff = false;
        double zoom = 0;
        for (int i = 0; i < ocgCount; i++)
        {
            output = output + "\nLayer nr." + (i+1).ToString() + ": ";
            OcgId = gdpicturePDF.GetOCG(i);
            status = gdpicturePDF.GetStat();
            if (status == GdPictureStatus.OK)
            {
                title = gdpicturePDF.GetOCGTitle(OcgId);
                status = gdpicturePDF.GetStat();
                if (status == GdPictureStatus.OK)
                    output = output + "Title = " + title.ToString();
                else
                    output = output + "Title = Error (" + status.ToString() + ")";
            
                onOff = gdpicturePDF.GetOCGIntentView(OcgId);
                status = gdpicturePDF.GetStat();
                if (status == GdPictureStatus.OK)
                {
                    if (onOff)
                        output = output + "    Intent = View";
                    else
                        output = output + "    Intent = Design";
                }
                else
                    output = output + "    Intent = Error (" + status.ToString() + ")";
            
                zoom = gdpicturePDF.GetOCGZoomMin(OcgId);
                status = gdpicturePDF.GetStat();
                if (status == GdPictureStatus.OK)
                    output = output + "\n       zoomMin = " + string.Format("{0:0.00}", zoom);
                else
                    output = output + "\n       zoomMin = Error (" + status.ToString() + ")";
            
                zoom = gdpicturePDF.GetOCGZoomMax(OcgId);
                status = gdpicturePDF.GetStat();
                if (status == GdPictureStatus.OK)
                    output = output + "    zoomMax = " + string.Format("{0:0.00}", zoom);
                else
                    output = output + "    zoomMax = Error (" + status.ToString() + ")";
            }
            else
                output = output + "The GetOCG() method has failed with the status: " + status.ToString();
        }
        MessageBox.Show(output, "Example: GetOCGZoomMin");
    }
    else
    {
        MessageBox.Show("The GetOCGCount() method has failed with the status: " + status.ToString(), "Example: GetOCGZoomMin");
    }
}
else
{
    MessageBox.Show("The file can't be loaded.", "Example: GetOCGZoomMin");
}
gdpicturePDF.Dispose();
See Also