I need to display all students detail in the table format while clicking the "Print" link in my web page. Users may print these records in this page. It may have several thousands of records.
Because of this, it took more time to load. Is it possible to load records page by page? Or am i need to do any other thing to reduce the loading time?
Please advice.
Note: I have optimized my code as much as possible as per the Google search.
I would install wkhtmltopdf, I would use a html template, then generate a pdf file using the html template when changes are made to the list, and download that file when needed.
This way, you save processing power, and the users download the same file.
Also, by doing so, most browsers know how to render a pdf file without downloading it
Yes, using CPagination class
You have an example in that Doc page.
You will have to paginate the records, if they are in DB, Yii will instruct the db engine to only retrieve the records in a range, making it efficiently.
Related
Is it possible, using PHP, to display an individual pages from a pdf file. For example if I have a 5 page pdf file and I wish to display only the n-th page?
I did some google searching on this but nothing useful came up really, so I wonder if it's possible at all.
Thank,
My page will have a lot of images, which will take a lot of time to load and will make it very slow, so my question is
how to make the page to download and display only the pictures that are being shown in front of you, exactly the same as performing image search with google, whenever you scroll it will keep downloading and displaying the focused images.
Thanks all.
Image lazy loading
eg Lazy Load Plugin for jQuery (http://www.appelsiini.net/projects/lazyload)
Demo: http://speckyboy.com/demo/lazy/index.html
Use ajax, you can easily detect the view port by javascript and the images dimensions, so when scrolling, all you have is to send request to populate more rows of the view, this could be tables or div.
You can't do something like that in PHP.
It has be done in JQuery.
There is a plugin that does what you need, called Lazy Load.
Take a look on this site: http://www.appelsiini.net/projects/lazyload
From last 6 hours trying best to show progress bar wile pdf is generated in TCPDF but not successful.
I am using TCPDF API for HTML to PDF generation, But the problem is that while generating the PDF we can't use custom javascript, Can we show progress bar while PDF is generated?
Any idea please?
I am not sure why you say "can't use custom javascript". If you just want a "loading icon" yoy should do this
- show loading icon (from js)
- ajax request to php file that generates the pdf into a server file
- on success you get a link to a generated pdf.
(for this solution you might try some estimation based on how large would be the generated file)
If you want an accurate progressive, you should add some estimation on php file. Let's say when you generate the pdf you know how many pages you will generate and each "addPage" command you save the status of completeness in a file or a memcached key. On you JavaScript side you call a file each second that reads that status of completeness.
No.
Even if you were able to use custom javascript, it would not be possible to get an accurate prediction of the time it will take to generate the document and therefore diplay progress - but it would be possible to get an estimate (based on extensive benchmarking). But in order to display the progress bar you'd need custom javascript and to change the processing to decouple the threads on the browser and server. This is discussed more in this question (which IMHO is not a duplicate of the post referenced).
I am wondering if there is a way to include a playlist as a variable or link to an external file in Flowplayer. I know that you can use RSS playlists, but I need to use the start and duration parameters to combine clips into a single stream and am not sure that those can be used with RSS playlists.
I would like to be able to keep my playlist external from the player if possible, so that it is easier to manage. What I am trying to do is have a player and several buttons on my page. The buttons each cause a different playlist to be played. I have everything worked out up until the point of actually inserting the playlist.
Right now I am simply writing the content of my playlist file to the player page using a search and replace, but I am hoping there is a better way.
Thank you for reading my post.
You can use an array of JSON objects that can be loaded even by AJAX.
You can also use an external configuration file, that can be generated by PHP itself.
Here are some help links:
http://flowplayer.org/demos/configuration/external.html
http://flowplayer.org/documentation/configuration/playlists.html
http://flowplayer.org/plugins/javascript/playlist.html
I have a web application something like image gallery for the user with carousel at the bottom of the application. I was thinking of
a scenario for example what if the user uploaded 1000 images on the application image gallery.
I was just wandering what is the proper way or technique to load 1000 images that is fast so that the user can view it immediately.
Please help me.
1000 images is a lot. I would definitely not load them all at once, but rather in batches somehow. Kind of like Facebook does (I think). It fills up the view, and when you scroll down it keeps loading more, but only as you scroll down. Could also simplify it by using a "Load more"-button.
If it really is a carousel as you say, I would expect it to only show a certain number of images. In that case I would just load the ones visible and for example twice that in a buffer. Then when the user goes to the next page you can replace the current ones with the first ones in the buffer and load some more into the buffer.
Loading 1000 images at one time would be a ridiculous waste of bandwidth, not to mention it would cause major lag for the client. Some client-side JavaScript/jQuery would be required rather than PHP to load the images dynamically as the user scrolls through them, so no more resources/images are requested than needed at the specific time, say 10 at a time. Using the .click() event in jQuery on an element and checking for the end of the 'carousel' so to speak, and then using something like $("#element").attr("src", "imagePath.jpg"); to swap the images shown on the carousel should work.