On button click show pdf viewer in new window or page

Hello,
On Print button click, I want to show pdfviewer on new page or window. Please refer to my code snippet (index3.html) attached below & make changes accordingly.
Thanks
Rahul Kumar

Attachment: RRR__Copy_(PHASE_1)_317bdda2.zip

3 Replies 1 reply marked as answer

VS Vasugi Sivajothi Syncfusion Team January 5, 2021 05:51 PM UTC

Hi Rahul Kumar,   
  
Thanks for contacting Syncfusion support. 

In our PdfViewer, when clicking on the print button, it shows the pdfviewer on the new window by using the following code snippet.

Code Snippet:    
 
viewer.printMode = "NewWindow";   
 
 
Please refer to the sample,  
Kindly try it and revert us with more details if you need further assistance.    
Regards, 
  
Vasugi 
  



RK Rahul Kumar January 6, 2021 07:06 AM UTC

Hello sir,

It does not work. Please refer to my code snippet attached along & make changes accordingly.

Thanks 
Rahul Kumar

Attachment: RL_Load_9ba79ef3.zip


VS Vasugi Sivajothi Syncfusion Team January 7, 2021 02:10 PM UTC

Hi Rahul Kumar, 
 
As we analyzed, the requirement is to open the PDF Viewer in print click action. So we have modified the sample in which you have shared. Please refer to that sample and code snippet. 
 
 
Code Snippet: 
var ws = window.open("", '_blank', "width=800,height=600,location=no,menubar=no,status=no,titilebar=no,resizable=no") 
                //Adding script and CSS files 
                ws.document.write('<!DOCTYPE html><html><head><title>PdfViewer</title><link rel='nofollow' href = "https://cdn.syncfusion.com/ej2/18.4.33/material.css" rel = "stylesheet"><script src="https://cdn.syncfusion.com/js/assets/external/jquery-3.1.1.min.js"><\/script><script src="https://cdn.syncfusion.com/ej2/18.4.33/dist/ej2.min.js"><\/script><\/head><body>'); 
                //Div to render PDF Viewer 
                ws.document.write('<div style="width:100%;min-height:570px"><div id="PdfViewer"></div><\/div>') 
                //Initializes the PDF Viewer 
                ws.document.write("<script> var pdfviewer = new ej.pdfviewer.PdfViewer({documentPath:'PDF_Succinctly.pdf',serviceUrl: 'https://ej2services.syncfusion.com/production/web-services/api/pdfviewer'});pdfviewer.appendTo('#PdfViewer');<\/script>") 
                ws.document.write('<\/body><\/html>'); 
                ws.document.close();    
 
Kindly try it and revert us with more details if you have any concerns on this.  
 
Regards, 
Vasugi

Marked as answer
Loader.
Up arrow icon