{"id":30309461,"url":"https://github.com/aprysesdk/uwp-cordova-sample","last_synced_at":"2026-04-15T13:33:01.796Z","repository":{"id":71779388,"uuid":"210442666","full_name":"ApryseSDK/uwp-cordova-sample","owner":"ApryseSDK","description":"A sample UWP app in Cordova/Ionic.","archived":false,"fork":false,"pushed_at":"2019-09-23T20:17:47.000Z","size":192,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-07-30T20:00:18.585Z","etag":null,"topics":["cordova","ionic","ionic-framework"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ApryseSDK.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-23T20:06:36.000Z","updated_at":"2024-07-30T20:00:26.301Z","dependencies_parsed_at":null,"dependency_job_id":"97b5fa28-aaa3-456f-9e9a-846c508a0e9a","html_url":"https://github.com/ApryseSDK/uwp-cordova-sample","commit_stats":null,"previous_names":["aprysesdk/uwp-cordova-sample"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ApryseSDK/uwp-cordova-sample","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ApryseSDK%2Fuwp-cordova-sample","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ApryseSDK%2Fuwp-cordova-sample/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ApryseSDK%2Fuwp-cordova-sample/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ApryseSDK%2Fuwp-cordova-sample/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ApryseSDK","download_url":"https://codeload.github.com/ApryseSDK/uwp-cordova-sample/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ApryseSDK%2Fuwp-cordova-sample/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270856591,"owners_count":24657693,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-17T02:00:09.016Z","response_time":129,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cordova","ionic","ionic-framework"],"created_at":"2025-08-17T13:44:13.177Z","updated_at":"2026-04-15T13:32:56.768Z","avatar_url":"https://github.com/ApryseSDK.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# UWP Cordova sample\n\n[PDFTron's PDF SDK for UWP](https://www.pdftron.com/documentation/uwp) ships with a simple to use C# API for bringing document viewing, creation, searching, annotation, and editing capabilities to UWP apps. PDFTron’s fully supported SDK is trusted by thousands of innovative start-ups, governments, and Fortune 500 businesses. PDFTron technology is built from the ground up and is not dependent on any external third-party open-source software.\n\nThis is a UWP sample to show how you can create an app that can host Cordova generated files (from `www` directory that contains the web-based source code, including the `index.html` home page) within a `WebView` control and simultaneously open PDF files in the `PDFViewCtrl`. Thus, providing you with a way to host and integrate your Cordova project source code and PDFTron's native UWP SDK within a single app.\n\n![CordovaPage](https://pdftron.s3.amazonaws.com/custom/websitefiles/uwp/Cordova.PNG) \n![PDFTronPage](https://pdftron.s3.amazonaws.com/custom/websitefiles/uwp/PDFTronSDK.PNG) \n\n## Install\n\nStep 1: The first step is to generate Cordova files. If you are new to Cordova and want to start with a Cordova Windows sample app then please try the following:\n\n1) Download and install Node.js. \n2) Bring up the Command Prompt and goto the folder where you want to generate Cordova project. Let us assume that folder is `CordovaTest` on `C` drive.\n3) Enter and run the following commands.\n\n```\nC:\\CordovaTest\u003e            npm install -g cordova\nC:\\CordovaTest\u003e            cordova create pdftron com.example.pdftron PDFTronIntegration\nC:\\CordovaTest\u003e            cd pdftron\nC:\\CordovaTest\\pdftron\u003e    cordova platform add windows\nC:\\CordovaTest\\pdftron\u003e    cordova build windows\nC:\\CordovaTest\\pdftron\u003e    platforms\\windows\n```\n\nStep 2: Copy the `www` folder from  `pdftron\\platforms\\windows`\n\nNow that you have generated the Cordova files we can go to the second step i.e. to create an integrated host UWP app for Cordova and PDFTron SDK.\n\n1) In Visual Studio create a Blank App (Universal Windows) and call it `UWPHostApp`.\n2) Set the Minimum version to `Windows 10 (10.0; Build 17763)`. In case if you want to keep the minimum version to an older version, you will need to add the following to MainPage.xaml.\n```\n    xmlns:Windows10FallCreatorsUpdate=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract, 5)\"\n    xmlns:Windows10version1809=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract, 7)\"\n```\n\n3) Copy the `www` folder from `C:\\CordovaTest\\pdftron\\platforms\\windows` folder to the folder where your project file is located.\n4) Right click on the project in Solution Explorer and click on Add-\u003eNew Item. From the Window that shows up add a Blank Page. Let us call this `CordovaPage`.\n5) Right click on the project in Solution Explorer and click on Add-\u003eNew Item. Add another Blank Page and call it `PDFTronPage`.\n6) Right click on the project in Solution Explorer and click on Add-\u003eExisting Item. Add a PDF file to the project and set its Build Action property to Content and Copy to Output Directory property to Copy if newer.\n7) In Solution Explorer from the options/icons at the top select `Show All Files`. \n8) Now right click on `www` that shows up in your project tree and select `Include In Project`.\n9) Now de-select `Show All Files` from the options/icons at the top of Solution Explorer.\n10) Right click on `References` in the Solution Explorer and from the context menu select `Manage NuGet Packages...`. Click on `Browse` tab and in the search bar enter `PDFTron.UWP`. Search will show `PDFTron.UWP by PDFTron Systems Inc`. Install this NuGet package.\n11) Now in the App() constructor in App.xaml.cs add `pdftron.PDFNet.Initialize(\"your_key\");`\n\n```\npublic App()\n{\n    this.InitializeComponent();\n    this.Suspending += OnSuspending;\n    pdftron.PDFNet.Initialize(\"your_key\");\n}\n```\n\n12) In CordovaPage.xaml replace the xaml code with the following.\n\n```\n\u003cPage\n    x:Class=\"UWPHostApp.CordovaPage\"\n    xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n    xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n    xmlns:local=\"using:UWPHostApp\"\n    xmlns:d=\"http://schemas.microsoft.com/expression/blend/2008\"\n    xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\"\n    mc:Ignorable=\"d\"\n    Background=\"{ThemeResource ApplicationPageBackgroundThemeBrush}\" NavigationCacheMode=\"Required\"\u003e\n\n    \u003cGrid\u003e\n        \u003cWebView Name=\"MyWebView\" HorizontalAlignment=\"Stretch\" VerticalAlignment=\"Stretch\" Margin=\"0,0,0,0\"/\u003e\n    \u003c/Grid\u003e\n\u003c/Page\u003e\n```\n\n13) In CordovaPage.xaml.cs replace the CordovaPage() constructor with the following.\n\n```\npublic CordovaPage()\n{\n\tthis.InitializeComponent();\n\tMyWebView.Navigate(new Uri(\"ms-appx-web:///www/index.html\"));\n}\n```\n14) In PDFTronPage.xaml replace the xaml code with the following.\n\n```\n\u003cPage\n    x:Class=\"UWPHostApp.PDFTronPage\"\n    xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n    xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n    xmlns:local=\"using:UWPHostApp\"\n    xmlns:d=\"http://schemas.microsoft.com/expression/blend/2008\"\n    xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\"\n    mc:Ignorable=\"d\"\n    Background=\"{ThemeResource ApplicationPageBackgroundThemeBrush}\" NavigationCacheMode=\"Required\"\u003e\n\n    \u003cGrid Background=\"{StaticResource ApplicationPageBackgroundThemeBrush}\"\u003e\n        \u003cBorder x:Name=\"PDFViewBorder\" HorizontalAlignment=\"Stretch\" VerticalAlignment=\"Stretch\"/\u003e\n    \u003c/Grid\u003e\n\u003c/Page\u003e\n```\n\n15) In PDFTronPage.xaml.cs add `using System.IO;` if it is missing and replace the PDFTronPage() constructor with the following.\n\n```\npublic PDFTronPage()\n{\n    this.InitializeComponent();\n\n    pdftron.PDF.PDFViewCtrl myPDFViewCtrl = new pdftron.PDF.PDFViewCtrl();\n    myPDFViewCtrl.SetupThumbnails(false, true, false, 250, 100 * 1024 * 1024, 0.1);\n    myPDFViewCtrl.SetPagePresentationMode(pdftron.PDF.PDFViewCtrlPagePresentationMode.e_single_page);\n\n    myPDFViewCtrl.SetBackgroundColor(Windows.UI.Colors.DarkGray);\n    myPDFViewCtrl.SetPageSpacing(3, 3, 1, 1);\n    myPDFViewCtrl.SetRelativeZoomLimits(pdftron.PDF.PDFViewCtrlPageViewMode.e_fit_page, 0.7, 5);\n    myPDFViewCtrl.SetPageRefViewMode(pdftron.PDF.PDFViewCtrlPageViewMode.e_zoom);\n\n    PDFViewBorder.Child = myPDFViewCtrl;\n\n    var document = new pdftron.PDF.PDFDoc(Path.Combine(Windows.ApplicationModel.Package.Current.InstalledLocation.Path, \"tiger.pdf\"));\n    myPDFViewCtrl.SetDoc(document);\n}\n```\n\n16) Now in MainPage.xaml we will add a `NavigationView` control. Please replace the xaml code with the following.\n\n```\n\u003cPage\n    x:Class=\"UWPHostApp.MainPage\"\n    xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n    xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n    xmlns:local=\"using:UWPHostApp\"\n    xmlns:d=\"http://schemas.microsoft.com/expression/blend/2008\"\n    xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\"\n    xmlns:Windows10FallCreatorsUpdate=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract, 5)\"\n    xmlns:Windows10version1809=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract, 7)\"\n    mc:Ignorable=\"d\"\n    Background=\"{ThemeResource ApplicationPageBackgroundThemeBrush}\" \u003e\n\n    \u003cGrid\u003e\n        \u003cWindows10FallCreatorsUpdate:NavigationView Windows10version1809:PaneDisplayMode=\"Top\"  x:Name=\"NavigationView\"\n    ItemInvoked=\"NavigationView_ItemInvoked\"\n    Loaded=\"NavigationView_Loaded\"\u003e\n            \u003cNavigationView.MenuItems\u003e\n                \u003cNavigationViewItem x:Uid=\"CordovaNavItem\" Content=\"Cordova\" Tag=\"cordova\"/\u003e\n                \u003cNavigationViewItemSeparator/\u003e\n                \u003cNavigationViewItem x:Uid=\"PDFTronNavItem\" Content=\"PDFTron PDF View\" Tag=\"pdftron\"/\u003e\n            \u003c/NavigationView.MenuItems\u003e\n\n            \u003cFrame x:Name=\"ContentFrame\" Margin=\"24\"\u003e\n                \u003cFrame.ContentTransitions\u003e\n                    \u003cTransitionCollection\u003e\n                        \u003cNavigationThemeTransition/\u003e\n                    \u003c/TransitionCollection\u003e\n                \u003c/Frame.ContentTransitions\u003e\n            \u003c/Frame\u003e\n\n        \u003c/Windows10FallCreatorsUpdate:NavigationView\u003e\n    \u003c/Grid\u003e\n\u003c/Page\u003e\n```\n\n17) In MainPage.xaml.cs add the following event handlers to enable navigation to `CordovaPage` and `PDFTronPage`.\n\n```\nprivate void NavigationView_Loaded(object sender, RoutedEventArgs e)\n{\n    // set the initial SelectedItem \n    foreach (NavigationViewItemBase item in NavigationView.MenuItems)\n    {\n        if (item is NavigationViewItem \u0026\u0026 item.Tag.ToString() == \"cordova\")\n        {\n            NavigationView.SelectedItem = item;\n            ContentFrame.Navigate(typeof(CordovaPage));\n            break;\n        }\n    }\n}\n\nprivate void NavigationView_ItemInvoked(NavigationView sender, NavigationViewItemInvokedEventArgs args)\n{\n    // find NavigationViewItem with Content that equals InvokedItem\n    var item = sender.MenuItems.OfType\u003cNavigationViewItem\u003e().First(x =\u003e (string)x.Content == (string)args.InvokedItem);\n    NavigationView_Navigate(item as NavigationViewItem);\n}\n\nprivate void NavigationView_Navigate(NavigationViewItem item)\n{\n    switch (item.Tag)\n    {\n        case \"cordova\":\n            ContentFrame.Navigate(typeof(CordovaPage));\n            break;\n\n        case \"pdftron\":\n            ContentFrame.Navigate(typeof(PDFTronPage));\n            break;\n    }\n}\n```\n\n## Run\n\n- Select either x86 or x64 configuration.\n- Right click on the project and from the context menu select `Build`.\n- After the `Build` is successful run the project by pressing `F5` or clicking the `Run` icon.\n- You should now see the app Window with a NavigationView. The default tab shows Cordova files in a WebView and the other tab shows the PDF file loaded in the PDFViewCtrl.\n\n## Contributing\n\nSee [contributing](./CONTRIBUTING.md).\n\n## License\n\nSee [license](./LICENSE.md).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faprysesdk%2Fuwp-cordova-sample","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faprysesdk%2Fuwp-cordova-sample","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faprysesdk%2Fuwp-cordova-sample/lists"}