This commit is contained in:
wangjinlei
2024-07-17 09:23:45 +08:00
parent edf9deeb1a
commit 881ac3e056
1001 changed files with 41032 additions and 5452 deletions

View File

@@ -1,3 +1,63 @@
6.7.5 (2024-04-20)
- Update GitHub actions
- fix: CSV-2024-22640 (#712)
6.7.4 (2024-03-24)
- Upgrade tcpdf tag encryption algorithm.
- Fix regression issue #699.
- Fix security issue.
- [BREAKING CHANGE] The tcpdf HTML tag syntax has changed, see example_049.php.
- New K_ALLOWED_TCPDF_TAGS configuration constant to set the allowed methods for the tcdpf HTML tag.
- Raised minimum PHP version to PHP 5.5.0.
6.6.5 (2023-09-02)
- Fix corrupted file.
- Fix GitHub automation tests.
- Fix SPDX license ID (#591)
- Fix warning "array offset on value of type null" (#620)
- Improve the README about the status of this library (#589)
- Fix deprecation warning with PHP 8.1 (#614)
- Fixes for PHP 8.2 in tcpdf_fonts.php (#632)
- Fix some php 8+ edge cases (#630)
- Fix composite glyph output (#581)
- Fix "access array offset on value of type bool" with PDF/A (#583)
- Fix non-numeric value warning (#627)
- Fix issues with S25 barcode (#611)
- Fix return type annotations (#613)
- Fix some inconsistencies in type hints (#598)
6.6.2 (2022-12-17)
- Ensure pregSplit return type is always array.
- Add ability to run tests on various operating systems (#566)
- Avoid a deprecated error from PHP8.1 (#573)
6.6.1 (2022-12-12)
- Add PHPStan and fix level 1 errors (#307)
6.6.0 (2022-12-06)
- Multi-byte character support for filename during output (#561). (#562)
- Fix garbage collection (#509)
- FIX: PDF417 corrupt output problem, solution set bcmath scale parameter to zero (#534)
- Fix TypeError: count() in PHP8 (#556)
- Fix-getHTMLFontUnits (#547)
- Improved embedded image in HTML allowing src="data:..." format (#552)
- Fix image abscissa when in RTL (#510)
- fix: php 8.1 notices (#548)
- Optimize PNG files (#563)
- Update documentation for a known issue. (#569)
- Fix for PHP 8.1 (#571)
6.5.0 (2022-08-12)
- encodeUrlQuery takes into account the port (#493)
- Fixing undefined offset error in writeHTML() when last DOM element ha…
- correct some type hints (#495)
- fix: php 8.1 notices (#481)
- Fixed: null check for PHP 8.1 (#476)
- Fix Infinite Loop in Multicell with Auto Page Breaks Off (#473)
- GetCssBorderStyle Has Problem When !important Is Specified (#467)
- Support Apache 2.4 directives in htaccess file (#530)
- Remove examples from dist package (#542)
6.4.4 (2021-12-31)
- PHP 8.1 fixes

View File

@@ -7,7 +7,7 @@
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
2002-2019 Nicola Asuni - Tecnick.com LTD
2002-2024 Nicola Asuni - Tecnick.com LTD
**********************************************************************
**********************************************************************

View File

@@ -6,15 +6,14 @@
* **category** Library
* **author** Nicola Asuni <info@tecnick.com>
* **copyright** 2002-2021 Nicola Asuni - Tecnick.com LTD
* **copyright** 2002-2024 Nicola Asuni - Tecnick.com LTD
* **license** http://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE.TXT)
* **link** http://www.tcpdf.org
* **source** https://github.com/tecnickcom/TCPDF
## IMPORTANT
A new version of this library is under development at https://github.com/tecnickcom/tc-lib-pdf and as a consequence this version will not receive any additional development or support.
This version should be considered obsolete, new projects should use the new version as soon it will become stable.
## NOTE
A new version of this library is under development at https://github.com/tecnickcom/tc-lib-pdf and as a consequence this library is in support only mode.

View File

@@ -1 +1 @@
6.4.4
6.7.5

View File

@@ -12,8 +12,8 @@
"barcodes"
],
"homepage": "http://www.tcpdf.org/",
"version": "6.4.4",
"license": "LGPL-3.0-only",
"version": "6.7.5",
"license": "LGPL-3.0-or-later",
"authors": [
{
"name": "Nicola Asuni",
@@ -22,7 +22,7 @@
}
],
"require": {
"php": ">=5.3.0"
"php": ">=5.5.0"
},
"autoload": {
"classmap": [
@@ -43,5 +43,10 @@
"include/barcodes/pdf417.php",
"include/barcodes/qrcode.php"
]
},
"archive": {
"exclude": [
"/examples"
]
}
}

View File

@@ -212,6 +212,14 @@ define('K_THAI_TOPCHARS', true);
*/
define('K_TCPDF_CALLS_IN_HTML', false);
/**
* List of TCPDF methods that are allowed to be called using HTML syntax.
* Note: each method name must end with surrounded with | (pipe) character.
* The constant K_TCPDF_CALLS_IN_HTML must be set to true.
* IMPORTANT: For security reason, disable this feature if you are allowing user HTML content.
*/
define('K_ALLOWED_TCPDF_TAGS', '');
/**
* If true and PHP version is greater than 5, then the Error() method throw new exception instead of terminating the execution.
*/

View File

@@ -37,6 +37,10 @@
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 1.0.000
* @group barcode
* @group 1d
* @group html
* @group comparable
*/
// include 1D barcode class (search for installation path)

View File

@@ -37,6 +37,9 @@
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 1.0.000
* @group barcode
* @group 1d
* @group png
*/
// include 1D barcode class (search for installation path)

View File

@@ -37,6 +37,10 @@
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 1.0.000
* @group barcode
* @group 1d
* @group svg
* @group comparable
*/
// include 1D barcode class (search for installation path)

View File

@@ -37,6 +37,10 @@
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 1.0.000
* @group barcode
* @group 1d
* @group svg
* @group comparable
*/
// include 1D barcode class (search for installation path)

View File

@@ -37,6 +37,10 @@
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 1.0.009
* @group barcode
* @group datamatrix
* @group html
* @group comparable
*/
// include 2D barcode class (search for installation path)

View File

@@ -37,6 +37,9 @@
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 1.0.009
* @group barcode
* @group datamatrix
* @group png
*/
// include 2D barcode class (search for installation path)

View File

@@ -37,6 +37,10 @@
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 1.0.009
* @group barcode
* @group datamatrix
* @group svg
* @group comparable
*/
// include 2D barcode class (search for installation path)

View File

@@ -37,6 +37,10 @@
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 1.0.009
* @group barcode
* @group datamatrix
* @group svg
* @group comparable
*/
// include 2D barcode class (search for installation path)

View File

@@ -37,6 +37,10 @@
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 1.0.009
* @group barcode
* @group pdf417
* @group html
* @group comparable
*/
// include 2D barcode class (search for installation path)

View File

@@ -37,6 +37,9 @@
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 1.0.009
* @group barcode
* @group pdf417
* @group png
*/
// include 2D barcode class (search for installation path)

View File

@@ -37,6 +37,10 @@
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 1.0.009
* @group barcode
* @group pdf417
* @group svg
* @group comparable
*/
// include 2D barcode class (search for installation path)

View File

@@ -37,6 +37,10 @@
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 1.0.009
* @group barcode
* @group pdf417
* @group svg
* @group comparable
*/
// include 2D barcode class (search for installation path)

View File

@@ -37,6 +37,9 @@
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 1.0.009
* @group barcode
* @group qrcode
* @group html
*/
// include 2D barcode class (search for installation path)

View File

@@ -37,6 +37,9 @@
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 1.0.009
* @group barcode
* @group qrcode
* @group png
*/
// include 2D barcode class (search for installation path)

View File

@@ -37,6 +37,9 @@
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 1.0.009
* @group barcode
* @group qrcode
* @group svg
*/
// include 2D barcode class (search for installation path)

View File

@@ -37,6 +37,9 @@
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 1.0.009
* @group barcode
* @group qrcode
* @group svg
*/
// include 2D barcode class (search for installation path)

View File

@@ -212,6 +212,14 @@ define('K_THAI_TOPCHARS', true);
*/
define('K_TCPDF_CALLS_IN_HTML', true);
/**
* List of TCPDF methods that are allowed to be called using HTML syntax.
* Note: each method name must end with surrounded with | (pipe) character.
* The constant K_TCPDF_CALLS_IN_HTML must be set to true.
* IMPORTANT: For security reason, disable this feature if you are allowing user HTML content.
*/
define('K_ALLOWED_TCPDF_TAGS', '|AddPage|Rect|SetDrawColor|write1DBarcode|');
/**
* If true and PHP version is greater than 5, then the Error() method throw new exception instead of terminating the execution.
*/

View File

@@ -22,6 +22,10 @@
* @abstract TCPDF - Example: Default Header and Footer
* @author Nicola Asuni
* @since 2008-03-04
* @group header
* @group footer
* @group page
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,10 @@
* @abstract TCPDF - Example: Removing Header and Footer
* @author Nicola Asuni
* @since 2008-03-04
* @group header
* @group footer
* @group page
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,10 @@
* @abstract TCPDF - Example: Custom Header and Footer
* @author Nicola Asuni
* @since 2008-03-04
* @group header
* @group footer
* @group page
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,8 @@
* @abstract TCPDF - Example: Cell stretching
* @author Nicola Asuni
* @since 2008-03-04
* @group cell
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,8 @@
* @abstract TCPDF - Example: Multicell
* @author Nicola Asuni
* @since 2008-03-04
* @group cell
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,9 @@
* @abstract TCPDF - Example: WriteHTML and RTL support
* @author Nicola Asuni
* @since 2008-03-04
* @group html
* @group rtl
* @group pdf
*/
// Include the main TCPDF library (search for installation path).
@@ -224,6 +227,20 @@ $html = '<h1>Image alignments on HTML table</h1>
// output the HTML content
$pdf->writeHTML($html, true, false, true, false, '');
// create some HTML content
$html = '<h1>Embedded Images</h1>
<table cellpadding="1" cellspacing="1" border="1" style="text-align:center;">
<tr><td>src="@..." </td><td><img src="@DATA1@" border="0" height="41" width="41" /></td></tr>
<tr><td>src="data..."</td><td><img src="@DATA2@" border="0" height="41" width="41" /></td></tr>
</table>';
$data = base64_encode(file_get_contents("images/logo_example.png"));
$html = str_replace("@DATA1@", "@" . $data, $html);
$html = str_replace("@DATA2@", "data:image/png;base64," . $data, $html);
// output the HTML content
$pdf->writeHTML($html, true, false, true, false, '');
// reset pointer to the last page
$pdf->lastPage();

View File

@@ -22,6 +22,10 @@
* @abstract TCPDF - Example: Two independent columns with WriteHTMLCell()
* @author Nicola Asuni
* @since 2008-03-04
* @group column
* @group cell
* @group html
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,8 @@
* @abstract TCPDF - Example: Include external UTF-8 text file
* @author Nicola Asuni
* @since 2008-03-04
* @group unicode
* @group pdf
*/
// Include the main TCPDF library (search for installation path).
@@ -75,7 +77,7 @@ $pdf->setFont('freeserif', '', 12);
// add a page
$pdf->AddPage();
// get esternal file content
// get external file content
$utf8text = file_get_contents('data/utf8test.txt', false);
// set color for text

View File

@@ -22,6 +22,8 @@
* @abstract TCPDF - Example: Test Image
* @author Nicola Asuni
* @since 2008-03-04
* @group image
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,8 @@
* @abstract TCPDF - Example: Text on multiple columns
* @author Nicola Asuni
* @since 2008-03-04
* @group column
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,9 @@
* @abstract TCPDF - Example: Colored Table
* @author Nicola Asuni
* @since 2008-03-04
* @group table
* @group color
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,8 @@
* @abstract TCPDF - Example: Graphic Functions
* @author Nicola Asuni
* @since 2008-03-04
* @group drawing
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,8 @@
* @abstract TCPDF - Example: Graphic Transformations
* @author Nicola Asuni
* @since 2008-03-04
* @group drawing
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,9 @@
* @abstract TCPDF - Example: Javascript Form and user rights (only works on Adobe Acrobat)
* @author Nicola Asuni
* @since 2008-03-04
* @group javascript
* @group form
* @group pdf
*/
@@ -70,7 +73,7 @@ if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
// IMPORTANT: disable font subsetting to allow users editing the document
$pdf->setFontSubsetting(false);
// set font
// set font. 'helvetica' MUST be used to avoid a PHP notice from PHP 7.4+
$pdf->setFont('helvetica', '', 10, '', false);
// add a page

View File

@@ -23,6 +23,9 @@
* @abstract TCPDF - Example: Bookmarks (Table of Content)
* @author Nicola Asuni
* @since 2008-03-04
* @group toc
* @group bookmark
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,8 @@
* @abstract TCPDF - Example: Document Encryption / Security
* @author Nicola Asuni
* @since 2008-03-04
* @group security
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,9 @@
* @abstract TCPDF - Example: Two independent columns with MultiCell
* @author Nicola Asuni
* @since 2008-03-04
* @group column
* @group cell
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,8 @@
* @abstract TCPDF - Example: RTL document with Persian language
* @author Nicola Asuni
* @since 2008-03-06
* @group rtl
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,8 @@
* @abstract TCPDF - Example: Non unicode with alternative config file
* @author Nicola Asuni
* @since 2008-03-04
* @group unicode
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -23,6 +23,9 @@
* @abstract TCPDF - Example: Two columns composed by MultiCell of different heights
* @author Nicola Asuni
* @since 2008-03-04
* @group cell
* @group column
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,8 @@
* @abstract TCPDF - Example: WriteHTML text flow.
* @author Nicola Asuni
* @since 2008-03-04
* @group html
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,8 @@
* @abstract TCPDF - Example: CMYK colors.
* @author Nicola Asuni
* @since 2008-03-04
* @group color
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,8 @@
* @abstract TCPDF - Example: Page Groups.
* @author Nicola Asuni
* @since 2008-03-04
* @group page
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,8 @@
* @abstract TCPDF - Example: Object Visibility and Layers
* @author Nicola Asuni
* @since 2008-03-04
* @group drawing
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,8 @@
* @abstract TCPDF - Example: Object Transparency
* @author Nicola Asuni
* @since 2008-03-04
* @group drawing
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,7 @@
* @abstract TCPDF - Example: Text Rendering Modes and Text Clipping
* @author Nicola Asuni
* @since 2008-03-04
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,8 @@
* @abstract TCPDF - Example: 1D Barcodes.
* @author Nicola Asuni
* @since 2008-03-04
* @group barcode
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,8 @@
* @abstract TCPDF - Example: changing page formats
* @author Nicola Asuni
* @since 2008-03-04
* @group page
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,8 @@
* @abstract TCPDF - Example: Set PDF viewer display preferences.
* @author Nicola Asuni
* @since 2008-06-09
* @group viewer
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,8 @@
* @abstract TCPDF - Example: Colour gradients
* @author Nicola Asuni
* @since 2008-06-09
* @group color
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,8 @@
* @abstract TCPDF - Example: Pie Chart
* @author Nicola Asuni
* @since 2008-06-09
* @group drawing
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,8 @@
* @abstract TCPDF - Example: EPS/AI image
* @author Nicola Asuni
* @since 2008-06-09
* @group image
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,8 @@
* @abstract TCPDF - Example: Mixed font types
* @author Nicola Asuni
* @since 2008-06-24
* @group font
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,8 @@
* @abstract TCPDF - Example: Clipping
* @author Nicola Asuni
* @since 2008-03-04
* @group cell
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,8 @@
* @abstract TCPDF - Example: Line styles with cells and multicells
* @author Nicola Asuni
* @since 2008-03-04
* @group cell
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,8 @@
* @abstract TCPDF - Example: Annotations
* @author Nicola Asuni
* @since 2008-08-08
* @group annotation
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,8 @@
* @abstract TCPDF - Example: Spot colors.
* @author Nicola Asuni
* @since 2008-09-12
* @group color
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,8 @@
* @abstract TCPDF - Example: CID-0 CJK unembedded font
* @author Nicola Asuni
* @since 2008-09-15
* @group font
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,8 @@
* @abstract TCPDF - Example: HTML justification
* @author Nicola Asuni
* @since 2008-10-18
* @group html
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,8 @@
* @abstract TCPDF - Example: Booklet mode (double-sided pages)
* @author Nicola Asuni
* @since 2008-10-28
* @group page
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,9 @@
* @abstract TCPDF - Annotation - FileAttachment
* @author Nicola Asuni
* @since 2008-12-07
* @group annotation
* @group attachment
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,8 @@
* @abstract TCPDF - Example: Test Image with alpha channel
* @author Nicola Asuni
* @since 2008-12-23
* @group image
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,8 @@
* @abstract TCPDF - Example: Disk caching
* @author Nicola Asuni
* @since 2009-01-02
* @group cache
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,8 @@
* @abstract TCPDF - Example: Move, copy and delete pages
* @author Nicola Asuni
* @since 2009-01-02
* @group page
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,9 @@
* @abstract TCPDF - Example: Bookmarks and Table of Content
* @author Nicola Asuni
* @since 2008-03-04
* @group toc
* @group bookmark
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,8 @@
* @abstract TCPDF - Example: text Hyphenation
* @author Nicola Asuni
* @since 2009-02-28
* @group text
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,8 @@
* @abstract TCPDF - Example: Transactions
* @author Nicola Asuni
* @since 2009-03-19
* @group transaction
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,9 @@
* @abstract TCPDF - Example: HTML tables and table headers
* @author Nicola Asuni
* @since 2009-03-20
* @group html
* @group table
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -2,7 +2,7 @@
//============================================================+
// File name : example_049.php
// Begin : 2009-04-03
// Last Update : 2014-12-10
// Last Update : 2024-03-18
//
// Description : Example 049 for TCPDF class
// WriteHTML with TCPDF callback functions
@@ -22,6 +22,8 @@
* @abstract TCPDF - Example: WriteHTML with TCPDF callback functions
* @author Nicola Asuni
* @since 2008-03-04
* @group html
* @group pdf
*/
// Include the main TCPDF library (search for installation path).
@@ -76,36 +78,36 @@ $pdf->AddPage();
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
IMPORTANT:
If you are printing user-generated content, tcpdf tag can be unsafe.
You can disable this tag by setting to false the K_TCPDF_CALLS_IN_HTML
constant on TCPDF configuration file.
If you are printing user-generated content, the tcpdf tag should be considered unsafe.
This tag is disabled by default by the K_TCPDF_CALLS_IN_HTML constant on TCPDF configuration file.
Please use this feature only if you are in control of the HTML content and you are sure that it does not contain any harmful code.
For security reasons, the parameters for the 'params' attribute of TCPDF
tag must be prepared as an array and encoded with the
serializeTCPDFtagParameters() method (see the example below).
For security reasons, the content of the TCPDF tag must be prepared and encoded with the serializeTCPDFtag() method (see the example below).
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
$html = '<h1>Test TCPDF Methods in HTML</h1>
<h2 style="color:red;">IMPORTANT:</h2>
<span style="color:red;">If you are using user-generated content, the tcpdf tag can be unsafe.<br />
You can disable this tag by setting to false the <b>K_TCPDF_CALLS_IN_HTML</b> constant on TCPDF configuration file.</span>
<span style="color:red;">If you are using user-generated content, the tcpdf tag should be considered unsafe.<br />
Please use this feature only if you are in control of the HTML content and you are sure that it does not contain any harmful code.<br />
This feature is disabled by default by the <b>K_TCPDF_CALLS_IN_HTML</b> constant on TCPDF configuration file.</span>
<h2>write1DBarcode method in HTML</h2>';
$params = $pdf->serializeTCPDFtagParameters(array('CODE 39', 'C39', '', '', 80, 30, 0.4, array('position'=>'S', 'border'=>true, 'padding'=>4, 'fgcolor'=>array(0,0,0), 'bgcolor'=>array(255,255,255), 'text'=>true, 'font'=>'helvetica', 'fontsize'=>8, 'stretchtext'=>4), 'N'));
$html .= '<tcpdf method="write1DBarcode" params="'.$params.'" />';
$data = $pdf->serializeTCPDFtag('write1DBarcode', array('CODE 39', 'C39', '', '', 80, 30, 0.4, array('position'=>'S', 'border'=>true, 'padding'=>4, 'fgcolor'=>array(0,0,0), 'bgcolor'=>array(255,255,255), 'text'=>true, 'font'=>'helvetica', 'fontsize'=>8, 'stretchtext'=>4), 'N'));
$html .= '<tcpdf data="'.$data.'" />';
$params = $pdf->serializeTCPDFtagParameters(array('CODE 128', 'C128', '', '', 80, 30, 0.4, array('position'=>'S', 'border'=>true, 'padding'=>4, 'fgcolor'=>array(0,0,0), 'bgcolor'=>array(255,255,255), 'text'=>true, 'font'=>'helvetica', 'fontsize'=>8, 'stretchtext'=>4), 'N'));
$html .= '<tcpdf method="write1DBarcode" params="'.$params.'" />';
$data = $pdf->serializeTCPDFtag('write1DBarcode', array('CODE 128', 'C128', '', '', 80, 30, 0.4, array('position'=>'S', 'border'=>true, 'padding'=>4, 'fgcolor'=>array(0,0,0), 'bgcolor'=>array(255,255,255), 'text'=>true, 'font'=>'helvetica', 'fontsize'=>8, 'stretchtext'=>4), 'N'));
$html .= '<tcpdf data="'.$data.'" />';
$html .= '<tcpdf method="AddPage" /><h2>Graphic Functions</h2>';
$data = $pdf->serializeTCPDFtag('AddPage');
$html .= '<tcpdf data="'.$data.'" /><h2>Graphic Functions</h2>';
$params = $pdf->serializeTCPDFtagParameters(array(0));
$html .= '<tcpdf method="SetDrawColor" params="'.$params.'" />';
$data = $pdf->serializeTCPDFtag('SetDrawColor', array(0));
$html .= '<tcpdf data="'.$data.'" />';
$params = $pdf->serializeTCPDFtagParameters(array(50, 50, 40, 10, 'DF', array(), array(0,128,255)));
$html .= '<tcpdf method="Rect" params="'.$params.'" />';
$data = $pdf->serializeTCPDFtag('Rect', array(50, 50, 40, 10, 'DF', array(), array(0,128,255)));
$html .= '<tcpdf data="'.$data.'" />';
// output the HTML content

View File

@@ -22,6 +22,8 @@
* @abstract TCPDF - Example: 2D barcodes.
* @author Nicola Asuni
* @since 2008-03-04
* @group barcode
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,9 @@
* @abstract TCPDF - Example: Full page background
* @author Nicola Asuni
* @since 2009-04-16
* @group background
* @group page
* @group pdf
*/
// Include the main TCPDF library (search for installation path).
@@ -40,7 +43,7 @@ class MYPDF extends TCPDF {
$this->setAutoPageBreak(false, 0);
// set bacground image
$img_file = K_PATH_IMAGES.'image_demo.jpg';
$this->Image($img_file, 0, 0, 210, 297, '', '', '', false, 300, '', false, false, 0);
$this->Image($img_file, null, 0, 210, 297, '', '', '', false, 300, 'C', false, false, 0);
// restore auto-page-break status
$this->setAutoPageBreak($auto_page_break, $bMargin);
// set the starting point for the page content
@@ -124,7 +127,7 @@ $auto_page_break = $pdf->getAutoPageBreak();
$pdf->setAutoPageBreak(false, 0);
// set bacground image
$img_file = K_PATH_IMAGES.'image_demo.jpg';
$pdf->Image($img_file, 0, 0, 210, 297, '', '', '', false, 300, '', false, false, 0);
$pdf->Image($img_file, null, 0, 210, 297, '', '', '', false, 300, 'C', false, false, 0);
// restore auto-page-break status
$pdf->setAutoPageBreak($auto_page_break, $bMargin);
// set the starting point for the page content

View File

@@ -22,6 +22,8 @@
* @abstract TCPDF - Example: Certification Signature (experimental)
* @author Nicola Asuni
* @since 2009-05-07
* @group security
* @group pdf
*/
// Include the main TCPDF library (search for installation path).
@@ -87,7 +89,7 @@ $info = array(
// set document signature
$pdf->setSignature($certificate, $certificate, 'tcpdfdemo', '', 2, $info);
// set font
// set font. 'helvetica' MUST be used to avoid a PHP notice from PHP 7.4+
$pdf->setFont('helvetica', '', 12);
// add a page

View File

@@ -22,6 +22,8 @@
* @abstract TCPDF - Example: Javascript example.
* @author Nicola Asuni
* @since 2009-09-02
* @group javascript
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,9 @@
* @abstract TCPDF - Example: XHTML Forms
* @author Nicola Asuni
* @since 2009-09-07
* @group html
* @group form
* @group pdf
*/
// Include the main TCPDF library (search for installation path).
@@ -69,7 +72,7 @@ if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
// IMPORTANT: disable font subsetting to allow users editing the document
$pdf->setFontSubsetting(false);
// set font
// set font. 'helvetica' MUST be used to avoid a PHP notice from PHP 7.4+
$pdf->setFont('helvetica', '', 10, '', false);
// add a page

View File

@@ -22,6 +22,9 @@
* @abstract TCPDF - Example: XHTML Forms
* @author Nicola Asuni
* @since 2009-10-21
* @group html
* @group form
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,8 @@
* @abstract TCPDF - Example: Crop marks and color registration bars
* @author Nicola Asuni
* @since 2010-03-26
* @group color
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,8 @@
* @abstract TCPDF - Example: Cell vertical alignments
* @author Nicola Asuni
* @since 2008-03-04
* @group cell
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,9 @@
* @abstract TCPDF - Example: SVG Image
* @author Nicola Asuni
* @since 2010-05-02
* @group svg
* @group image
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,9 @@
* @abstract TCPDF - Example: Table Of Content using HTML templates.
* @author Nicola Asuni
* @since 2010-05-06
* @group toc
* @group html
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,8 @@
* @abstract TCPDF - Example: Advanced page settings.
* @author Nicola Asuni
* @since 2010-05-17
* @group page
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,9 @@
* @abstract TCPDF - Example: XHTML + CSS
* @author Nicola Asuni
* @since 2010-05-25
* @group html
* @group css
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,8 @@
* @abstract TCPDF - Example: XObject Template
* @author Nicola Asuni
* @since 2010-08-25
* @group object
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,8 @@
* @abstract TCPDF - Example: Text stretching and spacing (tracking)
* @author Nicola Asuni
* @since 2010-09-29
* @group text
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,8 @@
* @abstract TCPDF - Example: No-write page regions
* @author Nicola Asuni
* @since 2010-10-14
* @group page
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -22,6 +22,8 @@
* @abstract TCPDF - Example: PDF/A-1b mode
* @author Nicola Asuni
* @since 2011-09-28
* @group A-1b
* @group pdf
*/
// Include the main TCPDF library (search for installation path).

View File

@@ -14,10 +14,12 @@
* @abstract TCPDF - Example: PDF/A-1b mode
* @author Nicola Asuni
* @since 2021-03-26
* @group A-1b
* @group pdf
*/
// Load the autoloader, move one folder back from examples
require_once __DIR__ . '/../vendor/autoload.php';
// Include the main TCPDF library (search for installation path).
require_once('tcpdf_include.php');
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false, true);

View File

@@ -0,0 +1,223 @@
<?php
//============================================================+
// File name : example_067.php
// Begin : 2022-01-07
// Last Update : 2022-01-07
//
// Description : Example 067 for TCPDF class
// HTML tables with !important in style
//
// Author: Nicola Asuni
//
// (c) Copyright:
// Nicola Asuni
// Tecnick.com LTD
// www.tecnick.com
// info@tecnick.com
//============================================================+
/**
* Creates an example PDF TEST document using TCPDF
* @package com.tecnick.tcpdf
* @abstract TCPDF - Example: HTML tables and table headers
* @author Nicola Asuni
* @since 2009-03-20
* @group html
* @group table
* @group pdf
*/
// Include the main TCPDF library (search for installation path).
require_once('tcpdf_include.php');
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->setCreator(PDF_CREATOR);
$pdf->setAuthor('Owen Leibman');
$pdf->setTitle('TCPDF Example 067');
$pdf->setSubject('TCPDF Tutorial');
$pdf->setKeywords('TCPDF, PDF, example, test, guide');
// set default header data
$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 067', PDF_HEADER_STRING);
// set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->setHeaderMargin(PDF_MARGIN_HEADER);
$pdf->setFooterMargin(PDF_MARGIN_FOOTER);
// set auto page breaks
$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language-dependent strings (optional)
if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
require_once(dirname(__FILE__).'/lang/eng.php');
$pdf->setLanguageArray($l);
}
// ---------------------------------------------------------
// set font
$pdf->setFont('helvetica', 'B', 20);
// add a page
$pdf->AddPage();
$pdf->Write(0, 'Example of HTML tables', '', 0, 'L', true, 0, false, false, 0);
$pdf->setFont('helvetica', '', 8);
// -----------------------------------------------------------------------------
$tbl = <<<EOD
<table cellspacing="0" cellpadding="1" style="border: 1px dotted red;">
<tr>
<td rowspan="3">COL 1 - ROW 1<br />COLSPAN 3</td>
<td>COL 2 - ROW 1</td>
<td>COL 3 - ROW 1</td>
</tr>
<tr>
<td rowspan="2">COL 2 - ROW 2 - COLSPAN 2<br />text line<br />text line<br />text line<br />text line</td>
<td>COL 3 - ROW 2</td>
</tr>
<tr>
<td>COL 3 - ROW 3</td>
</tr>
</table>
EOD;
$pdf->writeHTML($tbl, true, false, false, false, '');
// -----------------------------------------------------------------------------
$tbl = <<<EOD
<table cellspacing="0" cellpadding="1" style="border: 1px dashed blue !important;">
<tr>
<td rowspan="3">COL 1 - ROW 1<br />COLSPAN 3</td>
<td>COL 2 - ROW 1</td>
<td>COL 3 - ROW 1</td>
</tr>
<tr>
<td rowspan="2">COL 2 - ROW 2 - COLSPAN 2<br />text line<br />text line<br />text line<br />text line</td>
<td>COL 3 - ROW 2</td>
</tr>
<tr>
<td>COL 3 - ROW 3</td>
</tr>
</table>
EOD;
$pdf->writeHTML($tbl, true, false, false, false, '');
// -----------------------------------------------------------------------------
$tbl = <<<EOD
<table cellspacing="0" cellpadding="1" style="border: 1px hair black !important;">
<tr>
<td rowspan="3">COL 1 - ROW 1<br />COLSPAN 3</td>
<td>COL 2 - ROW 1</td>
<td>COL 3 - ROW 1</td>
</tr>
<tr>
<td rowspan="2">COL 2 - ROW 2 - COLSPAN 2<br />text line<br />text line<br />text line<br />text line</td>
<td>COL 3 - ROW 2</td>
</tr>
<tr>
<td>COL 3 - ROW 3</td>
</tr>
</table>
EOD;
$pdf->writeHTML($tbl, true, false, false, false, '');
// -----------------------------------------------------------------------------
$tbl = <<<EOD
<table cellspacing="0" cellpadding="1" style="border: dashed green">
<tr>
<td rowspan="3">COL 1 - ROW 1<br />COLSPAN 3</td>
<td>COL 2 - ROW 1</td>
<td>COL 3 - ROW 1</td>
</tr>
<tr>
<td rowspan="2">COL 2 - ROW 2 - COLSPAN 2<br />text line<br />text line<br />text line<br />text line</td>
<td>COL 3 - ROW 2</td>
</tr>
<tr>
<td>COL 3 - ROW 3</td>
</tr>
</table>
EOD;
$pdf->writeHTML($tbl, true, false, false, false, '');
// -----------------------------------------------------------------------------
$tbl = <<<EOD
<table cellspacing="0" cellpadding="1" style="border: solid yellow !important">
<tr>
<td rowspan="3">COL 1 - ROW 1<br />COLSPAN 3</td>
<td>COL 2 - ROW 1</td>
<td>COL 3 - ROW 1</td>
</tr>
<tr>
<td rowspan="2">COL 2 - ROW 2 - COLSPAN 2<br />text line<br />text line<br />text line<br />text line</td>
<td>COL 3 - ROW 2</td>
</tr>
<tr>
<td>COL 3 - ROW 3</td>
</tr>
</table>
EOD;
$pdf->writeHTML($tbl, true, false, false, false, '');
// -----------------------------------------------------------------------------
// At medium thickness, which is what you get with only one
// setting for style, everything looks the same.
// Included just for completeness.
$tbl = <<<EOD
<table cellspacing="0" cellpadding="1" style="border: dashed">
<tr>
<td rowspan="3">COL 1 - ROW 1<br />COLSPAN 3</td>
<td>COL 2 - ROW 1</td>
<td>COL 3 - ROW 1</td>
</tr>
<tr>
<td rowspan="2">COL 2 - ROW 2 - COLSPAN 2<br />text line<br />text line<br />text line<br />text line</td>
<td>COL 3 - ROW 2</td>
</tr>
<tr>
<td>COL 3 - ROW 3</td>
</tr>
</table>
EOD;
$pdf->writeHTML($tbl, true, false, false, false, '');
// -----------------------------------------------------------------------------
//Close and output PDF document
$pdf->Output('example_067.pdf', 'I');
//============================================================+
// END OF FILE
//============================================================+

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 238 KiB

After

Width:  |  Height:  |  Size: 238 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 191 KiB

After

Width:  |  Height:  |  Size: 190 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 66 KiB

View File

@@ -85,6 +85,8 @@ echo '<'.'?'.'xml version="1.0" encoding="UTF-8"'.'?'.'>';
<li>Text stretching and spacing (tracking/kerning): [<a href="example_063.php" title="PDF [new window]" target="_blank">PDF</a>]</li>
<li>No-write page regions: [<a href="example_064.php" title="PDF [new window]" target="_blank">PDF</a>]</li>
<li>PDF/A-1b (ISO 19005-1:2005) document: [<a href="example_065.php" title="PDF [new window]" target="_blank">PDF</a>]</li>
<li>Using WriteHTMLCell: [<a href="example_066.php" title="PDF [new window]" target="_blank">PDF</a>]</li>
<li>Shorthand border styles including !important: [<a href="example_067.php" title="PDF [new window]" target="_blank">PDF</a>]</li>
</ol>
<h2>Barcodes</h2>

View File

@@ -778,7 +778,7 @@ class Datamatrix {
if (isset($this->chset['SH1'][$chr])) {
$temp_cw[] = 0; // shift 1
$shiftset = $this->chset['SH1'];
} elseif (isset($chr, $this->chset['SH2'][$chr])) {
} elseif (isset($this->chset['SH2'][$chr])) {
$temp_cw[] = 1; // shift 2
$shiftset = $this->chset['SH2'];
} elseif (($enc == ENC_C40) AND isset($this->chset['S3C'][$chr])) {

View File

@@ -943,8 +943,8 @@ class PDF417 {
// tmp array for the 6 bytes block
$cw6 = array();
do {
$d = bcmod($t, '900');
$t = bcdiv($t, '900');
$d = bcmod($t, '900', 0);
$t = bcdiv($t, '900', 0);
// prepend the value to the beginning of the array
array_unshift($cw6, $d);
} while ($t != '0');
@@ -969,8 +969,8 @@ class PDF417 {
}
$t = '1'.$code;
do {
$d = bcmod($t, '900');
$t = bcdiv($t, '900');
$d = bcmod($t, '900', 0);
$t = bcdiv($t, '900', 0);
array_unshift($cw, $d);
} while ($t != '0');
$code = $rest;

View File

@@ -884,14 +884,15 @@ class QRcode {
protected function getCode() {
if ($this->count < $this->dataLength) {
$row = $this->count % $this->blocks;
$col = $this->count / $this->blocks;
$col = (int)($this->count / $this->blocks);
if ($col >= $this->rsblocks[0]['dataLength']) {
$row += $this->b1;
}
$row = (int) $row;
$ret = $this->rsblocks[$row]['data'][$col];
} elseif ($this->count < $this->dataLength + $this->eccLength) {
$row = ($this->count - $this->dataLength) % $this->blocks;
$col = ($this->count - $this->dataLength) / $this->blocks;
$col = (int)(($this->count - $this->dataLength) / $this->blocks);
$ret = $this->rsblocks[$row]['ecc'][$col];
} else {
return 0;
@@ -1062,7 +1063,7 @@ class QRcode {
protected function makeMaskNo($maskNo, $width, $s, &$d, $maskGenOnly=false) {
$b = 0;
$bitMask = array();
$bitMask = $this->generateMaskNo($maskNo, $width, $s, $d);
$bitMask = $this->generateMaskNo($maskNo, $width, $s);
if ($maskGenOnly) {
return;
}
@@ -1460,7 +1461,7 @@ class QRcode {
$stringLen = strlen($this->dataStr);
$p = 0;
while ($p < $stringLen) {
$mode = $this->identifyMode(substr($this->dataStr, $p), $this->hint);
$mode = $this->identifyMode(substr($this->dataStr, $p));
if ($mode == QR_MODE_KJ) {
$p += 2;
} else {
@@ -1692,7 +1693,7 @@ class QRcode {
return -1;
}
$buf = array($size, $index, $parity);
$entry = $this->newInputItem(QR_MODE_ST, 3, buf);
$entry = $this->newInputItem(QR_MODE_ST, 3, $buf);
array_unshift($items, $entry);
return $items;
}

Some files were not shown because too many files have changed in this diff Show More