Primer version funcional
This commit is contained in:
2
vendor/cloudframework-io/tcpdi_cf/.gitignore
vendored
Executable file
2
vendor/cloudframework-io/tcpdi_cf/.gitignore
vendored
Executable file
@@ -0,0 +1,2 @@
|
||||
# Google App Engine generated folder
|
||||
appengine-generated/
|
||||
191
vendor/cloudframework-io/tcpdi_cf/LICENSE
vendored
Executable file
191
vendor/cloudframework-io/tcpdi_cf/LICENSE
vendored
Executable file
@@ -0,0 +1,191 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction, and
|
||||
distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by the copyright
|
||||
owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all other entities
|
||||
that control, are controlled by, or are under common control with that entity.
|
||||
For the purposes of this definition, "control" means (i) the power, direct or
|
||||
indirect, to cause the direction or management of such entity, whether by
|
||||
contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity exercising
|
||||
permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications, including
|
||||
but not limited to software source code, documentation source, and configuration
|
||||
files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical transformation or
|
||||
translation of a Source form, including but not limited to compiled object code,
|
||||
generated documentation, and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or Object form, made
|
||||
available under the License, as indicated by a copyright notice that is included
|
||||
in or attached to the work (an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object form, that
|
||||
is based on (or derived from) the Work and for which the editorial revisions,
|
||||
annotations, elaborations, or other modifications represent, as a whole, an
|
||||
original work of authorship. For the purposes of this License, Derivative Works
|
||||
shall not include works that remain separable from, or merely link (or bind by
|
||||
name) to the interfaces of, the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including the original version
|
||||
of the Work and any modifications or additions to that Work or Derivative Works
|
||||
thereof, that is intentionally submitted to Licensor for inclusion in the Work
|
||||
by the copyright owner or by an individual or Legal Entity authorized to submit
|
||||
on behalf of the copyright owner. For the purposes of this definition,
|
||||
"submitted" means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems, and
|
||||
issue tracking systems that are managed by, or on behalf of, the Licensor for
|
||||
the purpose of discussing and improving the Work, but excluding communication
|
||||
that is conspicuously marked or otherwise designated in writing by the copyright
|
||||
owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf
|
||||
of whom a Contribution has been received by Licensor and subsequently
|
||||
incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License.
|
||||
|
||||
Subject to the terms and conditions of this License, each Contributor hereby
|
||||
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
|
||||
irrevocable copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the Work and such
|
||||
Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License.
|
||||
|
||||
Subject to the terms and conditions of this License, each Contributor hereby
|
||||
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
|
||||
irrevocable (except as stated in this section) patent license to make, have
|
||||
made, use, offer to sell, sell, import, and otherwise transfer the Work, where
|
||||
such license applies only to those patent claims licensable by such Contributor
|
||||
that are necessarily infringed by their Contribution(s) alone or by combination
|
||||
of their Contribution(s) with the Work to which such Contribution(s) was
|
||||
submitted. If You institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work or a
|
||||
Contribution incorporated within the Work constitutes direct or contributory
|
||||
patent infringement, then any patent licenses granted to You under this License
|
||||
for that Work shall terminate as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution.
|
||||
|
||||
You may reproduce and distribute copies of the Work or Derivative Works thereof
|
||||
in any medium, with or without modifications, and in Source or Object form,
|
||||
provided that You meet the following conditions:
|
||||
|
||||
You must give any other recipients of the Work or Derivative Works a copy of
|
||||
this License; and
|
||||
You must cause any modified files to carry prominent notices stating that You
|
||||
changed the files; and
|
||||
You must retain, in the Source form of any Derivative Works that You distribute,
|
||||
all copyright, patent, trademark, and attribution notices from the Source form
|
||||
of the Work, excluding those notices that do not pertain to any part of the
|
||||
Derivative Works; and
|
||||
If the Work includes a "NOTICE" text file as part of its distribution, then any
|
||||
Derivative Works that You distribute must include a readable copy of the
|
||||
attribution notices contained within such NOTICE file, excluding those notices
|
||||
that do not pertain to any part of the Derivative Works, in at least one of the
|
||||
following places: within a NOTICE text file distributed as part of the
|
||||
Derivative Works; within the Source form or documentation, if provided along
|
||||
with the Derivative Works; or, within a display generated by the Derivative
|
||||
Works, if and wherever such third-party notices normally appear. The contents of
|
||||
the NOTICE file are for informational purposes only and do not modify the
|
||||
License. You may add Your own attribution notices within Derivative Works that
|
||||
You distribute, alongside or as an addendum to the NOTICE text from the Work,
|
||||
provided that such additional attribution notices cannot be construed as
|
||||
modifying the License.
|
||||
You may add Your own copyright statement to Your modifications and may provide
|
||||
additional or different license terms and conditions for use, reproduction, or
|
||||
distribution of Your modifications, or for any such Derivative Works as a whole,
|
||||
provided Your use, reproduction, and distribution of the Work otherwise complies
|
||||
with the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions.
|
||||
|
||||
Unless You explicitly state otherwise, any Contribution intentionally submitted
|
||||
for inclusion in the Work by You to the Licensor shall be under the terms and
|
||||
conditions of this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify the terms of
|
||||
any separate license agreement you may have executed with Licensor regarding
|
||||
such Contributions.
|
||||
|
||||
6. Trademarks.
|
||||
|
||||
This License does not grant permission to use the trade names, trademarks,
|
||||
service marks, or product names of the Licensor, except as required for
|
||||
reasonable and customary use in describing the origin of the Work and
|
||||
reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty.
|
||||
|
||||
Unless required by applicable law or agreed to in writing, Licensor provides the
|
||||
Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
|
||||
including, without limitation, any warranties or conditions of TITLE,
|
||||
NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
|
||||
solely responsible for determining the appropriateness of using or
|
||||
redistributing the Work and assume any risks associated with Your exercise of
|
||||
permissions under this License.
|
||||
|
||||
8. Limitation of Liability.
|
||||
|
||||
In no event and under no legal theory, whether in tort (including negligence),
|
||||
contract, or otherwise, unless required by applicable law (such as deliberate
|
||||
and grossly negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special, incidental,
|
||||
or consequential damages of any character arising as a result of this License or
|
||||
out of the use or inability to use the Work (including but not limited to
|
||||
damages for loss of goodwill, work stoppage, computer failure or malfunction, or
|
||||
any and all other commercial damages or losses), even if such Contributor has
|
||||
been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability.
|
||||
|
||||
While redistributing the Work or Derivative Works thereof, You may choose to
|
||||
offer, and charge a fee for, acceptance of support, warranty, indemnity, or
|
||||
other liability obligations and/or rights consistent with this License. However,
|
||||
in accepting such obligations, You may act only on Your own behalf and on Your
|
||||
sole responsibility, not on behalf of any other Contributor, and only if You
|
||||
agree to indemnify, defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason of your
|
||||
accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work
|
||||
|
||||
To apply the Apache License to your work, attach the following boilerplate
|
||||
notice, with the fields enclosed by brackets "[]" replaced with your own
|
||||
identifying information. (Don't include the brackets!) The text should be
|
||||
enclosed in the appropriate comment syntax for the file format. We also
|
||||
recommend that a file or class name and description of purpose be included on
|
||||
the same "printed page" as the copyright notice for easier identification within
|
||||
third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
70
vendor/cloudframework-io/tcpdi_cf/README.md
vendored
Executable file
70
vendor/cloudframework-io/tcpdi_cf/README.md
vendored
Executable file
@@ -0,0 +1,70 @@
|
||||
TCPDI_CF
|
||||
=====
|
||||
|
||||
Composer ready [TCPDI](https://github.com/cloudframework-io/tcpdi_cf) based on https://github.com/propa/tcpdi
|
||||
|
||||
PDF importer for [TCPDF](http://www.tcpdf.org/), based on [FPDI](http://www.setasign.de/products/pdf-php-solutions/fpdi/).
|
||||
Requires [pauln/tcpdi_parser](https://github.com/pauln/tcpdi_parser) and [FPDF_TPL](http://www.setasign.de/products/pdf-php-solutions/fpdi/downloads/)
|
||||
which are included in the repository.
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
Link package in composer.json, e.g.
|
||||
|
||||
```sh
|
||||
composer require https://github.com/cloudframework-io/tcpdi_cf
|
||||
```
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
Usage is essentially the same as FPDI, except importing TCPDI rather than FPDI. It also has a "setSourceData()" function which accepts raw PDF data, for cases where the file does not reside on disk or is not readable by TCPDI.
|
||||
|
||||
```php
|
||||
// Create new PDF document.
|
||||
include_once ($this->core->system->root_path.'/vendor/cloudframework-io/tcpdi_cf/tcpdi.php');
|
||||
$pdf = new TCPDI_CF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
|
||||
|
||||
// Add a page from a PDF by file path.
|
||||
$pdf->AddPage();
|
||||
$pdf->setSourceFile('/path/to/file-to-import.pdf');
|
||||
$idx = $pdf->importPage(1);
|
||||
$pdf->useTemplate($idx);
|
||||
|
||||
$pdfdata = file_get_contents('/path/to/other-file.pdf'); // Simulate only having raw data available.
|
||||
$pagecount = $pdf->setSourceData($pdfdata);
|
||||
for ($i = 1; $i <= $pagecount; $i++) {
|
||||
$tplidx = $pdf->importPage($i);
|
||||
$pdf->AddPage();
|
||||
$pdf->useTemplate($tplidx);
|
||||
}
|
||||
|
||||
// Create new PDF document.
|
||||
$pdf = new TCPDI(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
|
||||
|
||||
// Add a page from a PDF by file path.
|
||||
$pdf->setSourceFile('/path/to/file-to-import.pdf');
|
||||
|
||||
// Import the bleed box (default is crop box) for page 1.
|
||||
$tplidx = $pdf->importPage(1, '/BleedBox');
|
||||
$size = $pdf->getTemplatesize($tplidx);
|
||||
$orientation = ($size['w'] > $size['h']) ? 'L' : 'P';
|
||||
|
||||
$pdf->AddPage($orientation);
|
||||
|
||||
// Set page boxes from imported page 1.
|
||||
$pdf->setPageFormatFromTemplatePage(1, $orientation);
|
||||
|
||||
// Import the content for page 1.
|
||||
$pdf->useTemplate($tplidx);
|
||||
|
||||
// Import the annotations for page 1.
|
||||
$pdf->importAnnotations(1);
|
||||
```
|
||||
|
||||
TCPDI_PARSER
|
||||
============
|
||||
|
||||
Parser for use with TCPDI, based on TCPDF_PARSER. Supports PDFs up to v1.7.
|
||||
|
||||
1
vendor/cloudframework-io/tcpdi_cf/VERSION
vendored
Executable file
1
vendor/cloudframework-io/tcpdi_cf/VERSION
vendored
Executable file
@@ -0,0 +1 @@
|
||||
1.0.4
|
||||
24
vendor/cloudframework-io/tcpdi_cf/composer.json
vendored
Executable file
24
vendor/cloudframework-io/tcpdi_cf/composer.json
vendored
Executable file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"name": "cloudframework-io/tcpdi_cf",
|
||||
"type": "library",
|
||||
"description": "TCPDI_CF is a PHP class for importing PDF to use with TCPDF tecnickcom/tcpdf:6.4.1 and pop/tcpdi adapted by cloudframework to include Custom Properties when you sign a PDF",
|
||||
"keywords": ["PDF", "tcpdi", "tcpdi_parser", "tcpdf","cloudframework"],
|
||||
"license": "Apache-2.0",
|
||||
"minimum-stability": "stable",
|
||||
"authors": [
|
||||
{ "name": "Héctor López", "email": "hl@cloudframework.io"},
|
||||
{ "name": "Fran Herrera", "email": "fran@cloudframework.io"},
|
||||
{ "name": "Adrian Martínez", "email": "am@cloudframework.io"}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.3.0",
|
||||
"tecnickcom/tcpdf": "^6.3"
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"fpdf_tpl.php",
|
||||
"tcpdi.php",
|
||||
"tcpdi_parser.php"
|
||||
]
|
||||
}
|
||||
}
|
||||
460
vendor/cloudframework-io/tcpdi_cf/fpdf_tpl.php
vendored
Executable file
460
vendor/cloudframework-io/tcpdi_cf/fpdf_tpl.php
vendored
Executable file
@@ -0,0 +1,460 @@
|
||||
<?php
|
||||
//
|
||||
// FPDF_TPL - Version 1.2.3
|
||||
//
|
||||
// Copyright 2004-2013 Setasign - Jan Slabon
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
class FPDF_TPL extends FPDF {
|
||||
/**
|
||||
* Array of Tpl-Data
|
||||
* @var array
|
||||
*/
|
||||
var $tpls = array();
|
||||
|
||||
/**
|
||||
* Current Template-ID
|
||||
* @var int
|
||||
*/
|
||||
var $tpl = 0;
|
||||
|
||||
/**
|
||||
* "In Template"-Flag
|
||||
* @var boolean
|
||||
*/
|
||||
var $_intpl = false;
|
||||
|
||||
/**
|
||||
* Nameprefix of Templates used in Resources-Dictonary
|
||||
* @var string A String defining the Prefix used as Template-Object-Names. Have to beginn with an /
|
||||
*/
|
||||
var $tplprefix = "/TPL";
|
||||
|
||||
/**
|
||||
* Resources used By Templates and Pages
|
||||
* @var array
|
||||
*/
|
||||
var $_res = array();
|
||||
|
||||
/**
|
||||
* Last used Template data
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
var $lastUsedTemplateData = array();
|
||||
|
||||
/**
|
||||
* Start a Template
|
||||
*
|
||||
* This method starts a template. You can give own coordinates to build an own sized
|
||||
* Template. Pay attention, that the margins are adapted to the new templatesize.
|
||||
* If you want to write outside the template, for example to build a clipped Template,
|
||||
* you have to set the Margins and "Cursor"-Position manual after beginTemplate-Call.
|
||||
*
|
||||
* If no parameter is given, the template uses the current page-size.
|
||||
* The Method returns an ID of the current Template. This ID is used later for using this template.
|
||||
* Warning: A created Template is used in PDF at all events. Still if you don't use it after creation!
|
||||
*
|
||||
* @param int $x The x-coordinate given in user-unit
|
||||
* @param int $y The y-coordinate given in user-unit
|
||||
* @param int $w The width given in user-unit
|
||||
* @param int $h The height given in user-unit
|
||||
* @return int The ID of new created Template
|
||||
*/
|
||||
function beginTemplate($x = null, $y = null, $w = null, $h = null) {
|
||||
if (is_subclass_of($this, 'TCPDF')) {
|
||||
$this->Error('This method is only usable with FPDF. Use TCPDF methods startTemplate() instead.');
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->page <= 0)
|
||||
$this->error("You have to add a page to fpdf first!");
|
||||
|
||||
if ($x == null)
|
||||
$x = 0;
|
||||
if ($y == null)
|
||||
$y = 0;
|
||||
if ($w == null)
|
||||
$w = $this->w;
|
||||
if ($h == null)
|
||||
$h = $this->h;
|
||||
|
||||
// Save settings
|
||||
$this->tpl++;
|
||||
$tpl =& $this->tpls[$this->tpl];
|
||||
$tpl = array(
|
||||
'o_x' => $this->x,
|
||||
'o_y' => $this->y,
|
||||
'o_AutoPageBreak' => $this->AutoPageBreak,
|
||||
'o_bMargin' => $this->bMargin,
|
||||
'o_tMargin' => $this->tMargin,
|
||||
'o_lMargin' => $this->lMargin,
|
||||
'o_rMargin' => $this->rMargin,
|
||||
'o_h' => $this->h,
|
||||
'o_w' => $this->w,
|
||||
'o_FontFamily' => $this->FontFamily,
|
||||
'o_FontStyle' => $this->FontStyle,
|
||||
'o_FontSizePt' => $this->FontSizePt,
|
||||
'o_FontSize' => $this->FontSize,
|
||||
'buffer' => '',
|
||||
'x' => $x,
|
||||
'y' => $y,
|
||||
'w' => $w,
|
||||
'h' => $h
|
||||
);
|
||||
|
||||
$this->SetAutoPageBreak(false);
|
||||
|
||||
// Define own high and width to calculate possitions correct
|
||||
$this->h = $h;
|
||||
$this->w = $w;
|
||||
|
||||
$this->_intpl = true;
|
||||
$this->SetXY($x + $this->lMargin, $y + $this->tMargin);
|
||||
$this->SetRightMargin($this->w - $w + $this->rMargin);
|
||||
|
||||
if ($this->CurrentFont) {
|
||||
$fontkey = $this->FontFamily . $this->FontStyle;
|
||||
$this->_res['tpl'][$this->tpl]['fonts'][$fontkey] =& $this->fonts[$fontkey];
|
||||
|
||||
$this->_out(sprintf('BT /F%d %.2f Tf ET', $this->CurrentFont['i'], $this->FontSizePt));
|
||||
}
|
||||
|
||||
return $this->tpl;
|
||||
}
|
||||
|
||||
/**
|
||||
* End Template
|
||||
*
|
||||
* This method ends a template and reset initiated variables on beginTemplate.
|
||||
*
|
||||
* @return mixed If a template is opened, the ID is returned. If not a false is returned.
|
||||
*/
|
||||
function endTemplate() {
|
||||
if (is_subclass_of($this, 'TCPDF')) {
|
||||
$args = func_get_args();
|
||||
return call_user_func_array(array($this, 'TCPDF::endTemplate'), $args);
|
||||
}
|
||||
|
||||
if ($this->_intpl) {
|
||||
$this->_intpl = false;
|
||||
$tpl =& $this->tpls[$this->tpl];
|
||||
$this->SetXY($tpl['o_x'], $tpl['o_y']);
|
||||
$this->tMargin = $tpl['o_tMargin'];
|
||||
$this->lMargin = $tpl['o_lMargin'];
|
||||
$this->rMargin = $tpl['o_rMargin'];
|
||||
$this->h = $tpl['o_h'];
|
||||
$this->w = $tpl['o_w'];
|
||||
$this->SetAutoPageBreak($tpl['o_AutoPageBreak'], $tpl['o_bMargin']);
|
||||
|
||||
$this->FontFamily = $tpl['o_FontFamily'];
|
||||
$this->FontStyle = $tpl['o_FontStyle'];
|
||||
$this->FontSizePt = $tpl['o_FontSizePt'];
|
||||
$this->FontSize = $tpl['o_FontSize'];
|
||||
|
||||
$fontkey = $this->FontFamily . $this->FontStyle;
|
||||
if ($fontkey)
|
||||
$this->CurrentFont =& $this->fonts[$fontkey];
|
||||
|
||||
return $this->tpl;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Use a Template in current Page or other Template
|
||||
*
|
||||
* You can use a template in a page or in another template.
|
||||
* You can give the used template a new size like you use the Image()-method.
|
||||
* All parameters are optional. The width or height is calculated automaticaly
|
||||
* if one is given. If no parameter is given the origin size as defined in
|
||||
* beginTemplate() is used.
|
||||
* The calculated or used width and height are returned as an array.
|
||||
*
|
||||
* @param int $tplidx A valid template-Id
|
||||
* @param int $_x The x-position
|
||||
* @param int $_y The y-position
|
||||
* @param int $_w The new width of the template
|
||||
* @param int $_h The new height of the template
|
||||
* @retrun array The height and width of the template
|
||||
*/
|
||||
function useTemplate($tplidx, $_x = null, $_y = null, $_w = 0, $_h = 0) {
|
||||
if ($this->page <= 0)
|
||||
$this->error('You have to add a page first!');
|
||||
|
||||
if (!isset($this->tpls[$tplidx]))
|
||||
$this->error('Template does not exist!');
|
||||
|
||||
if ($this->_intpl) {
|
||||
$this->_res['tpl'][$this->tpl]['tpls'][$tplidx] =& $this->tpls[$tplidx];
|
||||
}
|
||||
|
||||
$tpl =& $this->tpls[$tplidx];
|
||||
$w = $tpl['w'];
|
||||
$h = $tpl['h'];
|
||||
|
||||
if ($_x == null)
|
||||
$_x = 0;
|
||||
if ($_y == null)
|
||||
$_y = 0;
|
||||
|
||||
$_x += $tpl['x'];
|
||||
$_y += $tpl['y'];
|
||||
|
||||
$wh = $this->getTemplateSize($tplidx, $_w, $_h);
|
||||
$_w = $wh['w'];
|
||||
$_h = $wh['h'];
|
||||
|
||||
$tData = array(
|
||||
'x' => $this->x,
|
||||
'y' => $this->y,
|
||||
'w' => $_w,
|
||||
'h' => $_h,
|
||||
'scaleX' => ($_w / $w),
|
||||
'scaleY' => ($_h / $h),
|
||||
'tx' => $_x,
|
||||
'ty' => ($this->h - $_y - $_h),
|
||||
'lty' => ($this->h - $_y - $_h) - ($this->h - $h) * ($_h / $h)
|
||||
);
|
||||
|
||||
$this->_out(sprintf('q %.4F 0 0 %.4F %.4F %.4F cm', $tData['scaleX'], $tData['scaleY'], $tData['tx'] * $this->k, $tData['ty'] * $this->k)); // Translate
|
||||
$this->_out(sprintf('%s%d Do Q', $this->tplprefix, $tplidx));
|
||||
|
||||
$this->lastUsedTemplateData = $tData;
|
||||
|
||||
return array('w' => $_w, 'h' => $_h);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get The calculated Size of a Template
|
||||
*
|
||||
* If one size is given, this method calculates the other one.
|
||||
*
|
||||
* @param int $tplidx A valid template-Id
|
||||
* @param int $_w The width of the template
|
||||
* @param int $_h The height of the template
|
||||
* @return array The height and width of the template
|
||||
*/
|
||||
function getTemplateSize($tplidx, $_w = 0, $_h = 0) {
|
||||
if (!isset($this->tpls[$tplidx]))
|
||||
return false;
|
||||
|
||||
$tpl =& $this->tpls[$tplidx];
|
||||
$w = $tpl['w'];
|
||||
$h = $tpl['h'];
|
||||
|
||||
if ($_w == 0 and $_h == 0) {
|
||||
$_w = $w;
|
||||
$_h = $h;
|
||||
}
|
||||
|
||||
if($_w == 0)
|
||||
$_w = $_h * $w / $h;
|
||||
if($_h == 0)
|
||||
$_h = $_w * $h / $w;
|
||||
|
||||
return array("w" => $_w, "h" => $_h);
|
||||
}
|
||||
|
||||
/**
|
||||
* See FPDF/TCPDF-Documentation ;-)
|
||||
*/
|
||||
public function SetFont($family, $style = '', $size = 0, $fontfile='', $subset='default', $out=true) {
|
||||
if (is_subclass_of($this, 'TCPDF')) {
|
||||
$args = func_get_args();
|
||||
return call_user_func_array(array($this, 'TCPDF::SetFont'), $args);
|
||||
}
|
||||
|
||||
parent::SetFont($family, $style, $size);
|
||||
|
||||
$fontkey = $this->FontFamily . $this->FontStyle;
|
||||
|
||||
if ($this->_intpl) {
|
||||
$this->_res['tpl'][$this->tpl]['fonts'][$fontkey] =& $this->fonts[$fontkey];
|
||||
} else {
|
||||
$this->_res['page'][$this->page]['fonts'][$fontkey] =& $this->fonts[$fontkey];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* See FPDF/TCPDF-Documentation ;-)
|
||||
*/
|
||||
function Image(
|
||||
$file, $x = '', $y = '', $w = 0, $h = 0, $type = '', $link = '', $align = '', $resize = false,
|
||||
$dpi = 300, $palign = '', $ismask = false, $imgmask = false, $border = 0, $fitbox = false,
|
||||
$hidden = false, $fitonpage = false, $alt = false, $altimgs = array()
|
||||
) {
|
||||
if (is_subclass_of($this, 'TCPDF')) {
|
||||
$args = func_get_args();
|
||||
return call_user_func_array(array($this, 'TCPDF::Image'), $args);
|
||||
}
|
||||
|
||||
$ret = parent::Image($file, $x, $y, $w, $h, $type, $link);
|
||||
if ($this->_intpl) {
|
||||
$this->_res['tpl'][$this->tpl]['images'][$file] =& $this->images[$file];
|
||||
} else {
|
||||
$this->_res['page'][$this->page]['images'][$file] =& $this->images[$file];
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* See FPDF-Documentation ;-)
|
||||
*
|
||||
* AddPage is not available when you're "in" a template.
|
||||
*/
|
||||
function AddPage($orientation = '', $format = '', $keepmargins = false, $tocpage = false) {
|
||||
if (is_subclass_of($this, 'TCPDF')) {
|
||||
$args = func_get_args();
|
||||
return call_user_func_array(array($this, 'TCPDF::AddPage'), $args);
|
||||
}
|
||||
|
||||
if ($this->_intpl)
|
||||
$this->Error('Adding pages in templates isn\'t possible!');
|
||||
|
||||
parent::AddPage($orientation, $format);
|
||||
}
|
||||
|
||||
/**
|
||||
* Preserve adding Links in Templates ...won't work
|
||||
*/
|
||||
function Link($x, $y, $w, $h, $link, $spaces = 0) {
|
||||
if (is_subclass_of($this, 'TCPDF')) {
|
||||
$args = func_get_args();
|
||||
return call_user_func_array(array($this, 'TCPDF::Link'), $args);
|
||||
}
|
||||
|
||||
if ($this->_intpl)
|
||||
$this->Error('Using links in templates aren\'t possible!');
|
||||
|
||||
parent::Link($x, $y, $w, $h, $link);
|
||||
}
|
||||
|
||||
function AddLink() {
|
||||
if (is_subclass_of($this, 'TCPDF')) {
|
||||
$args = func_get_args();
|
||||
return call_user_func_array(array($this, 'TCPDF::AddLink'), $args);
|
||||
}
|
||||
|
||||
if ($this->_intpl)
|
||||
$this->Error('Adding links in templates aren\'t possible!');
|
||||
return parent::AddLink();
|
||||
}
|
||||
|
||||
function SetLink($link, $y = 0, $page = -1) {
|
||||
if (is_subclass_of($this, 'TCPDF')) {
|
||||
$args = func_get_args();
|
||||
return call_user_func_array(array($this, 'TCPDF::SetLink'), $args);
|
||||
}
|
||||
|
||||
if ($this->_intpl)
|
||||
$this->Error('Setting links in templates aren\'t possible!');
|
||||
parent::SetLink($link, $y, $page);
|
||||
}
|
||||
|
||||
/**
|
||||
* Private Method that writes the form xobjects
|
||||
*/
|
||||
function _putformxobjects() {
|
||||
$filter=($this->compress) ? '/Filter /FlateDecode ' : '';
|
||||
reset($this->tpls);
|
||||
foreach($this->tpls AS $tplidx => $tpl) {
|
||||
|
||||
$p=($this->compress) ? gzcompress($tpl['buffer']) : $tpl['buffer'];
|
||||
$this->_newobj();
|
||||
$this->tpls[$tplidx]['n'] = $this->n;
|
||||
$this->_out('<<'.$filter.'/Type /XObject');
|
||||
$this->_out('/Subtype /Form');
|
||||
$this->_out('/FormType 1');
|
||||
$this->_out(sprintf('/BBox [%.2F %.2F %.2F %.2F]',
|
||||
// llx
|
||||
$tpl['x'] * $this->k,
|
||||
// lly
|
||||
-$tpl['y'] * $this->k,
|
||||
// urx
|
||||
($tpl['w'] + $tpl['x']) * $this->k,
|
||||
// ury
|
||||
($tpl['h'] - $tpl['y']) * $this->k
|
||||
));
|
||||
|
||||
if ($tpl['x'] != 0 || $tpl['y'] != 0) {
|
||||
$this->_out(sprintf('/Matrix [1 0 0 1 %.5F %.5F]',
|
||||
-$tpl['x'] * $this->k * 2, $tpl['y'] * $this->k * 2
|
||||
));
|
||||
}
|
||||
|
||||
$this->_out('/Resources ');
|
||||
|
||||
$this->_out('<</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]');
|
||||
if (isset($this->_res['tpl'][$tplidx]['fonts']) && count($this->_res['tpl'][$tplidx]['fonts'])) {
|
||||
$this->_out('/Font <<');
|
||||
foreach($this->_res['tpl'][$tplidx]['fonts'] as $font)
|
||||
$this->_out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R');
|
||||
$this->_out('>>');
|
||||
}
|
||||
if(isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images']) ||
|
||||
isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls']))
|
||||
{
|
||||
$this->_out('/XObject <<');
|
||||
if (isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images'])) {
|
||||
foreach($this->_res['tpl'][$tplidx]['images'] as $image)
|
||||
$this->_out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R');
|
||||
}
|
||||
if (isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls'])) {
|
||||
foreach($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl)
|
||||
$this->_out($this->tplprefix . $i . ' ' . $tpl['n'] . ' 0 R');
|
||||
}
|
||||
$this->_out('>>');
|
||||
}
|
||||
$this->_out('>>');
|
||||
|
||||
$this->_out('/Length ' . strlen($p) . ' >>');
|
||||
$this->_putstream($p);
|
||||
$this->_out('endobj');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Overwritten to add _putformxobjects() after _putimages()
|
||||
*
|
||||
*/
|
||||
function _putimages() {
|
||||
parent::_putimages();
|
||||
$this->_putformxobjects();
|
||||
}
|
||||
|
||||
function _putxobjectdict() {
|
||||
parent::_putxobjectdict();
|
||||
|
||||
if (count($this->tpls)) {
|
||||
foreach($this->tpls as $tplidx => $tpl) {
|
||||
$this->_out(sprintf('%s%d %d 0 R', $this->tplprefix, $tplidx, $tpl['n']));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Private Method
|
||||
*/
|
||||
function _out($s) {
|
||||
if ($this->state == 2 && $this->_intpl) {
|
||||
$this->tpls[$this->tpl]['buffer'] .= $s . "\n";
|
||||
} else {
|
||||
parent::_out($s);
|
||||
}
|
||||
}
|
||||
}
|
||||
1154
vendor/cloudframework-io/tcpdi_cf/tcpdi.php
vendored
Executable file
1154
vendor/cloudframework-io/tcpdi_cf/tcpdi.php
vendored
Executable file
File diff suppressed because it is too large
Load Diff
1459
vendor/cloudframework-io/tcpdi_cf/tcpdi_parser.php
vendored
Executable file
1459
vendor/cloudframework-io/tcpdi_cf/tcpdi_parser.php
vendored
Executable file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user