EasyUI Forum
October 17, 2025, 01:25:47 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Display PDF files in a easyui panel  (Read 8995 times)
thecyberzone
Full Member
***
Posts: 176



View Profile Email
« on: February 04, 2019, 07:49:11 AM »

I want to display content of a PDF file (name of which will be passed programmatically) within a panel. If I load the same PDF file in a browser tab, it is visible successfully, but whenever I use refresh method of the easyui panel component to load the content of any PDF file, it shows garbage of ascii dump, not the formatted content.

Please let me know how can I get any PDF files content displayed within a easyui panel component.

Thanks.
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: February 04, 2019, 06:42:22 PM »

You can change the panel's html content to switch the pdf files.
Code:
<div id="p" class="easyui-panel" title="Panel" style="width:700px;height:300px;padding:10px;">

<embed width="800" height="600" src="test.pdf"></embed>

</div>

Call this line to change the pdf content.
Code:
$('#p').empty().html('<embed width="800" height="600" src="test2.pdf"></embed>')
Logged
thecyberzone
Full Member
***
Posts: 176



View Profile Email
« Reply #2 on: February 04, 2019, 11:09:47 PM »

I have tried using following code, but PDF is not displayed.

$('#main').panel('refresh',main); where main variable stores the PDF file name.

Now, I have changed the as follows and it works.

$('#main').empty().html('<embed src="report.pdf"></embed>')

Thanks
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!