11import * as ReactDOM from 'react-dom' ;
22import * as React from 'react' ;
33import './index.css' ;
4- import { PdfViewerComponent , Toolbar , Magnification , Navigation , LinkAnnotation , BookmarkView ,
5- ThumbnailView , Print , TextSelection , Annotation , TextSearch , FormFields , FormDesigner , Inject } from '@syncfusion/ej2-react-pdfviewer' ;
6- import { ComboBox } from "@syncfusion/ej2-dropdowns" ;
7- import { TextBox } from "@syncfusion/ej2-inputs" ;
8-
4+ import { PdfViewerComponent , Toolbar , Magnification , Navigation , LinkAnnotation , BookmarkView , ThumbnailView , Print , TextSelection , Annotation , TextSearch , FormFields , FormDesigner , PageOrganizer , Inject } from '@syncfusion/ej2-react-pdfviewer' ;
95export function App ( ) {
10-
11- // Add OnCreateSearch outside the App function
12- function OnCreateSearch ( ) {
13- this . addIcon ( 'prepend' , 'e-icons e-search' ) ;
14- }
15-
16- var toolItem1 = {
17- prefixIcon : 'e-icons e-paste' ,
18- id : 'print' ,
19- tooltipText : 'Custom toolbar item' ,
20- } ;
21- var toolItem2 = {
22- id : 'download' ,
23- text : 'Save' ,
24- tooltipText : 'Custom toolbar item' ,
25- align : 'right'
26- } ;
27- var LanguageList = [ 'Typescript' , 'Javascript' , 'Angular' , 'C#' , 'C' , 'Python' ] ;
28- var toolItem3 = {
29- type : 'Input' ,
30- tooltipText : 'Language List' ,
31- cssClass : 'percentage' ,
32- align : 'Left' ,
33- id : 'dropdown' ,
34- template : new ComboBox ( { width : 100 , value : 'TypeScript' , dataSource : LanguageList , popupWidth : 85 , showClearButton : false , readonly : false } )
35- } ;
36- var toolItem4 = {
37- type : 'Input' ,
38- tooltipText : 'Text' ,
39- align : 'Right' ,
40- cssClass : 'find' ,
41- id : 'textbox' ,
42- template : new TextBox ( { width : 125 , placeholder : 'Type Here' , created : OnCreateSearch } )
43- }
44- function toolbarClick ( args ) {
45- var viewer = document . getElementById ( 'container' ) . ej2_instances [ 0 ] ;
46- if ( args . item && args . item . id === 'print' ) {
47- viewer . printModule . print ( ) ;
48- }
49- } ;
506return ( < div >
517 < div className = 'control-section' >
52- < PdfViewerComponent
53- id = "container"
54- documentPath = "https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
55- resourceUrl = "https://cdn.syncfusion.com/ej2/24.1.41/dist/ej2-pdfviewer-lib"
56- toolbarSettings = { { showTooltip : true , toolbarItems : [ toolItem1 , toolItem2 , 'OpenOption' , 'PageNavigationTool' , 'MagnificationTool' , toolItem3 , 'PanTool' , 'SelectionTool' , 'SearchOption' , 'PrintOption' , 'DownloadOption' , 'UndoRedoTool' , 'AnnotationEditTool' , 'FormDesignerEditTool' , toolItem4 , 'CommentTool' , 'SubmitForm' ] } }
57- toolbarClick = { toolbarClick }
58- // By changing value here we can adjust the quality of the pdf
59- printscaleFactor = { 0.5 }
60- style = { { 'height' : '640px' } } >
61- { /* Inject the required services */ }
62- < Inject services = { [ Toolbar , Magnification , Navigation , Annotation , LinkAnnotation , BookmarkView , ThumbnailView ,
63- Print , TextSelection , TextSearch , FormFields , FormDesigner ] } />
64- </ PdfViewerComponent >
8+ < PdfViewerComponent id = "container"
9+ documentPath = "https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
10+ resourceUrl = "https://cdn.syncfusion.com/ej2/27.1.48/dist/ej2-pdfviewer-lib"
11+ style = { { 'height' : '640px' } }
12+ /* By changing the value of the pringScale Factor we can adjust the quality of the PDF file*/
13+ printScaleFactor = { 0.5 }
14+ >
15+ < Inject services = { [ Toolbar , Magnification , Navigation , Annotation , LinkAnnotation , BookmarkView , ThumbnailView , Print , TextSelection , TextSearch , FormFields , FormDesigner , PageOrganizer ] } />
16+ </ PdfViewerComponent >
6517 </ div >
6618</ div > ) ;
19+
6720}
21+
6822const root = ReactDOM . createRoot ( document . getElementById ( 'sample' ) ) ;
6923root . render ( < App /> ) ;
0 commit comments