GdPicture.NET.14
GdPicture14 Namespace / GdPicturePDF Class / IsPortFolio Method
Output parameter. true if the current PDF file is a PDF Portfolio, otherwise false.
Output parameter. The index of that embedded file, which is initially presented in the user interface on opening the PDF Portfolio.

The return value is -1 if the initial document is the one that contains the collection (the source document), otherwise the return value is between 0 and GetEmbeddedFileCount-1.

Output parameter. A member of the PdfPortFolioType enumeration. The view mode you can view the component files in.
Example





In This Topic
IsPortFolio Method (GdPicturePDF)
In This Topic
Checks whether the currently loaded PDF document is a portable collection, so called PDF Portfolio.

A PDF Portfolio contains multiple files put together into a single PDF file. The files in a PDF Portfolio can be in a wide range of file types created in different applications, but the original files hold their individual identities. You can open, read, edit, and format each component file independently of the other component files in the PDF Portfolio.

Syntax
'Declaration
 
Public Function IsPortFolio( _
   ByRef Portfolio As Boolean, _
   ByRef FirstFileIdx As Integer, _
   ByRef ViewMode As PdfPortFolioType _
) As GdPictureStatus
public GdPictureStatus IsPortFolio( 
   ref bool Portfolio,
   ref int FirstFileIdx,
   ref PdfPortFolioType ViewMode
)
public function IsPortFolio( 
   var  Portfolio: Boolean;
   var  FirstFileIdx: Integer;
   var  ViewMode: PdfPortFolioType
): GdPictureStatus; 
public function IsPortFolio( 
   Portfolio : boolean,
   FirstFileIdx : int,
   ViewMode : PdfPortFolioType
) : GdPictureStatus;
public: GdPictureStatus IsPortFolio( 
   ref bool Portfolio,
   ref int FirstFileIdx,
   ref PdfPortFolioType ViewMode
) 
public:
GdPictureStatus IsPortFolio( 
   bool% Portfolio,
   int% FirstFileIdx,
   PdfPortFolioType% ViewMode
) 

Parameters

Portfolio
Output parameter. true if the current PDF file is a PDF Portfolio, otherwise false.
FirstFileIdx
Output parameter. The index of that embedded file, which is initially presented in the user interface on opening the PDF Portfolio.

The return value is -1 if the initial document is the one that contains the collection (the source document), otherwise the return value is between 0 and GetEmbeddedFileCount-1.

ViewMode
Output parameter. A member of the PdfPortFolioType enumeration. The view mode you can view the component files in.

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.
Example
How to find out if the PDF document is a portable collection (PDF Portfolio).
Dim caption As String = "Example: IsPortFolio"
Dim gdpicturePDF As New GdPicturePDF()
If gdpicturePDF.LoadFromFile("portfolio.pdf", False) = GdPictureStatus.OK Then
    Dim isPortfolio As Boolean 'out variable
    Dim firstIndex As Integer 'out variable
    Dim type As PdfPortFolioType 'out variable
    Dim status As GdPictureStatus = gdpicturePDF.IsPortFolio(isPortfolio, firstIndex, type)
    If status = GdPictureStatus.OK Then
        If isPortfolio Then
            Dim count As Integer = gdpicturePDF.GetEmbeddedFileCount()
            status = gdpicturePDF.GetStat()
            If status = GdPictureStatus.OK Then
                MessageBox.Show("This PDF document is a portable collection containing " + count.ToString() + " files.", caption)
            Else
                MessageBox.Show("This PDF document is a portable collection." + vbCrLf + "This error occurs when finding the number of files: " + status.ToString(), caption)
            End If
        Else
            MessageBox.Show("This PDF document is not a portable collection.", caption)
            
        End If
    Else
        MessageBox.Show("The IsPortFolio() method has failed with the status: " + status.ToString(), caption)
    End If
Else
    MessageBox.Show("The file can't be loaded.", caption)
End If
gdpicturePDF.Dispose()
string caption = "Example: IsPortFolio";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
if (gdpicturePDF.LoadFromFile("portfolio.pdf", false) == GdPictureStatus.OK)
{
    bool isPortfolio = false; //out variable
    int firstIndex = -1; //out variable
    PdfPortFolioType type = PdfPortFolioType.Detail; //out variable
    GdPictureStatus status = gdpicturePDF.IsPortFolio(ref isPortfolio, ref firstIndex, ref type);
    if (status == GdPictureStatus.OK)
    {
        if (isPortfolio)
        {
            int count = gdpicturePDF.GetEmbeddedFileCount();
            status = gdpicturePDF.GetStat();
            if (status == GdPictureStatus.OK)
            {
                MessageBox.Show("This PDF document is a portable collection containing " + count.ToString() + " files.", caption);
            }
            else
            {
                MessageBox.Show("This PDF document is a portable collection.\nThis error occurs when finding the number of files: " + status.ToString(), caption);
            }
        }
        else
        {
            MessageBox.Show("This PDF document is not a portable collection.", caption);
        }
            
    }
    else
    {
        MessageBox.Show("The IsPortFolio() method has failed with the status: " + status.ToString(), caption);
    }
}
else
{
    MessageBox.Show("The file can't be loaded.", caption);
}
gdpicturePDF.Dispose();
See Also