|
Wednesday, May 18, 2011, 02:46 PM
Posted by Administrator
Wkhtmltopdf is a command line utility that can be used to convert a webpage / html to PDF. Here is how it works…Posted by Administrator
Suppose I want to convert this website home page to a PDF document, I can fire up a terminal and run the wkhtmltopdf command as follows.
$ wkhtmltopdf linuxandfriends.com linuxandfriends.pdf
This will download the linuxandfriends.com webpage, convert it to pdf and save it as linuxandfriends.pdf in the same directory from which the command was run.
To add a table of contents to the pdf document, use the -t option.
$ wkhtmltopdf -t linuxandfriends.com linuxandfriends.pdf
To get the pdf in landscape instead of portrait (which is the default) use -O option.
$ wkhtmltopdf -O landscape linuxandfriends.com linuxandfriends.pdf
wkhtmltopdf command line utility has a lot more options which can be viewed by running the command using --help.
$ wkhtmltopdf --help
For example, you can add headers and footers to your pdf output, change the font in which text is rendered and so on. wkhtmltopdf command line utility converts html to pdf using webkit (qtwebkit). This nifty tool is available for Windows, Linux and Mac OS X platforms. Download wkhtmltopdf from its home page.
Running it via a cronjob to periodically converting some system reports from HTML format (created by some applications) into PDF is also possible. I’m using a Debian (squeeze) version which requires a X11 server, thus the conversion failed (running it from a cronjob does not have access to a X server). Luckily there is a workaround: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=580226 All I need is a virtual X server (xvfb) which is available in Debian.
Just run it like the following:
$ xvfb-run wkhtmltopdf ...
add comment
( 4 views )
| permalink
| 



( 3 / 406 )




( 3 / 406 )
|
|
Wednesday, December 8, 2010, 11:02 AM
Posted by Administrator
This is by far the best explanation I have ever found on running PHP from crontabs. Enjoy....Posted by Administrator
Cron is normally available on all Unix and Linux distributions; if you cannot access it, contact your root or server administrator. It is a daemon which allows you to schedule a program or script for a specific time of execution.
http://techgurulive.com/2008/12/19/how- ... t-on-cron/
|
|
Wednesday, November 17, 2010, 10:11 AM - General
Posted by Administrator
This article explains how to center a DIV block, whether it contains additional divs, text, graphics, or a mixture of all, using Cascading Style Sheets (CSS). Posted by Administrator
This article will assume that you have some basic knowledge of how to write HTML and CSS.
Let's start with a div block as follows:
<div id="content">
This is a DIV block we want centered on the page.
</div>
Many people have attempted to use the "text-align: center ;" CSS rule to solved this problem. However, use of this method centers the text inside the DIV block, rather than the block itself.
My intention here is to center the entire block but leave the internal contents formatted as it was before. As such, the above code is not what we want.
Instead, this method for centering a block in CSS will achieve the desired result:
1. Specify a width for the DIV block.
2. Set both its left and right margins to auto.
Both steps are necessary, you cannot just set the margins to auto without specifying the width of the block and expect this method to work.
The method works because when both margins are set to auto, web browsers are required by the CSS standard to give them equal width.
For example, if you want your div block to have a width of 900 pixels, the following code will center the block.
#content {
width: 700px ;
margin-left: auto ;
margin-right: auto ;
}
Note that the width doesn't need to be in pixels. Other units like em or percentage will work just as well.
Browser Support
The method above has been tested with IE 6, 7, Firefox, Opera and Safari.
|
|
Monday, November 8, 2010, 04:19 PM - Ubuntu
Posted by Administrator
PHP Email SetupPosted by Administrator
Before we can send email with PHP, we need to set it up to do so, just as you need to set up your email program before it can send messages. Configuration for sending email in PHP is done with the php.ini file, so open up your Web server's php.ini in whichever editor you normally use.
If you don't run your own server, but instead have a PHP-equipped Web host, you can safely assume that everything in this section has been done for you, and skip ahead.
In the section entitled [mail function] in the php.ini file, you'll find three settings: SMTP, sendmail_from, and sendmail_path. If your server runs on a Windows machine, you'll want to set the SMTP option to point to your SMTP server (or your ISP's SMTP server, if you're setting up PHP on your home machine). If instead you're setting up PHP on a Linux (or other Unix-based OS) server, you'll want to set the sendmail_path option to point to the sendmail program on your server, passing it the -t option. You can use the SMTP option in Linux instead if you don't have sendmail set up.
In either case, you'll want to set the sendmail_from option to your email address, or whichever address you'd like to appear as the default 'from' address for emails sent from PHP scripts.
Here's how it might look on a Linux server with sendmail:
[mail function]
; Setup for Linux systems
sendmail_path = /usr/sbin/sendmail -t
sendmail_from = me@myserver.com
With those settings in place, restart your Web server and you're ready to go!
Sources: http://www.sitepoint.com/article/advanced-email-php
|
|
Monday, August 30, 2010, 12:16 PM - Other
Posted by Administrator
The wget command supports use of a username and password for both FTP and HTTP file transfer.Posted by Administrator
Use following options with wget command:
--user=userName: Your FTP/HTTP username
--password=passWord : Your HTTP/FTP password
These parameters can be overridden using the --ftp-user and --ftp-password options for FTP connections and the --http-user and --http-password options for HTTP connections.
Download a file called example.pdf from data.geekisland.org:
$ wget --user=myusername --password='myPassword' http://data.geekisland.org/protected/ar ... xample.pdf
|

Archives



