ComponentOne Xamarin.iOS Documentation
Controls / FlexViewer / Quick Start
In This Topic
    Quick Start
    In This Topic

    This quick start will guide you through the steps of adding FlexViewer control to the application, binding it with a document source, i.e., GcPdf, and loading the PDF in the FlexViewer control.

    Note: To use GcPdf as the document source for your application, you need to install GcPdf NuGet package to add the GcPdf references to your application.

    To achieve it, follow these steps:

    1. Add FlexViewer control
    2. Load the PDF document
    3. Run the Project

    The following image shows how the FlexViewer control appears after completing the steps above.

    Step 1: Add FlexViewer control

    1. In the Solution Explorer, click Main.storyboard to open the storyboard editor.
    2. From the Toolbox under Custom Components tab, drag a FlexViewer onto the ViewController.
    3. In the Properties window, set the Name of the FlexViewer control. In this example, we named it as flexViewer.
    Back to Top

    Step 2: Load the PDF document

    Load the PDF document in the FlexViewer control using the following code. In this example, we have added a PDF document to the Data folder to load it in the viewer.

    C#
    Copy Code
    string path = "Data/DefaultDocument.pdf";
    MemoryStream ms = new MemoryStream();
    {
        using (FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read))
        {
            byte[] bytes = new byte[fs.Length];
            fs.Read(bytes, 0, (int)fs.Length);
            ms.Write(bytes, 0, (int)fs.Length);
            flexViewer.LoadDocument(ms);
        }
    }
    
    Back to Top

    Step 3: Run the Project

    Press F5 to run the application.

    Back to Top