PdfViewer for WinRT > Task-Based Help > Loading Documents from Application Resources |
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 var resource = Application.GetResourceStream(new Uri("/MyProject;component/Resources/MyPdf.pdf", UriKind.Relative)); c1PdfViewer1.LoadDocument(resource.Stream)
C# Copy CodeDim resource = Application.GetResourceStream(New Uri("/MyProject;component/Resources/MyPdf.pdf", UriKind.Relative)) C1PdfViewer1.LoadDocument(resource.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.