1. Go to this page and download the library: Download anam/phantommagick library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
$conv = new \Anam\PhantomMagick\Converter();
$conv->source('http://google.com')
->toPdf()
->save('/your/destination/path/google.pdf');
use Anam\PhantomMagick\Converter;
$conv = new Converter();
$conv->addPage('<html><body><h1>Welcome to PhantomMagick</h1></body></html>')
->addPage('http://facebook.com')
->addPage('/html/file/from/local/drive/example.html')
->save('/your/destination/path/multipage.pdf');
$conv = new \Anam\PhantomMagick\Converter();
$conv->source('http://google.com')
->toPng()
->save('/your/destination/path/google.png');
$conv->toPng()
$conv->toJpg()
$conv->toGif()
use Anam\PhantomMagick\Converter;
Converter::make('http://google.com')
->toPdf()
->download('google.pdf');
Converter::make('http://yahoo.com')
->toPng()
->download('yahoo.png');
use Anam\PhantomMagick\Converter;
use Dropbox\Client;
$client = new Client('DROPBOX_TOKEN', 'DROPBOX_APP');
$conv = new Converter();
$conv->adapter($client)
->source('https://google.com')
->toPdf()
->save('dropbox_example.pdf');
use Anam\PhantomMagick\Converter;
use OpenCloud\OpenStack;
use OpenCloud\Rackspace;
$client = new OpenStack(Rackspace::US_IDENTITY_ENDPOINT, array(
'username' => 'RACKSPACE_USERNAME',
'password' => 'RACKSPACE_PASSWORD'
));
$store = $client->objectStoreService('cloudFiles', 'SYD');
$container = $store->getContainer('phantom-magick');
$conv = new Converter();
$conv->adapter($container)
->source('https://google.com')
->toPdf()
->save('rackspace_example.pdf');
new Converter('/Path/to/file/example.html');
// or
Converter::make('/Path/to/file/example.html');
//or
$conv->source('/Path/to/file/example.html');
// or
$conv->source('http://google.com');