How to call methods on Injected modules in Vue.js library SyncFusion


I am using pdf viewer component from syncfusion:https://ej2.syncfusion.com/documentation/pdfviewer/getting-started/
I Injected some
modules, but I need to call some methods on them, how can I achieve this in Vue.js using typescript?

In main.ts I have:

import {
    PdfViewer,
    Toolbar,
    Magnification,
    Navigation
} from '@syncfusion/ej2-pdfviewer';

PdfViewer.Inject(
    PdfViewer,
    Toolbar,
    Magnification,
    Navigation
);

Then in other component I have pdf viewer component and want to call some methods on injected Modules for example method of Navigation, go to next page Navigation API.

in Viewer.vue I have:

<template>
        <ejs-pdfviewer
            id="pdfViewer"
            ref="pdfViewerRef"
            @loadstart="documentLoad"
            @formFieldAdd="signatureAdd"
            :serviceUrl="serviceUrl"
            :documentLoad="documentLoad"
            :documentLoadFailed="documentLoadFailed"
            :enableToolbar="true"
            :enableCustomStamp="false"
            :enablePrint="false"
            :enableNavigation="true"
            :enableAnnotation="true"
            :enableThumbnail="true"
            :enableFormFields="true"
            :isThumbnailViewOpen="false"
            :enableNavigationToolbar="true"
            :enableAnnotationToolbar="false"
            :enableFormDesignerToolbar="true"
            :enableHandwrittenSignature="true"
            isSignatureEditable="true"
        >
        </ejs-pdfviewer>
</template>

import {
    Navigation,
} from '@syncfusion/ej2-pdfviewer';
<script lang="ts">
.
.
.

methods: {
   // want to achieve something like this
   goToNextPage() {
      Navigation.goToNextPage();
   }
}

</script>

simply I need to call some methods on Injected modules. Thank you for help. Code is simplyfied, but the idea is clear.

Source: Vue – Stack Overflow

August 17, 2021
Category : News
Tags: ej2-syncfusion | pdf-viewer | syncfusion | typescript | Vue.js

Leave a Reply

Your email address will not be published. Required fields are marked *

Sitemap | Terms | Privacy | Cookies | Advertising

Senior Software Developer

Creator of @LzoMedia I am a backend software developer based in London who likes beautiful code and has an adherence to standards & love's open-source.