GdPicture.NET.14
GdPicture14 Namespace / GdPicturePDF Class / PortFolioCreate Method / PortFolioCreate(String,PdfPortFolioType) Method
The file name of that embedded file, which is initially presented in the user interface on opening the PDF Portfolio.
A member of the PdfPortFolioType enumeration. Sets the view mode users can view the component files in.
Example





In This Topic
PortFolioCreate(String,PdfPortFolioType) Method
In This Topic
Converts a common PDF document into a PDF Portfolio file. You need to specify the file name of that embedded file you want to display on opening the PDF Portfolio and the view mode users can view the component files in.

Please note that your source PDF document must contain at least one embedded (attached) file, otherwise this method will fail. It is also not allowed to create a PDF Portfolio file if your source PDF document is PDF/A compliant.

Syntax
'Declaration
 
Public Overloads Function PortFolioCreate( _
   ByVal FirstFileNameToShow As String, _
   ByVal ViewMode As PdfPortFolioType _
) As GdPictureStatus
public GdPictureStatus PortFolioCreate( 
   string FirstFileNameToShow,
   PdfPortFolioType ViewMode
)
public function PortFolioCreate( 
    FirstFileNameToShow: String;
    ViewMode: PdfPortFolioType
): GdPictureStatus; 
public function PortFolioCreate( 
   FirstFileNameToShow : String,
   ViewMode : PdfPortFolioType
) : GdPictureStatus;
public: GdPictureStatus PortFolioCreate( 
   string* FirstFileNameToShow,
   PdfPortFolioType ViewMode
) 
public:
GdPictureStatus PortFolioCreate( 
   String^ FirstFileNameToShow,
   PdfPortFolioType ViewMode
) 

Parameters

FirstFileNameToShow
The file name of that embedded file, which is initially presented in the user interface on opening the PDF Portfolio.
ViewMode
A member of the PdfPortFolioType enumeration. Sets the view mode users 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.

The PDF version of the newly created PDF Portfolio is 1.7.

Example
How to create a PDF Portfolio containing a collection of three files.
Dim caption As String = "Example: PortFolioCreate"
Dim gdpicturePDF As New GdPicturePDF()
'Creating a new common PDF file.
If (gdpicturePDF.NewPDF() <> GdPictureStatus.OK) OrElse (gdpicturePDF.NewPage(PdfPageSizes.PdfPageSizeLetter) <> GdPictureStatus.OK) Then
    MessageBox.Show("The new PDF document can't be created.", caption)
Else
    'Embedding the files into the created PDF file.
    If (gdpicturePDF.EmbedFile("textfile.txt", "1st attachmment") <> GdPictureStatus.OK) OrElse (gdpicturePDF.EmbedFile("docfile.docx", "2nd attachment") <> GdPictureStatus.OK) OrElse (gdpicturePDF.EmbedFile("pdffile.pdf", "3rd attachment") <> GdPictureStatus.OK) Then
        MessageBox.Show("The files can't be attached.", caption)
    Else
        'Creating a PDF Portfolio.
        Dim status As GdPictureStatus = gdpicturePDF.PortFolioCreate("textfile.txt", PdfPortFolioType.Detail)
        If status = GdPictureStatus.OK Then
            If gdpicturePDF.SaveToFile("gdpicturepdf_portfolio.pdf") = GdPictureStatus.OK Then
                MessageBox.Show("The PDF Portfolio file has been created and saved successfully.", caption)
            End If
        Else
            MessageBox.Show("The PortFolioCreate() method has failed with the status: " + status.ToString(), caption)
        End If
    End If
End If
gdpicturePDF.Dispose()
string caption = "Example: PortFolioCreate";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
//Creating a new common PDF file.
if ((gdpicturePDF.NewPDF() != GdPictureStatus.OK) ||
    (gdpicturePDF.NewPage(PdfPageSizes.PdfPageSizeLetter) != GdPictureStatus.OK))
{
    MessageBox.Show("The new PDF document can't be created.", caption);
}
else
{
    //Embedding the files into the created PDF file.
    if ((gdpicturePDF.EmbedFile("textfile.txt", "1st attachmment") != GdPictureStatus.OK) ||
        (gdpicturePDF.EmbedFile("docfile.docx", "2nd attachment") != GdPictureStatus.OK) ||
        (gdpicturePDF.EmbedFile("pdffile.pdf", "3rd attachment") != GdPictureStatus.OK))
    {
        MessageBox.Show("The files can't be attached.", caption);
    }
    else
    {
        //Creating a PDF Portfolio.
        GdPictureStatus status = gdpicturePDF.PortFolioCreate("textfile.txt", PdfPortFolioType.Detail);
        if (status == GdPictureStatus.OK)
        {
            if (gdpicturePDF.SaveToFile("gdpicturepdf_portfolio.pdf") == GdPictureStatus.OK)
            {
                MessageBox.Show("The PDF Portfolio file has been created and saved successfully.", caption);
            }
        }
        else
        {
            MessageBox.Show("The PortFolioCreate() method has failed with the status: " + status.ToString(), caption);
        }
     }
}
gdpicturePDF.Dispose();
See Also