We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Pdf viewer ToolbarItems

Hi,
     We are trying to implement pdf viewer to our application and we want to disable right click from the viewer. Somebody please help me out to do that. Also disabling the download and print option from viewer.

1 Reply

AA Akshaya Arivoli Syncfusion Team March 15, 2019 12:22 PM UTC

Hi Jeosebastian 
 
Greetings from Syncfusion, 
 
In our EJ2 PDF Viewer right click will be enabled only the text content in the PDF document is selected. We can disable the text selection by setting false to enableTextSelection
  
The toolbar settings of the PDF Viewer can be set using the toolbarSettings API during control initialization and it contains the following properties: 
  
ShowTooltip: Shows or hides the tooltip of the toolbar items. 
ToolbarItem: Shows or hides the toolbar items in the PDF Viewer toolbar. 
  
Refer to the following to remove print and download icons in toolbar 
HTML: 
<div class="content-wrapper">  
  <ejs-pdfviewer id="pdfViewer" [serviceUrl]='service' [documentPath]='document'  [toolbarSettings]= 'toolbarSettings'  style="height:850px;display:block"></ejs-pdfviewer> 
</div> 
  
TS 
export class AppComponent implements OnInit { 
    public service = 'https://ej2services.syncfusion.com/production/web-services/api/pdfviewer'; 
    public document = 'PDF_Succinctly.pdf';            
              public toolbarSettings = { toolbarItem: 'OpenOption,PageNavigationTool, MagnificationTool, PanTool, SelectionTool, SearchOption'}; 
    ngOnInit(): void {          
  
We have created the sample for the same and shared in the following location, 
  
You can hide the toolbar items form the PDF Viewer toolbar dynamically using the showToolbarItem method. The list of available toolbar items is identified using the ToolbarItem property. Refer to the following code to hide the Open icon from the PDF Viewer toolbar.  
  
window.onload = function () { 
        var pdfViewer = document.getElementById('pdfviewer').ej2_instances[0]; 
        pdfViewer.toolbar.showToolbarItem(new Array("OpenOption"), false); 
    } 
  
Please try this and revert us with more details about your requirement if you have any concerns on this. 
 
 
Regards, 
Akshaya 


Loader.
Up arrow icon