Posts

Showing posts from July, 2015

[SOLVED] Issue - Image faded view, only in browser

Image
Issue
In some cases, the images will appear properly in "image viewer" software, but in browser it will appear with the faded effect.
For Ex:
The Pic1 shows the same image file with different appearance in browser and the image viewer software.

Reason
The image file's meta data missed the color Profile. So, the PC will automatically apply the sRGB profile. But, the browser can not apply the color profile by default (Except Internet Explorer).

Solution
We've to embed the color profile to the file.

How?
It is possible by ImageMagick shell script.

Step #1:
Download the expected color profile from the link.

Step #2:
Save the color profile in your system (Ex.: /opt/tmp/sRGB_v4_ICC_preference_displayclass.icc)

Step #3:
Execute the following shell command in the terminal

convert <filename> -profile /opt/tmp/sRGB_v4_ICC_preference_displayclass.icc <destination>
For example
convert /opt/tmp/umbrella.jpg -profile /opt/tmp/sRGB_v4_ICC_preference_displayclass.icc /opt/tmp…

HTML page to PDF conversion - Codeigniter library

Step #1 Download the library from the URL
https://github.com/iamfiscus/Codeigniter-DOMPDF/archive/master.zip

Step #2 Unzip the master

Step #3 There will be three folders

a) controllers
b) libraries
c) third_party

copy all these folders to <your application path>/application/ folder

Step #4 Create a view file and name it "welcome_message" and type some HTML content there

Step #5 There will be the sample controller. Access the controller by
http://localhost/<your project name>/demopdf_test


Step #6 Now the pdf file will be downloaded



Source:https://imron02.wordpress.com/2013/11/20/create-pdf-in-codeigniter-part-ii/?blogsub=confirming#blog_subscription-3

HTML Table to Excel file - Export

The following code will convert the HTML Table to Excel file


<table id="headerTable">
<tr>
<th>Sl.No</th>
<th>Name</th>
</tr>
<tr>
<td>1</td>
<td>Raja</td>
</tr>
<tr>
<td>2</td>
<td>Kannan</td>
</tr>
<tr>
<td>3</td>
<td>Harish</td>
</tr>
</table>

<button id="btnExport" onclick="tableToExcel('headerTable');"> EXPORT </button>
<iframe id="txtArea1" style="display:none"></iframe> <!-- THIS IFRAME IS REQUIRED -->
<script>
function tableToExcel(tblId)
{
    var tab_text="<table border='2px'><tr bgcolor='#87AFC6'>";
    var textRange; var j=0;
    tab = document.getElementById(tblId); // id of table

    for(j = 0 ; j < tab.rows.length ; j++) 
    {     
        tab_text=tab_text+tab.rows[j].innerHTML+"</tr>";
        …