Click here to Skip to main content
15,884,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to show loading icon until pdf is loaded into the webpage.I have pasted what I have tried but it doesn't work.

HTML
<div id=container><img src="loading.gif" id="loadingpdf" alt="loading"
   style="display:none;margin:auto;" /><object id="pdf" data='<?php echo $pdf;?
   >#scrollbar=1'type='application/pdf' style="width:100%;height:100%;">
   </object></div>


   $("#loadingpdf").show();
      $("#pdf").hide();

       $('#pdf').load('<?php echo $pdf;?>', function() {
         $("#loadingpdf").hide();
         $("#pdf").show();
       })
Posted

1 solution

In case of blocking UI - the loading animation, you can use WebSocket or Ajax to asynchronously load the PDF file on server side. Once the file is loaded, send message back to Web client to hide the loading icon.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900