Thursday, April 1, 2010

Moving a div with JScript

To view the tutorial go to this url:

Moving a div with Javascript

Simple Html 2 pdf using php

The following is a nice alternative for those who need to generate dynamic PDF documents on-the-go. This class does not require any PDF extensions to be loaded in the PHP configuration.

The class is simple to load and use right away. You can find the class and it’s documentation on it’s website here: http://html2fpdf.sourceforge.net/

It is based upon (F)PDF which you can find here: http://www.fpdf.org/

You can download a usable version directly from here

The purpose of this class is to make the creation of PDF documents from HTML formatting easier, and it does the job fairly well. It seems to understand many of the most important HTML elements, as well as some CSS.

An example of simple usage:



Create a new page with text like hello world, test and save it as test.php

SetTopMargin(1);
$pdf->AddPage();
$pdf->WriteHTML($html);
$pdf->Output('test.pdf','D');
?>

to view details tutorials at - http://thronic.com/2008/development/simple-html-2-pdf-using-php/

PHP Export Excell without saving a file

A simple way of exporting data to the web in excel format, you don’t have to create an excel file, you just have to define the proper headers for the browser.

First define a filename, and headers.

$filename = "test.xls";
header("Content-Disposition: attachment; filename=\"$filename\"");
header("Content-Type: application/vnd.ms-excel");

Now just send the clear text data you want the excel file to contain, use “\n” and “\t” for row and column navigation.

For example:

echo "column1 \t column2\n";
echo "row1 value1" . "\t" . "row1 value2\n";
echo "row2 value1" . "\t" . "row2 value2";
exit(); //remember to stop output unless you do it its own file.

Click the link below to see how the export of this data would look like.

http://thronic.com/pubfiles/export_excel_example.php

courtesy: Dag J. Nedrelid

Followers