mirror of
https://gitlab.com/signalytic/client-external/streamline/streamline-emr.git
synced 2026-09-11 18:51:31 +00:00
Import latest app updates from streamline
An updated set of source files and initialization was provided by streamline to address issues observed during initial testing. These files have been updated in order to generate a new set of app images.
This commit is contained in:
-16
@@ -1,16 +0,0 @@
|
||||
<?php
|
||||
namespace Barryvdh\Snappy\Facades;
|
||||
|
||||
use Illuminate\Support\Facades\Facade as BaseFacade;
|
||||
|
||||
class SnappyImage extends BaseFacade {
|
||||
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor() { return 'snappy.image.wrapper'; }
|
||||
|
||||
|
||||
}
|
||||
-40
@@ -1,40 +0,0 @@
|
||||
<?php
|
||||
namespace Barryvdh\Snappy\Facades;
|
||||
|
||||
use Illuminate\Support\Facades\Facade as BaseFacade;
|
||||
use Barryvdh\Snappy\PdfFaker;
|
||||
|
||||
|
||||
/**
|
||||
* @method static \Barryvdh\Snappy\PdfWrapper setPaper($paper, $orientation = 'portrait')
|
||||
* @method static \Barryvdh\Snappy\PdfWrapper setWarnings($warnings)
|
||||
* @method static \Barryvdh\Snappy\PdfWrapper setOptions(array $options)
|
||||
* @method static \Barryvdh\Snappy\PdfWrapper loadView($view, $data = array(), $mergeData = array(), $encoding = null)
|
||||
* @method static \Barryvdh\Snappy\PdfWrapper loadHTML($string, $encoding = null)
|
||||
* @method static \Barryvdh\Snappy\PdfWrapper loadFile($file)
|
||||
* @method static string output($options = [])
|
||||
* @method static \Barryvdh\Snappy\PdfWrapper save()
|
||||
* @method static \Illuminate\Http\Response download($filename = 'document.pdf')
|
||||
* @method static \Illuminate\Http\Response inline($filename = 'document.pdf')
|
||||
*
|
||||
*/
|
||||
class SnappyPdf extends BaseFacade {
|
||||
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor() { return 'snappy.pdf.wrapper'; }
|
||||
|
||||
/**
|
||||
* Replace the bound instance with a fake.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function fake()
|
||||
{
|
||||
static::swap(new PdfFaker(app('snappy.pdf')));
|
||||
}
|
||||
|
||||
}
|
||||
-104
@@ -1,104 +0,0 @@
|
||||
<?php namespace Barryvdh\Snappy;
|
||||
|
||||
use Knp\Snappy\Image;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
|
||||
class IlluminateSnappyImage extends Image {
|
||||
|
||||
/**
|
||||
* @param \Illuminate\Filesystem\Filesystem
|
||||
* @param string $binary
|
||||
* @param array $options
|
||||
*/
|
||||
public function __construct(Filesystem $fs, $binary, array $options, array $env)
|
||||
{
|
||||
parent::__construct($binary, $options, $env);
|
||||
|
||||
$this->fs = $fs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper for the "file_get_contents" function
|
||||
*
|
||||
* @param string $filename
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getFileContents($filename)
|
||||
{
|
||||
return $this->fs->get($filename);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper for the "file_exists" function
|
||||
*
|
||||
* @param string $filename
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
protected function fileExists($filename)
|
||||
{
|
||||
return $this->fs->exists($filename);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper for the "is_file" method
|
||||
*
|
||||
* @param string $filename
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
protected function isFile($filename)
|
||||
{
|
||||
return $this->fs->isFile($filename);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper for the "filesize" function
|
||||
*
|
||||
* @param string $filename
|
||||
*
|
||||
* @return integer or FALSE on failure
|
||||
*/
|
||||
protected function filesize($filename)
|
||||
{
|
||||
return $this->fs->size($filename);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper for the "unlink" function
|
||||
*
|
||||
* @param string $filename
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
protected function unlink($filename)
|
||||
{
|
||||
return $this->fs->delete($filename);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper for the "is_dir" function
|
||||
*
|
||||
* @param string $filename
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
protected function isDir($filename)
|
||||
{
|
||||
return $this->fs->isDirectory($filename);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper for the mkdir function
|
||||
*
|
||||
* @param string $pathname
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
protected function mkdir($pathname)
|
||||
{
|
||||
return $this->fs->makeDirectory($pathname, 0777, true, true);
|
||||
}
|
||||
|
||||
}
|
||||
-108
@@ -1,108 +0,0 @@
|
||||
<?php namespace Barryvdh\Snappy;
|
||||
|
||||
use Knp\Snappy\Pdf;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
|
||||
class IlluminateSnappyPdf extends Pdf {
|
||||
/**
|
||||
* @var \Illuminate\Filesystem\Filesystem
|
||||
*/
|
||||
protected $fs;
|
||||
|
||||
/**
|
||||
* @param \Illuminate\Filesystem\Filesystem
|
||||
* @param string $binary
|
||||
* @param array $options
|
||||
*/
|
||||
public function __construct(Filesystem $fs, $binary, array $options, array $env)
|
||||
{
|
||||
parent::__construct($binary, $options, $env);
|
||||
|
||||
$this->fs = $fs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper for the "file_get_contents" function
|
||||
*
|
||||
* @param string $filename
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getFileContents($filename)
|
||||
{
|
||||
return $this->fs->get($filename);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper for the "file_exists" function
|
||||
*
|
||||
* @param string $filename
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
protected function fileExists($filename)
|
||||
{
|
||||
return $this->fs->exists($filename);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper for the "is_file" method
|
||||
*
|
||||
* @param string $filename
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
protected function isFile($filename)
|
||||
{
|
||||
return strlen($filename) <= PHP_MAXPATHLEN && $this->fs->isFile($filename);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper for the "filesize" function
|
||||
*
|
||||
* @param string $filename
|
||||
*
|
||||
* @return integer or FALSE on failure
|
||||
*/
|
||||
protected function filesize($filename)
|
||||
{
|
||||
return $this->fs->size($filename);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper for the "unlink" function
|
||||
*
|
||||
* @param string $filename
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
protected function unlink($filename)
|
||||
{
|
||||
return $this->fs->delete($filename);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper for the "is_dir" function
|
||||
*
|
||||
* @param string $filename
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
protected function isDir($filename)
|
||||
{
|
||||
return $this->fs->isDirectory($filename);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper for the mkdir function
|
||||
*
|
||||
* @param string $pathname
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
protected function mkdir($pathname)
|
||||
{
|
||||
return $this->fs->makeDirectory($pathname, 0777, true, true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,199 +0,0 @@
|
||||
<?php namespace Barryvdh\Snappy;
|
||||
|
||||
use Illuminate\Http\Response;
|
||||
use Knp\Snappy\Image as SnappyImage;
|
||||
use Illuminate\Support\Facades\View;
|
||||
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||
|
||||
/**
|
||||
* A Laravel wrapper for SnappyImage
|
||||
*
|
||||
* @package laravel-snappy
|
||||
* @author Killian Blais
|
||||
*/
|
||||
class ImageWrapper {
|
||||
|
||||
/**
|
||||
* @var \Knp\Snappy\Image
|
||||
*/
|
||||
protected $snappy;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $options = array();
|
||||
|
||||
|
||||
/**
|
||||
* @param \Knp\Snappy\Image $snappy
|
||||
*/
|
||||
public function __construct(SnappyImage $snappy)
|
||||
{
|
||||
$this->snappy = $snappy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Snappy instance.
|
||||
*
|
||||
* @return \Knp\Snappy\Image
|
||||
*/
|
||||
public function snappy()
|
||||
{
|
||||
return $this->snappy;
|
||||
}
|
||||
|
||||
public function setOption($name, $value)
|
||||
{
|
||||
$this->snappy->setOption($name, $value);
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setOptions($options)
|
||||
{
|
||||
$this->snappy->setOptions($options);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load a HTML string
|
||||
*
|
||||
* @param string $string
|
||||
* @return static
|
||||
*/
|
||||
public function loadHTML($string)
|
||||
{
|
||||
$this->html = (string) $string;
|
||||
$this->file = null;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load a HTML file
|
||||
*
|
||||
* @param string $file
|
||||
* @return static
|
||||
*/
|
||||
public function loadFile($file)
|
||||
{
|
||||
$this->html = null;
|
||||
$this->file = $file;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function loadView($view, $data = array(), $mergeData = array())
|
||||
{
|
||||
$this->html = View::make($view, $data, $mergeData)->render();
|
||||
$this->file = null;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Output the PDF as a string.
|
||||
*
|
||||
* @return string The rendered PDF as string
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function output()
|
||||
{
|
||||
if ($this->html)
|
||||
{
|
||||
return $this->snappy->getOutputFromHtml($this->html, $this->options);
|
||||
}
|
||||
|
||||
if ($this->file)
|
||||
{
|
||||
return $this->snappy->getOutput($this->file, $this->options);
|
||||
}
|
||||
|
||||
throw new \InvalidArgumentException('Image Generator requires a html or file in order to produce output.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the image to a file
|
||||
*
|
||||
* @param $filename
|
||||
* @return static
|
||||
*/
|
||||
public function save($filename, $overwrite = false)
|
||||
{
|
||||
|
||||
if ($this->html)
|
||||
{
|
||||
$this->snappy->generateFromHtml($this->html, $filename, $this->options, $overwrite);
|
||||
}
|
||||
elseif ($this->file)
|
||||
{
|
||||
$this->snappy->generate($this->file, $filename, $this->options, $overwrite);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make the image downloadable by the user
|
||||
*
|
||||
* @param string $filename
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*/
|
||||
public function download($filename = 'image.jpg')
|
||||
{
|
||||
return new Response($this->output(), 200, array(
|
||||
'Content-Type' => 'image/jpeg',
|
||||
'Content-Disposition' => 'attachment; filename="'.$filename.'"'
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a response with the image to show in the browser
|
||||
*
|
||||
* @param string $filename
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function inline($filename = 'image.jpg')
|
||||
{
|
||||
return new Response($this->output(), 200, array(
|
||||
'Content-Type' => 'image/jpeg',
|
||||
'Content-Disposition' => 'inline; filename="'.$filename.'"',
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a response with the image to show in the browser
|
||||
*
|
||||
* @deprecated Use inline() instead
|
||||
* @param string $filename
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*/
|
||||
public function stream($filename = 'image.jpg')
|
||||
{
|
||||
return new StreamedResponse(function() {
|
||||
echo $this->output();
|
||||
}, 200, array(
|
||||
'Content-Type' => 'image/jpeg',
|
||||
'Content-Disposition' => 'inline; filename="'.$filename.'"',
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Call Snappy instance.
|
||||
*
|
||||
* Also shortcut's
|
||||
* ->html => loadHtml
|
||||
* ->view => loadView
|
||||
* ->file => loadFile
|
||||
*
|
||||
* @param string $name
|
||||
* @param array $arguments
|
||||
* @return mixed
|
||||
*/
|
||||
public function __call($name, array $arguments)
|
||||
{
|
||||
$method = 'load' . ucfirst($name);
|
||||
if (method_exists($this, $method))
|
||||
{
|
||||
return call_user_func_array(array($this, $method), $arguments);
|
||||
}
|
||||
|
||||
return call_user_func_array (array($this->snappy, $name), $arguments);
|
||||
}
|
||||
}
|
||||
-81
@@ -1,81 +0,0 @@
|
||||
<?php namespace Barryvdh\Snappy;
|
||||
|
||||
use Illuminate\Support\ServiceProvider as BaseServiceProvider;
|
||||
|
||||
class LumenServiceProvider extends BaseServiceProvider
|
||||
{
|
||||
/**
|
||||
* Indicates if loading of the provider is deferred.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $defer = false;
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->app->configure('snappy');
|
||||
|
||||
$configPath = __DIR__ . '/../config/snappy.php';
|
||||
$this->mergeConfigFrom($configPath, 'snappy');
|
||||
}
|
||||
|
||||
public function boot()
|
||||
{
|
||||
if ($this->app['config']->get('snappy.pdf.enabled')) {
|
||||
$this->app->bind('snappy.pdf',function ($app) {
|
||||
$binary = $app['config']->get('snappy.pdf.binary', '/usr/local/bin/wkhtmltopdf');
|
||||
$options = $app['config']->get('snappy.pdf.options', array());
|
||||
$env = $app['config']->get('snappy.pdf.env', array());
|
||||
$timeout = $app['config']->get('snappy.pdf.timeout', false);
|
||||
|
||||
$snappy = new IlluminateSnappyPdf($app['files'], $binary, $options, $env);
|
||||
if (false !== $timeout) {
|
||||
$snappy->setTimeout($timeout);
|
||||
}
|
||||
|
||||
return $snappy;
|
||||
});
|
||||
|
||||
$this->app->bind('snappy.pdf.wrapper',function ($app) {
|
||||
return new PdfWrapper($app['snappy.pdf']);
|
||||
});
|
||||
$this->app->alias('snappy.pdf.wrapper', 'Barryvdh\Snappy\PdfWrapper');
|
||||
}
|
||||
|
||||
if ($this->app['config']->get('snappy.image.enabled')) {
|
||||
$this->app->bind('snappy.image',function ($app) {
|
||||
$binary = $app['config']->get('snappy.image.binary', '/usr/local/bin/wkhtmltoimage');
|
||||
$options = $app['config']->get('snappy.image.options', array());
|
||||
$env = $app['config']->get('snappy.image.env', array());
|
||||
$timeout = $app['config']->get('snappy.image.timeout', false);
|
||||
|
||||
$image = new IlluminateSnappyImage($app['files'], $binary, $options, $env);
|
||||
if (false !== $timeout) {
|
||||
$image->setTimeout($timeout);
|
||||
}
|
||||
|
||||
return $image;
|
||||
});
|
||||
|
||||
$this->app->bind('snappy.image.wrapper',function ($app) {
|
||||
return new ImageWrapper($app['snappy.image']);
|
||||
});
|
||||
$this->app->alias('snappy.image.wrapper', 'Barryvdh\Snappy\ImageWrapper');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the services provided by the provider.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provides()
|
||||
{
|
||||
return array('snappy.pdf', 'snappy.pdf.wrapper', 'snappy.image', 'snappy.image.wrapper');
|
||||
}
|
||||
}
|
||||
@@ -1,297 +0,0 @@
|
||||
<?php namespace Barryvdh\Snappy;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use PHPUnit\Framework\Assert as PHPUnit;
|
||||
use Illuminate\Support\Facades\View as ViewFacade;
|
||||
|
||||
|
||||
class PdfFaker extends PdfWrapper
|
||||
{
|
||||
protected $view;
|
||||
protected $filename;
|
||||
|
||||
/**
|
||||
* Load a View and convert to HTML
|
||||
*
|
||||
* @param string $view
|
||||
* @param array $data
|
||||
* @param array $mergeData
|
||||
* @return $this
|
||||
*/
|
||||
public function loadView($view, $data = array(), $mergeData = array())
|
||||
{
|
||||
$this->view = ViewFacade::make($view, $data, $mergeData);
|
||||
return parent::loadView($view, $data, $mergeData);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Ensure that the response has a view as its original content.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
protected function ensureResponseHasView()
|
||||
{
|
||||
if (! isset($this->view) || ! $this->view instanceof View) {
|
||||
return PHPUnit::fail('The response is not a view.');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function assertViewIs($value)
|
||||
{
|
||||
PHPUnit::assertEquals($value, $this->view->getName());
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert that the response view has a given piece of bound data.
|
||||
*
|
||||
* @param string|array $key
|
||||
* @param mixed $value
|
||||
* @return $this
|
||||
*/
|
||||
public function assertViewHas($key, $value = null)
|
||||
{
|
||||
if (is_array($key)) {
|
||||
return $this->assertViewHasAll($key);
|
||||
}
|
||||
|
||||
$this->ensureResponseHasView();
|
||||
|
||||
if (is_null($value)) {
|
||||
PHPUnit::assertArrayHasKey($key, $this->view->getData());
|
||||
} elseif ($value instanceof \Closure) {
|
||||
PHPUnit::assertTrue($value($this->view->$key));
|
||||
} else {
|
||||
PHPUnit::assertEquals($value, $this->view->$key);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert that the response view has a given list of bound data.
|
||||
*
|
||||
* @param array $bindings
|
||||
* @return $this
|
||||
*/
|
||||
public function assertViewHasAll(array $bindings)
|
||||
{
|
||||
foreach ($bindings as $key => $value) {
|
||||
if (is_int($key)) {
|
||||
$this->assertViewHas($value);
|
||||
} else {
|
||||
$this->assertViewHas($key, $value);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert that the response view is missing a piece of bound data.
|
||||
*
|
||||
* @param string $key
|
||||
* @return $this
|
||||
*/
|
||||
public function assertViewMissing($key)
|
||||
{
|
||||
$this->ensureResponseHasView();
|
||||
|
||||
PHPUnit::assertArrayNotHasKey($key, $this->view->getData());
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert that the given string is contained within the response.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
*/
|
||||
public function assertSee($value)
|
||||
{
|
||||
PHPUnit::assertStringContainsString($value, $this->html);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert that the given string is contained within the response text.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
*/
|
||||
public function assertSeeText($value)
|
||||
{
|
||||
PHPUnit::assertStringContainsString($value, strip_tags($this->html));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert that the given string is not contained within the response.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
*/
|
||||
public function assertDontSee($value)
|
||||
{
|
||||
PHPUnit::assertStringNotContainsString($value, $this->html);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert that the given string is not contained within the response text.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
*/
|
||||
public function assertDontSeeText($value)
|
||||
{
|
||||
PHPUnit::assertStringNotContainsString($value, strip_tags($this->html));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert that the given string is equal to the saved filename.
|
||||
*
|
||||
* @param string $value
|
||||
* @return $this
|
||||
*/
|
||||
public function assertFileNameIs($value)
|
||||
{
|
||||
PHPUnit::assertEquals($value, $this->filename);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function output()
|
||||
{
|
||||
return '%PDF-1.3
|
||||
%?????????
|
||||
4 0 obj
|
||||
<< /Length 5 0 R /Filter /FlateDecode >>
|
||||
stream
|
||||
x+T(T0BSKS=#
|
||||
|
||||
C=
|
||||
K??T?p?<}?bC??bC0,N??5?34???05j1?7)N?
|
||||
z/?
|
||||
endstream
|
||||
endobj
|
||||
5 0 obj
|
||||
73
|
||||
endobj
|
||||
2 0 obj
|
||||
<< /Type /Page /Parent 3 0 R /Resources 6 0 R /Contents 4 0 R /MediaBox [0 0 595.28 841.89]
|
||||
>>
|
||||
endobj
|
||||
6 0 obj
|
||||
<< /ProcSet [ /PDF ] /ColorSpace << /Cs1 7 0 R >> >>
|
||||
endobj
|
||||
8 0 obj
|
||||
<< /Length 9 0 R /N 3 /Alternate /DeviceRGB /Filter /FlateDecode >>
|
||||
stream
|
||||
x??wTS??Ͻ7??" %?z ?;HQ?I?P??&vDF)VdT?G?"cE
|
||||
??b? ?P??QDE?k ?5?ޚ??Y?????g?}P???tX?4?X???\???X??ffG?D???=???HƳ??.?d??,?P&s???"7C$
|
||||
E?6<~&??S??2????)2?12? ??"?įl???+?ɘ?&?Y??4???Pޚ%ᣌ?\?%?g?|e?TI???(????L0?_??&?l?2E???9?r??9h?x?g??Ib?טi???f??S?b1+??M?xL???
|
||||
?0??o?E%Ym?h?????Y??h????~S?=?z?U?&?ϞA??Y?l?/??$Z????U?m@??O? ??ޜ??l^???
|
||||
\'
|
||||
???ls?k.+?7???oʿ?9?????V;???#I3eE妧?KD??
|
||||
??d?????9i???,?????UQ? ??h??<?X?.d
|
||||
???6\'~?khu_}?9P?I?o=C#$n?z}?[1
|
||||
Ⱦ?h???s?2z???
|
||||
\?n?LA"S??
|
||||
?dr%?,?߄l??t?
|
||||
?3p? ??H?.Hi@?A>?
|
||||
p1?v?jpԁz?N?6p\W?
|
||||
|
||||
?G@
|
||||
???ٰG???Dx????J?>???,?_@?FDB?X$!k?"??E????H?q???a???Y??bVa?bJ0c?VL?6f3????bձ?X\'??&?x?*???s?b|!??`[????a?;???p~?\2n5??????
|
||||
ߏƿ\'? Zk?!? $l$???4Q??Ot"?y?\b)???A?I&N?I?$R$)???TIj"]&=&?!??:dGrY@^O?$? _%??P?n?X????ZO?D}J}/G?3???ɭ???k??{%O?חw?_.?\'_!J????Q?@?S???V?F??=?IE???b?b?b?b??5?Q%?????O?@??%?!BӥyҸ?M?:?e?0G7??ӓ????? e%e[?(????R?0`?3R????????4?????6?i^??)??*n*|?"?f????LUo?՝?m?O?0j&jaj?j??.??ϧ?w?ϝ_4????갺?z??j???=???U?4?5?n?ɚ??4ǴhZ
|
||||
?Z?Z?^0????Tf%??9?????-?>?ݫ=?c??Xg?N??]?.[7A?\?SwBOK/X/_?Q?>Q?????G?[??? ?`?A???????a?a??c#????*?Z?;?8c?q??>?[&???I?I??MS???T`?ϴ?
|
||||
k?h&4?5?Ǣ??YY?F֠9?<?|?y??+
|
||||
=?X???_,?,S-?,Y)YXm?????Ěk]c}džj?c?Φ?浭?-?v??};?]???N????"?&?1=?x????tv(??}???????\'{\'??I?ߝY?Σ?
|
||||
|
||||
??-r?q?r?.d.?_xp??Uە?Z???M?v?m???=????+K?G?ǔ????
|
||||
^???W?W????b?j?>:>?>?>?v??}/?a??v?????????O8? ?
|
||||
?FV>
|
||||
2 u?????/?_$\?B?Cv?< 5
|
||||
]?s.,4?&?y?Ux~xw-bEDCĻH????G??KwF?G?E?GME{E?EK?X,Y??F?Z? ?=$vr????K????
|
||||
??.3\????r???Ϯ?_?Yq*??©?L??_?w?ד??????+??]?e???????D??]?cI?II?OA??u?_?䩔???)3?ѩ?i?????B%a??+]3=\'?/?4?0C??i??U?@ёL(sYf????L?H?$?%?Y
|
||||
?j??gGe??Q?????n?????~5f5wug?v????5?k??֮\۹Nw]??????m mH???Fˍen???Q?Q??`h????B?BQ?-?[l?ll??f??jۗ"^??b???O%ܒ??Y}W???????????w?w????X?bY^?Ю?]?????W?Va[q`i?d??2???J?jGէ??????{??????m???>???Pk?Am?a?????꺿g_D?H??G?G??u?;??7?7?6?Ʊ?q?o???C{??P3???8!9?????
|
||||
<?y?}??\'?????Z?Z???։??6i{L{??ӝ?-???|??????gKϑ???9?w~?Bƅ??:Wt>???ҝ????ˁ??^?r?۽??U??g?9];}?}????????_?~i??m??p???㭎?}??]?/???}?????.?{?^?=?}????^??z8?h?c??\'
|
||||
O*????????f?????`ϳ?g???C/????O?ϩ?+F?F?G?Gό???z????ˌ??ㅿ)????ѫ?~w??gb???k???Jި?9???m?d???wi獵?ޫ???????c?Ǒ??O?O????w| ??x&mf??????
|
||||
endstream
|
||||
endobj
|
||||
9 0 obj
|
||||
2612
|
||||
endobj
|
||||
7 0 obj
|
||||
[ /ICCBased 8 0 R ]
|
||||
endobj
|
||||
3 0 obj
|
||||
<< /Type /Pages /MediaBox [0 0 595.28 841.89] /Count 1 /Kids [ 2 0 R ] >>
|
||||
endobj
|
||||
10 0 obj
|
||||
<< /Type /Catalog /Pages 3 0 R >>
|
||||
endobj
|
||||
11 0 obj
|
||||
(Leeg)
|
||||
endobj
|
||||
12 0 obj
|
||||
(Mac OS X 10.13.3 Quartz PDFContext)
|
||||
endobj
|
||||
13 0 obj
|
||||
(Pages)
|
||||
endobj
|
||||
14 0 obj
|
||||
(D:20180330091154Z00\'00\')
|
||||
endobj
|
||||
1 0 obj
|
||||
<< /Title 11 0 R /Producer 12 0 R /Creator 13 0 R /CreationDate 14 0 R /ModDate
|
||||
14 0 R >>
|
||||
endobj
|
||||
xref
|
||||
0 15
|
||||
0000000000 65535 f
|
||||
0000003414 00000 n
|
||||
0000000187 00000 n
|
||||
0000003133 00000 n
|
||||
0000000022 00000 n
|
||||
0000000169 00000 n
|
||||
0000000297 00000 n
|
||||
0000003098 00000 n
|
||||
0000000365 00000 n
|
||||
0000003078 00000 n
|
||||
0000003222 00000 n
|
||||
0000003272 00000 n
|
||||
0000003295 00000 n
|
||||
0000003348 00000 n
|
||||
0000003372 00000 n
|
||||
trailer
|
||||
<< /Size 15 /Root 10 0 R /Info 1 0 R /ID [ <ea5d2c625a19688ce1ff05174d8a0261>
|
||||
<ea5d2c625a19688ce1ff05174d8a0261> ] >>
|
||||
startxref
|
||||
3519
|
||||
%%EOF';
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the PDF to a file
|
||||
*
|
||||
* @param $filename
|
||||
* @return $this
|
||||
*/
|
||||
public function save($filename, $overwrite = false)
|
||||
{
|
||||
$this->filename = $filename;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -1,285 +0,0 @@
|
||||
<?php namespace Barryvdh\Snappy;
|
||||
|
||||
use Illuminate\Http\Response;
|
||||
use Knp\Snappy\Pdf as SnappyPDF;
|
||||
use Illuminate\Support\Facades\View;
|
||||
use Illuminate\Contracts\Support\Renderable;
|
||||
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||
|
||||
/**
|
||||
* A Laravel wrapper for SnappyPDF
|
||||
*
|
||||
* @package laravel-snappy
|
||||
* @author Barry vd. Heuvel
|
||||
*/
|
||||
class PdfWrapper{
|
||||
|
||||
/**
|
||||
* @var \Knp\Snappy\Pdf
|
||||
*/
|
||||
protected $snappy;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $options = array();
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $html;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $file;
|
||||
|
||||
/**
|
||||
* @param \Knp\Snappy\Pdf $snappy
|
||||
*/
|
||||
public function __construct(SnappyPDF $snappy)
|
||||
{
|
||||
$this->snappy = $snappy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Snappy instance.
|
||||
*
|
||||
* @return \Knp\Snappy\Pdf
|
||||
*/
|
||||
public function snappy()
|
||||
{
|
||||
return $this->snappy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set temporary folder
|
||||
*
|
||||
* @param string $path
|
||||
*/
|
||||
public function setTemporaryFolder($path)
|
||||
{
|
||||
$this->snappy->setTemporaryFolder($path);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the paper size (default A4)
|
||||
*
|
||||
* @param string $paper
|
||||
* @param string $orientation
|
||||
* @return $this
|
||||
*/
|
||||
public function setPaper($paper, $orientation=null)
|
||||
{
|
||||
$this->snappy->setOption('page-size', $paper);
|
||||
if($orientation){
|
||||
$this->snappy->setOption('orientation', $orientation);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the orientation (default portrait)
|
||||
*
|
||||
* @param string $orientation
|
||||
* @return $this
|
||||
*/
|
||||
public function setOrientation($orientation)
|
||||
{
|
||||
$this->snappy->setOption('orientation', $orientation);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show or hide warnings
|
||||
*
|
||||
* @param bool $warnings
|
||||
* @return $this
|
||||
* @deprecated
|
||||
*/
|
||||
public function setWarnings($warnings)
|
||||
{
|
||||
//Doesn't do anything
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @return $this
|
||||
*/
|
||||
public function setOption($name, $value)
|
||||
{
|
||||
if ($value instanceof Renderable) {
|
||||
$value = $value->render();
|
||||
}
|
||||
$this->snappy->setOption($name, $value);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $options
|
||||
* @return $this
|
||||
*/
|
||||
public function setOptions($options)
|
||||
{
|
||||
$this->snappy->setOptions($options);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load a HTML string
|
||||
*
|
||||
* @param Array|string|Renderable $html
|
||||
* @return $this
|
||||
*/
|
||||
public function loadHTML($html)
|
||||
{
|
||||
if ($html instanceof Renderable) {
|
||||
$html = $html->render();
|
||||
}
|
||||
$this->html = $html;
|
||||
$this->file = null;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load a HTML file
|
||||
*
|
||||
* @param string $file
|
||||
* @return $this
|
||||
*/
|
||||
public function loadFile($file)
|
||||
{
|
||||
$this->html = null;
|
||||
$this->file = $file;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load a View and convert to HTML
|
||||
*
|
||||
* @param string $view
|
||||
* @param array $data
|
||||
* @param array $mergeData
|
||||
* @return $this
|
||||
*/
|
||||
public function loadView($view, $data = array(), $mergeData = array())
|
||||
{
|
||||
$view = View::make($view, $data, $mergeData);
|
||||
|
||||
return $this->loadHTML($view);
|
||||
}
|
||||
|
||||
/**
|
||||
* Output the PDF as a string.
|
||||
*
|
||||
* @return string The rendered PDF as string
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function output()
|
||||
{
|
||||
if ($this->html)
|
||||
{
|
||||
return $this->snappy->getOutputFromHtml($this->html, $this->options);
|
||||
}
|
||||
|
||||
if ($this->file)
|
||||
{
|
||||
return $this->snappy->getOutput($this->file, $this->options);
|
||||
}
|
||||
|
||||
throw new \InvalidArgumentException('PDF Generator requires a html or file in order to produce output.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the PDF to a file
|
||||
*
|
||||
* @param $filename
|
||||
* @return $this
|
||||
*/
|
||||
public function save($filename, $overwrite = false)
|
||||
{
|
||||
|
||||
if ($this->html)
|
||||
{
|
||||
$this->snappy->generateFromHtml($this->html, $filename, $this->options, $overwrite);
|
||||
}
|
||||
elseif ($this->file)
|
||||
{
|
||||
$this->snappy->generate($this->file, $filename, $this->options, $overwrite);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make the PDF downloadable by the user
|
||||
*
|
||||
* @param string $filename
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function download($filename = 'document.pdf')
|
||||
{
|
||||
return new Response($this->output(), 200, array(
|
||||
'Content-Type' => 'application/pdf',
|
||||
'Content-Disposition' => 'attachment; filename="'.$filename.'"'
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a response with the PDF to show in the browser
|
||||
*
|
||||
* @param string $filename
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function inline($filename = 'document.pdf')
|
||||
{
|
||||
return new Response($this->output(), 200, array(
|
||||
'Content-Type' => 'application/pdf',
|
||||
'Content-Disposition' => 'inline; filename="'.$filename.'"',
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a response with the PDF to show in the browser
|
||||
*
|
||||
* @param string $filename
|
||||
* @return \Symfony\Component\HttpFoundation\StreamedResponse
|
||||
* @deprecated use inline() instead
|
||||
*/
|
||||
public function stream($filename = 'document.pdf')
|
||||
{
|
||||
return new StreamedResponse(function() {
|
||||
echo $this->output();
|
||||
}, 200, array(
|
||||
'Content-Type' => 'application/pdf',
|
||||
'Content-Disposition' => 'inline; filename="'.$filename.'"',
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Call Snappy instance.
|
||||
*
|
||||
* Also shortcut's
|
||||
* ->html => loadHtml
|
||||
* ->view => loadView
|
||||
* ->file => loadFile
|
||||
*
|
||||
* @param string $name
|
||||
* @param array $arguments
|
||||
* @return mixed
|
||||
*/
|
||||
public function __call($name, array $arguments)
|
||||
{
|
||||
$method = 'load' . ucfirst($name);
|
||||
if (method_exists($this, $method))
|
||||
{
|
||||
return call_user_func_array(array($this, $method), $arguments);
|
||||
}
|
||||
|
||||
return call_user_func_array (array($this->snappy, $name), $arguments);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
<?php namespace Barryvdh\Snappy;
|
||||
|
||||
use Illuminate\Support\ServiceProvider as BaseServiceProvider;
|
||||
|
||||
class ServiceProvider extends BaseServiceProvider {
|
||||
|
||||
/**
|
||||
* Indicates if loading of the provider is deferred.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $defer = false;
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$configPath = __DIR__ . '/../config/snappy.php';
|
||||
$this->mergeConfigFrom($configPath, 'snappy');
|
||||
}
|
||||
|
||||
public function boot()
|
||||
{
|
||||
$configPath = __DIR__ . '/../config/snappy.php';
|
||||
$this->publishes([$configPath => config_path('snappy.php')], 'config');
|
||||
|
||||
if($this->app['config']->get('snappy.pdf.enabled')){
|
||||
$this->app->bind('snappy.pdf', function($app)
|
||||
{
|
||||
$binary = $app['config']->get('snappy.pdf.binary', '/usr/local/bin/wkhtmltopdf');
|
||||
$options = $app['config']->get('snappy.pdf.options', array());
|
||||
$env = $app['config']->get('snappy.pdf.env', array());
|
||||
$timeout = $app['config']->get('snappy.pdf.timeout', false);
|
||||
|
||||
$snappy = new IlluminateSnappyPdf($app['files'], $binary, $options, $env);
|
||||
if (false !== $timeout) {
|
||||
$snappy->setTimeout($timeout);
|
||||
}
|
||||
|
||||
return $snappy;
|
||||
});
|
||||
|
||||
$this->app->bind('snappy.pdf.wrapper', function($app)
|
||||
{
|
||||
return new PdfWrapper($app['snappy.pdf']);
|
||||
});
|
||||
$this->app->alias('snappy.pdf.wrapper', 'Barryvdh\Snappy\PdfWrapper');
|
||||
}
|
||||
|
||||
|
||||
if($this->app['config']->get('snappy.image.enabled')){
|
||||
$this->app->bind('snappy.image', function($app)
|
||||
{
|
||||
$binary = $app['config']->get('snappy.image.binary', '/usr/local/bin/wkhtmltoimage');
|
||||
$options = $app['config']->get('snappy.image.options', array());
|
||||
$env = $app['config']->get('snappy.image.env', array());
|
||||
$timeout = $app['config']->get('snappy.image.timeout', false);
|
||||
|
||||
$image = new IlluminateSnappyImage($app['files'], $binary, $options, $env);
|
||||
if (false !== $timeout) {
|
||||
$image->setTimeout($timeout);
|
||||
}
|
||||
|
||||
return $image;
|
||||
});
|
||||
|
||||
$this->app->bind('snappy.image.wrapper', function($app)
|
||||
{
|
||||
return new ImageWrapper($app['snappy.image']);
|
||||
});
|
||||
$this->app->alias('snappy.image.wrapper', 'Barryvdh\Snappy\ImageWrapper');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the services provided by the provider.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provides()
|
||||
{
|
||||
return array('snappy.pdf', 'snappy.pdf.wrapper', 'snappy.image', 'snappy.image.wrapper');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user