Uploaded From CV. Swandhana Server

This commit is contained in:
Duidev Software House
2025-01-27 08:16:55 +07:00
commit 6b3be42361
15186 changed files with 2328862 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
vendor
composer.lock
.idea

21
vendor/elibyy/tcpdf-laravel/LICENSE vendored Normal file
View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) [year] [fullname]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

103
vendor/elibyy/tcpdf-laravel/README.md vendored Normal file
View File

@@ -0,0 +1,103 @@
# Laravel 6-7-8-9-10-11 TCPDF
[![Latest Stable Version](https://poser.pugx.org/elibyy/tcpdf-laravel/v/stable)](https://packagist.org/packages/elibyy/tcpdf-laravel) [![Total Downloads](https://poser.pugx.org/elibyy/tcpdf-laravel/downloads)](https://packagist.org/packages/elibyy/tcpdf-laravel) [![Latest Unstable Version](https://poser.pugx.org/elibyy/tcpdf-laravel/v/unstable)](https://packagist.org/packages/elibyy/tcpdf-laravel) [![License](https://poser.pugx.org/elibyy/tcpdf-laravel/license)](https://packagist.org/packages/elibyy/tcpdf-laravel)
A simple [Laravel](http://www.laravel.com) service provider with some basic configuration for including the [TCPDF library](http://www.tcpdf.org/)
#### TCPDF is not really supported in PHP 7 but there's a plan for supporting it, check [this](https://github.com/tecnickcom/tc-lib-pdf) out.
## Installation
The Laravel TCPDF service provider can be installed via [composer](http://getcomposer.org) by requiring the `elibyy/tcpdf-laravel` package in your project's `composer.json`. (The installation may take a while, because the package requires TCPDF. Sadly its .git folder is very heavy)
```
composer require elibyy/tcpdf-laravel
```
or
Laravel 5.5+ will use the auto-discovery function.
```json
{
"require": {
"elibyy/tcpdf-laravel": "^9.0"
}
}
```
If you don't use auto-discovery you will need to include the service provider / facade in `config/app.php`.
```php
'providers' => [
//...
Elibyy\TCPDF\ServiceProvider::class,
]
//...
'aliases' => [
//...
'PDF' => Elibyy\TCPDF\Facades\TCPDF::class
]
```
(Please note: TCPDF cannot be used as an alias)
for lumen you should add the following lines:
```php
$app->register(Elibyy\TCPDF\ServiceProvider::class);
class_alias(Elibyy\TCPDF\Facades\TCPDF::class, 'PDF');
```
That's it! You're good to go.
Here is a little example:
```php
use PDF; // at the top of the file
PDF::SetTitle('Hello World');
PDF::AddPage();
PDF::Write(0, 'Hello World');
PDF::Output('hello_world.pdf');
```
another example for generating multiple PDF's
```php
use PDF; // at the top of the file
for ($i = 0; $i < 5; $i++) {
PDF::SetTitle('Hello World'.$i);
PDF::AddPage();
PDF::Write(0, 'Hello World'.$i);
PDF::Output(public_path('hello_world' . $i . '.pdf'), 'F');
PDF::reset();
}
```
For a list of all available function take a look at the [TCPDF Documentation](http://www.tcpdf.org/doc/code/classTCPDF.html)
## Configuration
Laravel-TCPDF comes with some basic configuration.
If you want to override the defaults, you can publish the config, like so:
php artisan vendor:publish --provider="Elibyy\TCPDF\ServiceProvider"
Now access `config/tcpdf.php` to customize.
* use_original_header is to used the original `Header()` from TCPDF.
* Please note that `PDF::setHeaderCallback(function($pdf){})` overrides this settings.
* use_original_footer is to used the original `Footer()` from TCPDF.
* Please note that `PDF::setFooterCallback(function($pdf){})` overrides this settings.
* use_fpdi is so that our internal helper will extend `TcpdfFpdi` instead of `TCPDF`.
* Please note fpdi is not a dependency in my project so you will have to follow their install instructions [here](https://github.com/Setasign/FPDI)
## Header/Footer helpers
I've got a pull-request asking for this so I've added the feature
now you can use `PDF::setHeaderCallback(function($pdf){})` or `PDF::setFooterCallback(function($pdf){})`

View File

@@ -0,0 +1,36 @@
{
"name": "elibyy/tcpdf-laravel",
"description": "tcpdf support for Laravel 6, 7, 8, 9, 10, 11",
"minimum-stability": "stable",
"license": "MIT",
"keywords": [
"laravel",
"tcpdf",
"pdf"
],
"authors": [
{
"name": "eli y",
"email": "elibyy@gmail.com"
}
],
"require": {
"illuminate/support": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0",
"tecnickcom/tcpdf": "6.2.*|6.3.*|6.4.*|6.5.*|6.6.*|6.7.*|dev-main"
},
"autoload": {
"psr-4": {
"Elibyy\\TCPDF\\": "src/"
}
},
"extra": {
"laravel": {
"providers": [
"Elibyy\\TCPDF\\ServiceProvider"
],
"aliases": {
"PDF": "Elibyy\\TCPDF\\Facades\\TCPDF"
}
}
}
}

View File

@@ -0,0 +1,50 @@
<?php
return [
'page_format' => 'A4',
'page_orientation' => 'P',
'page_units' => 'mm',
'unicode' => true,
'encoding' => 'UTF-8',
'font_directory' => '',
'image_directory' => '',
'tcpdf_throw_exception' => false,
'use_fpdi' => false,
'use_original_header' => false,
'use_original_footer' => false,
'pdfa' => false, // Options: false, 1, 3
// See more info at the tcpdf_config.php file in TCPDF (if you do not set this here, TCPDF will use it default)
// https://raw.githubusercontent.com/tecnickcom/TCPDF/master/config/tcpdf_config.php
// 'path_main' => '', // K_PATH_MAIN
// 'path_url' => '', // K_PATH_URL
// 'header_logo' => '', // PDF_HEADER_LOGO
// 'header_logo_width' => '', // PDF_HEADER_LOGO_WIDTH
// 'path_cache' => '', // K_PATH_CACHE
// 'blank_image' => '', // K_BLANK_IMAGE
// 'creator' => '', // PDF_CREATOR
// 'author' => '', // PDF_AUTHOR
// 'header_title' => '', // PDF_HEADER_TITLE
// 'header_string' => '', // PDF_HEADER_STRING
// 'page_units' => '', // PDF_UNIT
// 'margin_header' => '', // PDF_MARGIN_HEADER
// 'margin_footer' => '', // PDF_MARGIN_FOOTER
// 'margin_top' => '', // PDF_MARGIN_TOP
// 'margin_bottom' => '', // PDF_MARGIN_BOTTOM
// 'margin_left' => '', // PDF_MARGIN_LEFT
// 'margin_right' => '', // PDF_MARGIN_RIGHT
// 'font_name_main' => '', // PDF_FONT_NAME_MAIN
// 'font_size_main' => '', // PDF_FONT_SIZE_MAIN
// 'font_name_data' => '', // PDF_FONT_NAME_DATA
// 'font_size_data' => '', // PDF_FONT_SIZE_DATA
// 'foto_monospaced' => '', // PDF_FONT_MONOSPACED
// 'image_scale_ratio' => '', // PDF_IMAGE_SCALE_RATIO
// 'head_magnification' => '', // HEAD_MAGNIFICATION
// 'cell_height_ratio' => '', // K_CELL_HEIGHT_RATIO
// 'title_magnification' => '', // K_TITLE_MAGNIFICATION
// 'small_ratio' => '', // K_SMALL_RATIO
// 'thai_topchars' => '', // K_THAI_TOPCHARS
// 'tcpdf_calls_in_html' => '', // K_TCPDF_CALLS_IN_HTML
// 'timezone' => '', // K_TIMEZONE
// 'allowed_tags' => '', // K_ALLOWED_TCPDF_TAGS
];

View File

@@ -0,0 +1,35 @@
<?php
namespace Elibyy\TCPDF\Facades;
use Illuminate\Support\Facades\Facade;
/**
* @method static \TCPDF AddPage($orientation = '', $format = '', $keepmargins = false, $tocpage = false)
* @method static \TCPDF AddSpotColor($name, $c, $m, $y, $k)
* @method static \TCPDF AddSpotColorHtml($name, $c, $m, $y, $k)
* @method static \TCPDF AddTTFFont($fontfamily, $fontstyle, $filename, $subset = 'default', $enc = '', $embed = true)
* @method static \TCPDF SetTitle($title, $isUTF8 = false)
* @method static \TCPDF SetSubject($subject, $isUTF8 = false)
* @method static \TCPDF SetAuthor($author, $isUTF8 = false)
* @method static \TCPDF SetKeywords($keywords, $isUTF8 = false)
* @method static \TCPDF SetHeaderData($ln = '', $lw = 0, $ht = '', $hs = '', $tc = array(0, 0, 0), $lc = array(0, 0, 0))
* @method static \TCPDF SetCreator($creator, $isUTF8 = false)
* @method static \TCPDF writeHTML($html, $ln = true, $fill = false, $reseth = false, $cell = false, $align = '')
* @method static \TCPDF Write($h, $txt, $link = '')
* @method static \TCPDF Output($name = '', $dest = '')
* @method static \TCPDF reset()
* @method static \TCPDF SetAutoPageBreak($auto, $margin = 0)
* @method static \TCPDF SetMargins($left, $top, $right = -1, $keepmargins = false)
* @method static \TCPDF SetProtection($permissions = array(), $user_pass = '', $owner_pass = null, $mode = 0, $pubkeys = null)
* @method static \TCPDF SetPageOrientation($orientation)
* @method static \TCPDF SetPageFormat($format, $orientation = '')
* @method static \TCPDF SetImageScale($scale)
* @method static \TCPDF Cell($w, $h = 0, $txt = '', $border = 0, $ln = 0, $align = '', $fill = 0, $link = '')
* @method static \TCPDF MultiCell($w, $h, $txt, $border = 0, $align = 'J', $fill = false)
* @method static \TCPDF Ln($h = null)
*
*/
class TCPDF extends Facade
{
protected static function getFacadeAccessor(){return 'tcpdf';}
}

View File

@@ -0,0 +1,53 @@
<?php
namespace Elibyy\TCPDF;
use Illuminate\Support\Facades\Config;
use setasign\Fpdi\TcpdfFpdi;
class FpdiTCPDFHelper extends TcpdfFpdi
{
protected $headerCallback;
protected $footerCallback;
public function Header()
{
if ($this->headerCallback != null && is_callable($this->headerCallback)) {
$cb = $this->headerCallback;
$cb($this);
} else {
if (Config::get('tcpdf.use_original_header')) {
parent::Header();
}
}
}
public function Footer()
{
if ($this->footerCallback != null && is_callable($this->footerCallback)) {
$cb = $this->footerCallback;
$cb($this);
} else {
if (Config::get('tcpdf.use_original_footer')) {
parent::Footer();
}
}
}
public function setHeaderCallback($callback)
{
$this->headerCallback = $callback;
}
public function setFooterCallback($callback)
{
$this->footerCallback = $callback;
}
public function disableTcpdfLink()
{
// disable tcpdf metalink *sigh*
$this->tcpdflink = false;
}
}

View File

@@ -0,0 +1,95 @@
<?php
namespace Elibyy\TCPDF;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\ServiceProvider as LaravelServiceProvider;
/**
* Class ServiceProvider
* @version 1.0
* @package Elibyy\TCPDF
*/
class ServiceProvider extends LaravelServiceProvider
{
protected $constantsMap = [
'K_PATH_MAIN' => 'path_main',
'K_PATH_URL' => 'path_url',
'K_PATH_FONTS' => 'font_directory',
'K_PATH_IMAGES' => 'image_directory',
'PDF_HEADER_LOGO' => 'header_logo',
'PDF_HEADER_LOGO_WIDTH' => 'header_logo_width',
'K_PATH_CACHE' => 'path_cache',
'K_BLANK_IMAGE' => 'blank_image',
'PDF_PAGE_FORMAT' => 'page_format',
'PDF_PAGE_ORIENTATION' => 'page_orientation',
'PDF_CREATOR' => 'creator',
'PDF_AUTHOR' => 'author',
'PDF_HEADER_TITLE' => 'header_title',
'PDF_HEADER_STRING' => 'header_string',
'PDF_UNIT' => 'page_units',
'PDF_MARGIN_HEADER' => 'margin_header',
'PDF_MARGIN_FOOTER' => 'margin_footer',
'PDF_MARGIN_TOP' => 'margin_top',
'PDF_MARGIN_BOTTOM' => 'margin_bottom',
'PDF_MARGIN_LEFT' => 'margin_left',
'PDF_MARGIN_RIGHT' => 'margin_right',
'PDF_FONT_NAME_MAIN' => 'font_name_main',
'PDF_FONT_SIZE_MAIN' => 'font_size_main',
'PDF_FONT_NAME_DATA' => 'font_name_data',
'PDF_FONT_SIZE_DATA' => 'font_size_data',
'PDF_FONT_MONOSPACED' => 'foto_monospaced',
'PDF_IMAGE_SCALE_RATIO' => 'image_scale_ratio',
'HEAD_MAGNIFICATION' => 'head_magnification',
'K_CELL_HEIGHT_RATIO' => 'cell_height_ratio',
'K_TITLE_MAGNIFICATION' => 'title_magnification',
'K_SMALL_RATIO' => 'small_ratio',
'K_THAI_TOPCHARS' => 'thai_topchars',
'K_TCPDF_CALLS_IN_HTML' => 'tcpdf_calls_in_html',
'K_TCPDF_THROW_EXCEPTION_ERROR' => 'tcpdf_throw_exception',
'K_TIMEZONE' => 'timezone',
'K_ALLOWED_TCPDF_TAGS' => 'allowed_tags',
];
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$configPath = dirname(__FILE__) . '/../config/tcpdf.php';
$this->mergeConfigFrom($configPath, 'tcpdf');
$this->app->singleton('tcpdf', function ($app) {
return new TCPDF($app);
});
}
public function boot()
{
if (!defined('K_TCPDF_EXTERNAL_CONFIG')) {
define('K_TCPDF_EXTERNAL_CONFIG', true);
}
foreach ($this->constantsMap as $key => $value) {
$value = Config::get('tcpdf.' . $value, null);
if (!is_null($value) && !defined($key)) {
if (is_string($value) && strlen($value) == 0) {
continue;
}
define($key, $value);
}
}
$configPath = dirname(__FILE__) . '/../config/tcpdf.php';
if (function_exists('config_path')) {
$targetPath = config_path('tcpdf.php');
} else {
$targetPath = app()->basePath() . '/config/tcpdf.php';
}
$this->publishes(array($configPath => $targetPath), 'config');
}
public function provides()
{
return ['pdf'];
}
}

View File

@@ -0,0 +1,60 @@
<?php
namespace Elibyy\TCPDF;
use Illuminate\Support\Facades\Config;
class TCPDF
{
protected static $format;
protected $app;
/** @var TCPDFHelper */
protected $tcpdf;
public function __construct($app)
{
$this->app = $app;
$this->reset();
}
public function reset()
{
$class = Config::get('tcpdf.use_fpdi') ? FpdiTCPDFHelper::class : TCPDFHelper::class;
$this->tcpdf = new $class(
Config::get('tcpdf.page_orientation', 'P'),
Config::get('tcpdf.page_units', 'mm'),
static::$format ? static::$format : Config::get('tcpdf.page_format', 'A4'),
Config::get('tcpdf.unicode', true),
Config::get('tcpdf.encoding', 'UTF-8'),
false, // Diskcache is deprecated
Config::get('tcpdf.pdfa', false)
);
$this->tcpdf->disableTcpdfLink();
}
public static function changeFormat($format)
{
static::$format = $format;
}
public function __call($method, $args)
{
if (method_exists($this->tcpdf, $method)) {
return call_user_func_array([$this->tcpdf, $method], $args);
}
throw new \RuntimeException(sprintf('the method %s does not exists in TCPDF', $method));
}
public function setHeaderCallback($headerCallback)
{
$this->tcpdf->setHeaderCallback($headerCallback);
}
public function setFooterCallback($footerCallback)
{
$this->tcpdf->setFooterCallback($footerCallback);
}
}

View File

@@ -0,0 +1,78 @@
<?php
namespace Elibyy\TCPDF;
use Illuminate\Support\Facades\Config;
class TCPDFHelper extends \TCPDF
{
protected $headerCallback;
protected $footerCallback;
public function Header()
{
if ($this->headerCallback != null && is_callable($this->headerCallback)) {
$cb = $this->headerCallback;
$cb($this);
} else {
if (Config::get('tcpdf.use_original_header')) {
parent::Header();
}
}
}
public function Footer()
{
if ($this->footerCallback != null && is_callable($this->footerCallback)) {
$cb = $this->footerCallback;
$cb($this);
} else {
if (Config::get('tcpdf.use_original_footer')) {
parent::Footer();
}
}
}
public function setHeaderCallback($callback)
{
$this->headerCallback = $callback;
}
public function setFooterCallback($callback)
{
$this->footerCallback = $callback;
}
public function addTOC($page = '', $numbersfont = '', $filler = '.', $toc_name = 'TOC', $style = '', $color = array(0, 0, 0))
{
// sort bookmarks before generating the TOC
parent::sortBookmarks();
parent::addTOC($page, $numbersfont, $filler, $toc_name, $style, $color);
}
public function addHTMLTOC($page = '', $toc_name = 'TOC', $templates = array(), $correct_align = true, $style = '', $color = array(0, 0, 0))
{
// sort bookmarks before generating the TOC
parent::sortBookmarks();
parent::addHTMLTOC($page, $toc_name, $templates, $correct_align, $style, $color);
}
public function checkPageBreak($h = 0, $y = null, $addpage = true)
{
parent::checkPageBreak($h, $y, $addpage);
}
public function getPageBreakTrigger()
{
return $this->PageBreakTrigger;
}
public function disableTcpdfLink()
{
// disable tcpdf metalink *sigh*
$this->tcpdflink = false;
}
}