|
| 1 | +<template> |
| 2 | + <div id="app"> |
| 3 | + <button v-on:click="extractPage">Extract Page</button> |
| 4 | + <ejs-pdfviewer |
| 5 | + id="pdfViewer" |
| 6 | + ref="pdfviewer" |
| 7 | + :resourceUrl="resourceUrl" |
| 8 | + :documentPath="documentPath" |
| 9 | + :pageOrganizerSettings="pageOrganizerSettings"> |
| 10 | + </ejs-pdfviewer> |
| 11 | + </div> |
| 12 | +</template> |
| 13 | +<script> |
| 14 | +import { PdfViewerComponent, Toolbar, Magnification, Navigation, LinkAnnotation, |
| 15 | + BookmarkView, Annotation, ThumbnailView, Print, TextSelection, |
| 16 | + TextSearch, FormFields, FormDesigner, PageOrganizer } from '@syncfusion/ej2-vue-pdfviewer'; |
| 17 | +export default { |
| 18 | + name: 'app', |
| 19 | + components: { |
| 20 | + "ejs-pdfviewer": PdfViewerComponent |
| 21 | + }, |
| 22 | + data () { |
| 23 | + return { |
| 24 | + resourceUrl:"https://cdn.syncfusion.com/ej2/31.1.23/dist/ej2-pdfviewer-lib", |
| 25 | + documentPath:"https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf", |
| 26 | + pageOrganizerSettings: {canExtractPages: true} |
| 27 | + }; |
| 28 | + }, |
| 29 | + methods: { |
| 30 | + extractPage: function() { |
| 31 | + const viewer = this.$refs.pdfviewer.ej2Instances; |
| 32 | + //Extract Pages 1 and 2 |
| 33 | + const array = viewer.extractPages('1,2'); |
| 34 | + //Load extracted Pages |
| 35 | + viewer.load(array,''); |
| 36 | + //Print Base64 to ensure pages are extracted |
| 37 | + console.log(array); |
| 38 | + } |
| 39 | + }, |
| 40 | +
|
| 41 | + provide: { |
| 42 | + PdfViewer: [ Toolbar, Magnification, Navigation, LinkAnnotation, BookmarkView, ThumbnailView, |
| 43 | + Print, TextSelection, TextSearch, Annotation, FormFields, FormDesigner, PageOrganizer ]}, |
| 44 | +
|
| 45 | +} |
| 46 | +</script> |
| 47 | + |
| 48 | +<style> |
| 49 | + @import "../node_modules/@syncfusion/ej2-base/styles/material.css"; |
| 50 | + @import "../node_modules/@syncfusion/ej2-buttons/styles/material.css"; |
| 51 | + @import "../node_modules/@syncfusion/ej2-dropdowns/styles/material.css"; |
| 52 | + @import "../node_modules/@syncfusion/ej2-inputs/styles/material.css"; |
| 53 | + @import "../node_modules/@syncfusion/ej2-navigations/styles/material.css"; |
| 54 | + @import "../node_modules/@syncfusion/ej2-popups/styles/material.css"; |
| 55 | + @import "../node_modules/@syncfusion/ej2-splitbuttons/styles/material.css"; |
| 56 | + @import "../node_modules/@syncfusion/ej2-vue-pdfviewer/styles/material.css"; |
| 57 | +</style> |
0 commit comments