Skip to content
This repository has been archived by the owner on Sep 7, 2022. It is now read-only.

Commit

Permalink
Merge pull request #16 from FinanzRitter/optional-annotations-on-android
Browse files Browse the repository at this point in the history
feat: add property to enable annotation rendering on Android
  • Loading branch information
madmas authored Apr 29, 2020
2 parents d7789bd + 4b4570b commit 7e6850f
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions AndroidPdfViewer.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ declare class Configurator {
load(): void;
defaultPage(pageNumber: number): this;
pages(...pageNumbers: number[]): this;
enableAnnotationRendering(enable: boolean): this;
enableDoubletap(enable: boolean): this;
enableSwipe(enable: boolean): this;
fitEachPage(enable: boolean): this;
Expand Down
2 changes: 1 addition & 1 deletion demo/app/main-page.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
loaded="pageLoaded">
<FlexboxLayout flexDirection="column">
<Button height="70" text="Show Another!" tap="{{ changePDF }}" />
<pdf:PDFView flexGrow="1" src="{{ pdfUrl }}" load="{{ onLoad }}" />
<pdf:PDFView flexGrow="1" src="{{ pdfUrl }}" load="{{ onLoad }}" enableAnnotationRendering="{{ enableAnnotationRendering }}" />
</FlexboxLayout>
</Page>
1 change: 1 addition & 0 deletions demo/app/main-view-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ export class MainViewModel extends Observable {
}

private current = 0;
private enableAnnotationRendering = true;
}
1 change: 1 addition & 0 deletions pdf-view.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export class PDFView extends PDFViewCommon {
.fromUri(uri)
.onLoad(this.onLoadHandler)
.spacing(defaultSpacingDP)
.enableAnnotationRendering(this.enableAnnotationRendering)
.fitEachPage(true)
.load();
}
Expand Down
2 changes: 2 additions & 0 deletions pdf-view.common.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { Property, View } from 'tns-core-modules/ui/core/view';
export declare abstract class PDFViewCommon extends View {
enableAnnotationRendering: boolean;
static loadEvent: string;
src: string;
static notifyOfEvent(eventName: string, pdfViewRef: WeakRef<PDFViewCommon>): void;
}
export declare const enableAnnotationRenderingProperty: Property<PDFViewCommon, boolean>;
export declare const srcProperty: Property<PDFViewCommon, string>;
11 changes: 11 additions & 0 deletions pdf-view.common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ import * as dialogs from 'tns-core-modules/ui/dialogs';
export abstract class PDFViewCommon extends View {
public static loadEvent = 'load';

/**
* Render annotations (such as comments, colors or forms) on Android
*/
public enableAnnotationRendering: boolean;

/**
* the source url of the PDF to show
*/
Expand All @@ -22,6 +27,12 @@ export abstract class PDFViewCommon extends View {
}
}

export const enableAnnotationRenderingProperty = new Property<PDFViewCommon, boolean>({
name: 'enableAnnotationRendering',
defaultValue: false,
});
enableAnnotationRenderingProperty.register(PDFViewCommon);

export const srcProperty = new Property<PDFViewCommon, string>({
name: 'src',
});
Expand Down

0 comments on commit 7e6850f

Please sign in to comment.