Skip to content

Commit

Permalink
Merge pull request #51 from MyMediaMagnet/L5
Browse files Browse the repository at this point in the history
L5 Update
  • Loading branch information
chonthu committed Feb 20, 2016
2 parents 821e9e2 + 8802ea3 commit d1a0711
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 36 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ In your `config/app.php` add `'Nitmedia\Wkhtml2pdf\L5Wkhtml2pdfServiceProvider'`

'providers' => array(
...
'Nitmedia\Wkhtml2pdf\L5Wkhtml2pdfServiceProvider',
Nitmedia\Wkhtml2pdf\L5Wkhtml2pdfServiceProvider::class,
),

#### L4
Expand All @@ -57,17 +57,17 @@ At the end of `config/app.php` add `'PDF' => 'Nitmedia\Wkhtml2pdf\Facades\Wkh

'aliases' => array(

'App' => 'Illuminate\Support\Facades\App',
'Artisan' => 'Illuminate\Support\Facades\Artisan',
'App' => Illuminate\Support\Facades\App::class,
'Artisan' => Illuminate\Support\Facades\Artisan::class,
...
'PDF' => 'Nitmedia\Wkhtml2pdf\Facades\Wkhtml2pdf',
'PDF' => Nitmedia\Wkhtml2pdf\Facades\Wkhtml2pdf::class,

),

## Configuration
Please set the driver file accoridng to the current OS, Supported drivers include: mac osx, linux 32, linux 64

php artisan config:publish Nitmedia/Wkhtml2pdf
php artisan vendor:publish

### Driver
[wkhtml2pdf][1]
Expand Down
9 changes: 8 additions & 1 deletion src/Nitmedia/Wkhtml2pdf/L5Wkhtml2pdfServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ class L5Wkhtml2pdfServiceProvider extends ServiceProvider
*
* @return void
*/
public function boot()
{
$this->publishes([
__DIR__.'/../../config/config.php' => config_path('Wkhtml2pdf.php')
], 'config');
}

public function register()
{
$this->app['wkhtml2pdf'] = $this->app->share(function($app)
Expand All @@ -33,4 +40,4 @@ public function provides()
{
return array('wkhtml2pdf');
}
}
}
60 changes: 30 additions & 30 deletions src/Nitmedia/Wkhtml2pdf/Wkhtml2pdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,94 +139,94 @@ public function __construct(ConfigInterface $config, ViewInterface $view)
$this->config = $config;
$this->view = $view;

$binpath = $this->config->get('Wkhtml2pdf::binpath');
$binpath = $this->config->get('Wkhtml2pdf.binpath');

if ($binpath)
{
if( $binpath[0] === '/')
{
$this->setBinPath($this->config->get('Wkhtml2pdf::binpath'));
$this->setBinPath($this->config->get('Wkhtml2pdf.binpath'));
}
else
{
$this->setBinPath( realpath(__DIR__) . '/' . $this->config->get('Wkhtml2pdf::binpath'));
$this->setBinPath( realpath(__DIR__) . '/' . $this->config->get('Wkhtml2pdf.binpath'));
}
}

if ($this->config->get('Wkhtml2pdf::binfile'))
if ($this->config->get('Wkhtml2pdf.binfile'))
{
$this->setBinFile($this->config->get('Wkhtml2pdf::binfile'));
$this->setBinFile($this->config->get('Wkhtml2pdf.binfile'));
}

/* Check the binary executable exists */
$this->getBin();

if ($this->config->get('Wkhtml2pdf::html'))
if ($this->config->get('Wkhtml2pdf.html'))
{
$this->setHtml($this->config->get('html'));
}

if ($this->config->get('Wkhtml2pdf::orientation'))
if ($this->config->get('Wkhtml2pdf.orientation'))
{
$this->setOrientation($this->config->get('Wkhtml2pdf::orientation'));
$this->setOrientation($this->config->get('Wkhtml2pdf.orientation'));
}
else
{
$this->setOrientation(self::ORIENTATION_PORTRAIT);
}

if ($this->config->get('Wkhtml2pdf::page_size'))
if ($this->config->get('Wkhtml2pdf.page_size'))
{
$this->setPageSize($this->config->get('Wkhtml2pdf::page_size'));
$this->setPageSize($this->config->get('Wkhtml2pdf.page_size'));
}
else
{
$this->setPageSize(self::SIZE_A4);
}

if ($this->config->get('Wkhtml2pdf::toc'))
if ($this->config->get('Wkhtml2pdf.toc'))
{
$this->setTOC($this->config->get('Wkhtml2pdf::toc'));
$this->setTOC($this->config->get('Wkhtml2pdf.toc'));
}

if ($this->config->get('Wkhtml2pdf::grayscale'))
if ($this->config->get('Wkhtml2pdf.grayscale'))
{
$this->setGrayscale($this->config->get('Wkhtml2pdf::grayscale'));
$this->setGrayscale($this->config->get('Wkhtml2pdf.grayscale'));
}

if ($this->config->get('Wkhtml2pdf::title'))
if ($this->config->get('Wkhtml2pdf.title'))
{
$this->setTitle($this->config->get('Wkhtml2pdf::title'));
$this->setTitle($this->config->get('Wkhtml2pdf.title'));
}

if ($this->config->get('Wkhtml2pdf::debug'))
if ($this->config->get('Wkhtml2pdf.debug'))
{
$this->debug = $this->config->get('Wkhtml2pdf::debug');
$this->debug = $this->config->get('Wkhtml2pdf.debug');
}

if ($this->config->get('Wkhtml2pdf::header_html'))
if ($this->config->get('Wkhtml2pdf.header_html'))
{
$this->setHeaderHtml($this->config->get('Wkhtml2pdf::header_html'));
$this->setHeaderHtml($this->config->get('Wkhtml2pdf.header_html'));
}

if ($this->config->get('Wkhtml2pdf::footer_html'))
if ($this->config->get('Wkhtml2pdf.footer_html'))
{
$this->setFooterHtml($this->config->get('Wkhtml2pdf::footer_html'));
$this->setFooterHtml($this->config->get('Wkhtml2pdf.footer_html'));
}

if ($this->config->get('Wkhtml2pdf::tmppath'))
if ($this->config->get('Wkhtml2pdf.tmppath'))
{
$this->setTmpPath($this->config->get('Wkhtml2pdf::tmppath'));
$this->setTmpPath($this->config->get('Wkhtml2pdf.tmppath'));
}

if ($this->config->get('Wkhtml2pdf::output_mode'))
if ($this->config->get('Wkhtml2pdf.output_mode'))
{
$this->setOutputMode($this->config->get('Wkhtml2pdf::output_mode'));
$this->setOutputMode($this->config->get('Wkhtml2pdf.output_mode'));
}

if ($this->config->get('Wkhtml2pdf::options'))
if ($this->config->get('Wkhtml2pdf.options'))
{
$this->setOptions($this->config->get('Wkhtml2pdf::options'));
$this->setOptions($this->config->get('Wkhtml2pdf.options'));
}
}

Expand Down Expand Up @@ -871,7 +871,7 @@ protected function _render()

$content = $this->_pipeExec($command);

if($this->config->get('Wkhtml2pdf::debug'))
if($this->config->get('Wkhtml2pdf.debug'))
{
dd(array(
'input' => $input,
Expand Down Expand Up @@ -1052,4 +1052,4 @@ public function output($mode, $filename='')

return TRUE;
}
}
}

0 comments on commit d1a0711

Please sign in to comment.