ComponentOne PdfViewer for UWP
In This Topic
    Loading Documents From Isolated Storage
    In This Topic

    You can save and load PDF files to isolated storage using the C1PdfViewer control. To save a file to isolated storage you would need to call the SaveDocument method passing in an isolated storage file stream:

    To write the code in Visual Basic:

      
    Visual Basic
    Copy Code

    Public Sub New()

        InitializeComponent()

        ' save file to isolated storage

        Using store = IsolatedStorageFile.GetUserStoreForApplication()

            Using stream = New IsolatedStorageFileStream("C1XapOptimizer.pdf", FileMode.Create, FileAccess.Write, store)

                C1PdfViewer1.SaveDocument(stream)

            End Using

        End Using

    End Sub

    To write the code in C#:

      
    C#
    Copy Code

    public MainPage()

    {

        InitializeComponent();

        // load file from the Web

        WebClient client = new WebClient();

        client.OpenReadCompleted += new OpenReadCompletedEventHandler(client_OpenReadCompleted);

        client.OpenReadAsync(new Uri("http://www.componentone.com/newimages/Products/Documentation/Silverlight.Maps.pdf", UriKind.Absolute));

    }

    void client_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)

    {

        c1PdfViewer1.LoadDocument(e.Result);

         

    To load an existing file from isolated storage call the LoadDocument method passing in an isolated storage file stream:

    What You've Accomplished

    In this example you've saved and loaded PDF files to isolated storage using the C1PdfViewer control.