EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: thecyberzone on February 04, 2019, 07:49:11 AM



Title: Display PDF files in a easyui panel
Post by: thecyberzone 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.


Title: Re: Display PDF files in a easyui panel
Post by: stworthy 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>')


Title: Re: Display PDF files in a easyui panel
Post by: thecyberzone 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