You can easily package an existing PDF file with your application and load it into C1PdfViewer at run time. For example, complete the following steps:
Visual Basic Copy CodeImports C1.Xaml.PdfViewer
C# Copy Codeusing C1.Xaml.PdfViewer;
Visual Basic Copy Code Dim resource As StorageFile = Await StorageFile.GetFileFromApplicationUriAsync(New Uri("ms-appx:///Resources/MyPdf.pdf")) Dim stream As Stream = Await resource.OpenStreamForReadAsync() Await PdfDocument.LoadFromFileAsync(resource) C1PdfViewer1.LoadDocument(stream)
C# Copy Code StorageFile resource = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Resources/MyPdf.pdf")); Stream stream = await resource.OpenStreamForReadAsync(); await PdfDocument.LoadFromFileAsync(resource); C1PdfViewer1.LoadDocument(stream);
This code calls the LoadDocument method passing in the application resource stream.
What You've Accomplished
In this example you've loaded a PDF file into the C1PdfViewer from the application resources. You packaged an existing PDF file with your application in code and loaded it into the C1PdfViewer at run time.