This repository has been archived by the owner on Jun 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
104 changed files
with
1,581 additions
and
932 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
*.js | ||
*.js.map | ||
*.log | ||
/demo/app/*.js | ||
/demo/*.d.ts | ||
/demo/lib | ||
/demo/platforms | ||
/demo/node_modules | ||
/node_modules | ||
!scripts/*.js | ||
demo/app/*.js | ||
!demo/karma.conf.js | ||
!demo/app/tests/*.js | ||
demo/*.d.ts | ||
!demo/references.d.ts | ||
demo/lib | ||
demo/platforms | ||
demo/node_modules | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
demo/ | ||
screenshots/ | ||
*.gif | ||
*.png | ||
*.log | ||
*.log | ||
*.map | ||
*.ts | ||
!*.d.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
// Place your settings in this file to overwrite default and user settings. | ||
{ | ||
"files.exclude": { | ||
"**/*.js": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,42 @@ | ||
# nativescript-pdf-view | ||
# NativeScript PDFView | ||
|
||
This is a very basic PDF view implementation that does only one thing, and | ||
that is to display PDF files. It conveniently uses the iOS `UIWebView`, but | ||
for Android it uses [AndroidPdfViewer](https://github.com/barteksc/AndroidPdfViewer). | ||
A minimal PDF view implementation that does only one thing, and that is to display PDF files in the simplest way possible. It conveniently uses the iOS `WKWebView`, and for Android it uses [`AndroidPdfViewer`](https://github.com/barteksc/AndroidPdfViewer). | ||
|
||
This plugin does the bare minimum required to render the PDF, no configuration | ||
options, and no error handling have been built yet. I welcome all Pull Requests! | ||
This plugin does the bare minimum required to render the PDF, no configuration options, and no error handling have been built yet. I welcome all Pull Requests! | ||
|
||
# Usage | ||
My aim is to keep the features consistent across iOS and Android. | ||
|
||
## | ||
## Installation | ||
|
||
Check out the [demo](./demo) folder for a sample usage. | ||
``` | ||
tns plugin add nativescript-pdf-view | ||
``` | ||
|
||
## Angular 2 | ||
## Usage | ||
|
||
If you're using the plugin with Angular 2, the plugin automatically registers | ||
`PDFView` as a valid tag for Angular templates. Usage is simple: | ||
### Vanilla NativeScript | ||
|
||
1. Make sure to import `nativescript-pdf-view` somewhere in your code, e.g: | ||
```xml | ||
<Page | ||
xmlns="http://schemas.nativescript.org/tns.xsd" | ||
xmlns:pdf="nativescript-pdf-view" | ||
loaded="pageLoaded"> | ||
<pdf:PDFView src="{{ pdfUrl }}" load="{{ onLoad }}" /> | ||
</Page> | ||
``` | ||
|
||
```ts | ||
import 'nativescript-pdf-view'; | ||
``` | ||
### Angular NativeScript | ||
|
||
2. Include the tag in your template: | ||
```ts | ||
import { PDFView } from 'nativescript-pdf-view'; | ||
import { registerElement } from 'nativescript-angular'; | ||
registerElement('PDFView', () => PDFView); | ||
``` | ||
|
||
```html | ||
<PDFView [src]="src" (load)="onLoad()"></PDFView> | ||
``` | ||
```html | ||
<PDFView [src]="src" (load)="onLoad()"></PDFView> | ||
``` | ||
|
||
# Try the Demo | ||
## Demo | ||
|
||
To try the demo, `cd` into the `demo` folder, and run the following commands: | ||
|
||
```sh | ||
npm install | ||
|
||
# iOS | ||
tns platform add ios | ||
tns run ios | ||
|
||
# Android | ||
tns platform add android | ||
tns run android | ||
``` | ||
Check out the [demo](./demo) folder for a demo application using this plugin. You can run the demo by executing `npm run demo.ios` and `npm run demo.android` from the root directory of the project. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
// Add your native dependencies here: | ||
|
||
// Uncomment to add recyclerview-v7 dependency | ||
//dependencies { | ||
// compile 'com.android.support:recyclerview-v7:+' | ||
//} | ||
android { | ||
defaultConfig { | ||
generatedDensities = [] | ||
applicationId = "com.merott.nativescriptpdfviewdemo" | ||
} | ||
aaptOptions { | ||
additionalParameters "--no-version-vectors" | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions
8
demo/app/App_Resources/Android/drawable-nodpi/splash_screen.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" android:gravity="fill"> | ||
<item> | ||
<bitmap android:gravity="fill" android:src="@drawable/background" /> | ||
</item> | ||
<item> | ||
<bitmap android:gravity="center" android:src="@drawable/logo" /> | ||
</item> | ||
</layer-list> |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<color name="ns_accent">#3d5afe</color> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
|
||
<!-- Application theme --> | ||
<style name="AppTheme" parent="AppThemeBase"> | ||
<item name="android:datePickerStyle">@style/SpinnerDatePicker</item> | ||
<item name="android:timePickerStyle">@style/SpinnerTimePicker</item> | ||
</style> | ||
|
||
<!-- Default style for DatePicker - in spinner mode --> | ||
<style name="SpinnerDatePicker" parent="android:Widget.Material.Light.DatePicker"> | ||
<item name="android:datePickerMode">spinner</item> | ||
</style> | ||
|
||
<!-- Default style for TimePicker - in spinner mode --> | ||
<style name="SpinnerTimePicker" parent="android:Widget.Material.Light.TimePicker"> | ||
<item name="android:timePickerMode">spinner</item> | ||
</style> | ||
|
||
<style name="NativeScriptToolbarStyle" parent="NativeScriptToolbarStyleBase"> | ||
<item name="android:elevation">4dp</item> | ||
</style> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<color name="ns_primary">#F5F5F5</color> | ||
<color name="ns_primaryDark">#757575</color> | ||
<color name="ns_accent">#33B5E5</color> | ||
<color name="ns_blue">#272734</color> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
||
<!-- theme to use FOR launch screen--> | ||
<style name="LaunchScreenThemeBase" parent="Theme.AppCompat.Light.NoActionBar"> | ||
<item name="toolbarStyle">@style/NativeScriptToolbarStyle</item> | ||
|
||
<item name="colorPrimary">@color/ns_primary</item> | ||
<item name="colorPrimaryDark">@color/ns_primaryDark</item> | ||
<item name="colorAccent">@color/ns_accent</item> | ||
|
||
<item name="android:windowBackground">@drawable/splash_screen</item> | ||
|
||
<item name="android:windowActionBarOverlay">true</item> | ||
<item name="android:windowTranslucentStatus">true</item> | ||
|
||
</style> | ||
|
||
<style name="LaunchScreenTheme" parent="LaunchScreenThemeBase"> | ||
</style> | ||
|
||
<!-- theme to use AFTER launch screen is loaded--> | ||
<style name="AppThemeBase" parent="Theme.AppCompat.Light.NoActionBar"> | ||
<item name="toolbarStyle">@style/NativeScriptToolbarStyle</item> | ||
|
||
<item name="colorPrimary">@color/ns_primary</item> | ||
<item name="colorPrimaryDark">@color/ns_primaryDark</item> | ||
<item name="colorAccent">@color/ns_accent</item> | ||
|
||
</style> | ||
|
||
<style name="AppTheme" parent="AppThemeBase"> | ||
</style> | ||
|
||
<!-- theme for actioon-bar --> | ||
<style name="NativeScriptToolbarStyleBase" parent="Widget.AppCompat.Toolbar"> | ||
<item name="android:background">@color/ns_primary</item> | ||
<item name="theme">@style/ThemeOverlay.AppCompat.ActionBar</item> | ||
<item name="popupTheme">@style/ThemeOverlay.AppCompat</item> | ||
|
||
</style> | ||
|
||
<style name="NativeScriptToolbarStyle" parent="NativeScriptToolbarStyleBase"> | ||
</style> | ||
</resources> |
Oops, something went wrong.