├── .gitignore ├── LICENSE ├── Readme.md ├── ajax └── remove.txt ├── docs └── remove.txt ├── front ├── config.php ├── configOs.php ├── css │ └── styles2.css ├── img │ ├── logo_os.png │ ├── logotipo.png │ └── os.ico ├── index.php ├── insert_logo.php ├── insert_rn.php ├── os_pdf.php ├── os_pdflabel.php └── recebeLogo.php ├── hook.php ├── inc ├── config.class.php ├── pdf │ ├── FAQ.htm │ ├── README.md │ ├── changelog.htm │ ├── composer.json │ ├── doc │ │ ├── __construct.htm │ │ ├── acceptpagebreak.htm │ │ ├── addfont.htm │ │ ├── addlink.htm │ │ ├── addpage.htm │ │ ├── aliasnbpages.htm │ │ ├── cell.htm │ │ ├── close.htm │ │ ├── error.htm │ │ ├── footer.htm │ │ ├── getpageheight.htm │ │ ├── getpagewidth.htm │ │ ├── getstringwidth.htm │ │ ├── getx.htm │ │ ├── gety.htm │ │ ├── header.htm │ │ ├── image.htm │ │ ├── index.htm │ │ ├── line.htm │ │ ├── link.htm │ │ ├── ln.htm │ │ ├── multicell.htm │ │ ├── output.htm │ │ ├── pageno.htm │ │ ├── rect.htm │ │ ├── setauthor.htm │ │ ├── setautopagebreak.htm │ │ ├── setcompression.htm │ │ ├── setcreator.htm │ │ ├── setdisplaymode.htm │ │ ├── setdrawcolor.htm │ │ ├── setfillcolor.htm │ │ ├── setfont.htm │ │ ├── setfontsize.htm │ │ ├── setkeywords.htm │ │ ├── setleftmargin.htm │ │ ├── setlinewidth.htm │ │ ├── setlink.htm │ │ ├── setmargins.htm │ │ ├── setrightmargin.htm │ │ ├── setsubject.htm │ │ ├── settextcolor.htm │ │ ├── settitle.htm │ │ ├── settopmargin.htm │ │ ├── setx.htm │ │ ├── setxy.htm │ │ ├── sety.htm │ │ ├── text.htm │ │ └── write.htm │ ├── font │ │ ├── courier.php │ │ ├── courierb.php │ │ ├── courierbi.php │ │ ├── courieri.php │ │ ├── helvetica.php │ │ ├── helveticab.php │ │ ├── helveticabi.php │ │ ├── helveticai.php │ │ ├── symbol.php │ │ ├── times.php │ │ ├── timesb.php │ │ ├── timesbi.php │ │ ├── timesi.php │ │ └── zapfdingbats.php │ ├── fpdf.css │ ├── fpdf.php │ ├── install.txt │ ├── license.txt │ ├── makefont │ │ ├── cp1250.map │ │ ├── cp1251.map │ │ ├── cp1252.map │ │ ├── cp1253.map │ │ ├── cp1254.map │ │ ├── cp1255.map │ │ ├── cp1257.map │ │ ├── cp1258.map │ │ ├── cp874.map │ │ ├── iso-8859-1.map │ │ ├── iso-8859-11.map │ │ ├── iso-8859-15.map │ │ ├── iso-8859-16.map │ │ ├── iso-8859-2.map │ │ ├── iso-8859-4.map │ │ ├── iso-8859-5.map │ │ ├── iso-8859-7.map │ │ ├── iso-8859-9.map │ │ ├── koi8-r.map │ │ ├── koi8-u.map │ │ ├── makefont.php │ │ └── ttfparser.php │ └── tutorial │ │ ├── 20k_c1.txt │ │ ├── 20k_c2.txt │ │ ├── calligra.php │ │ ├── calligra.ttf │ │ ├── calligra.z │ │ ├── countries.txt │ │ ├── index.htm │ │ ├── logo.png │ │ ├── makefont.php │ │ ├── tuto1.htm │ │ ├── tuto1.php │ │ ├── tuto2.htm │ │ ├── tuto2.php │ │ ├── tuto3.htm │ │ ├── tuto3.php │ │ ├── tuto4.htm │ │ ├── tuto4.php │ │ ├── tuto5.htm │ │ ├── tuto5.php │ │ ├── tuto6.htm │ │ ├── tuto6.php │ │ ├── tuto7.htm │ │ └── tuto7.php ├── profile.class.php └── qrcode │ ├── composer.json │ ├── composer.lock │ ├── public │ ├── index.html │ └── qrcode.php │ ├── src │ ├── Data │ │ ├── AlphaNum.php │ │ ├── Byte.php │ │ ├── Kanji.php │ │ ├── MaskPatternTester.php │ │ ├── Number.php │ │ ├── QRCodeDataException.php │ │ ├── QRDataAbstract.php │ │ ├── QRDataInterface.php │ │ └── QRMatrix.php │ ├── Helpers │ │ ├── BitBuffer.php │ │ └── Polynomial.php │ ├── Output │ │ ├── QRCodeOutputException.php │ │ ├── QRFpdf.php │ │ ├── QRImage.php │ │ ├── QRImagick.php │ │ ├── QRMarkup.php │ │ ├── QROutputAbstract.php │ │ ├── QROutputInterface.php │ │ └── QRString.php │ ├── QRCode.php │ ├── QRCodeException.php │ ├── QROptions.php │ └── QROptionsTrait.php │ ├── tests │ ├── Data │ │ ├── AlphaNumTest.php │ │ ├── ByteTest.php │ │ ├── DatainterfaceTestAbstract.php │ │ ├── KanjiTest.php │ │ ├── MaskPatternTesterTest.php │ │ ├── NumberTest.php │ │ └── QRMatrixTest.php │ ├── Helpers │ │ ├── BitBufferTest.php │ │ └── PolynomialTest.php │ ├── Output │ │ ├── QRFpdfTest.php │ │ ├── QRImageTest.php │ │ ├── QRImagickTest.php │ │ ├── QRMarkupTest.php │ │ ├── QROutputTestAbstract.php │ │ └── QRStringTest.php │ ├── QRCodeTest.php │ ├── QROptionsTest.php │ └── QRTestAbstract.php │ └── vendor │ ├── autoload.php │ ├── chillerlan │ ├── php-qrcode │ │ ├── .github │ │ │ ├── FUNDING.yml │ │ │ └── workflows │ │ │ │ └── tests.yml │ │ ├── .gitignore │ │ ├── .scrutinizer.yml │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── README.md │ │ ├── composer.json │ │ ├── examples │ │ │ ├── MyCustomOutput.php │ │ │ ├── QRImageWithLogo.php │ │ │ ├── QRImageWithText.php │ │ │ ├── custom_output.php │ │ │ ├── example_image.png │ │ │ ├── example_svg.png │ │ │ ├── fpdf.php │ │ │ ├── html.php │ │ │ ├── image.php │ │ │ ├── imageWithLogo.php │ │ │ ├── imageWithText.php │ │ │ ├── imagick.php │ │ │ ├── octocat.png │ │ │ ├── svg.php │ │ │ └── text.php │ │ ├── phpdoc.xml │ │ ├── phpmd.xml │ │ ├── phpunit.xml │ │ ├── public │ │ │ ├── index.html │ │ │ └── qrcode.php │ │ ├── src │ │ │ ├── Data │ │ │ │ ├── AlphaNum.php │ │ │ │ ├── Byte.php │ │ │ │ ├── Kanji.php │ │ │ │ ├── MaskPatternTester.php │ │ │ │ ├── Number.php │ │ │ │ ├── QRCodeDataException.php │ │ │ │ ├── QRDataAbstract.php │ │ │ │ ├── QRDataInterface.php │ │ │ │ └── QRMatrix.php │ │ │ ├── Helpers │ │ │ │ ├── BitBuffer.php │ │ │ │ └── Polynomial.php │ │ │ ├── Output │ │ │ │ ├── QRCodeOutputException.php │ │ │ │ ├── QRFpdf.php │ │ │ │ ├── QRImage.php │ │ │ │ ├── QRImagick.php │ │ │ │ ├── QRMarkup.php │ │ │ │ ├── QROutputAbstract.php │ │ │ │ ├── QROutputInterface.php │ │ │ │ └── QRString.php │ │ │ ├── QRCode.php │ │ │ ├── QRCodeException.php │ │ │ ├── QROptions.php │ │ │ └── QROptionsTrait.php │ │ └── tests │ │ │ ├── Data │ │ │ ├── AlphaNumTest.php │ │ │ ├── ByteTest.php │ │ │ ├── DatainterfaceTestAbstract.php │ │ │ ├── KanjiTest.php │ │ │ ├── MaskPatternTesterTest.php │ │ │ ├── NumberTest.php │ │ │ └── QRMatrixTest.php │ │ │ ├── Helpers │ │ │ ├── BitBufferTest.php │ │ │ └── PolynomialTest.php │ │ │ ├── Output │ │ │ ├── QRFpdfTest.php │ │ │ ├── QRImageTest.php │ │ │ ├── QRImagickTest.php │ │ │ ├── QRMarkupTest.php │ │ │ ├── QROutputTestAbstract.php │ │ │ └── QRStringTest.php │ │ │ ├── QRCodeTest.php │ │ │ ├── QROptionsTest.php │ │ │ └── QRTestAbstract.php │ └── php-settings-container │ │ ├── .gitignore │ │ ├── .scrutinizer.yml │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── README.md │ │ ├── composer.json │ │ ├── examples │ │ ├── advanced.php │ │ └── simple.php │ │ ├── phpmd.xml │ │ ├── phpunit.xml │ │ ├── src │ │ ├── SettingsContainerAbstract.php │ │ └── SettingsContainerInterface.php │ │ └── tests │ │ ├── ContainerTest.php │ │ ├── TestContainer.php │ │ └── TestOptionsTrait.php │ └── composer │ ├── ClassLoader.php │ ├── InstalledVersions.php │ ├── LICENSE │ ├── autoload_classmap.php │ ├── autoload_namespaces.php │ ├── autoload_psr4.php │ ├── autoload_real.php │ ├── autoload_static.php │ ├── installed.json │ ├── installed.php │ └── platform_check.php ├── locales └── remove.txt ├── os.png ├── os.xml ├── pics ├── logo_os.png ├── logotipo.png ├── qr.png └── screenshot.png └── setup.php /.gitignore: -------------------------------------------------------------------------------- 1 | # Folder view configuration files 2 | .DS_Store 3 | Desktop.ini 4 | 5 | # Thumbnail cache files 6 | ._* 7 | Thumbs.db 8 | 9 | # Files that might appear on external disks 10 | .Spotlight-V100 11 | .Trashes 12 | 13 | # Compiled Python files 14 | *.pyc 15 | 16 | # Compiled C++ files 17 | *.out 18 | 19 | # Application specific files 20 | venv 21 | node_modules 22 | .sass-cache 23 | -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | # Português (PT_BR) 2 | Este Plug-in foi desenvolvido para gerar "Ordem de Serviço" baseado nos dados do ticket. 3 | 4 | Para instalar o Plug-in siga os passos abaixo: 5 | - Faça o download do projeto e extraia na pasta "plug-ins" que se encontra na raiz do GLPI; 6 | - Caso esteja diferente, renomeie a pasta para: “os”; 7 | - Acesse o GLPI, vá em Configurar > Plug-ins; 8 | - Encontre o Plug-in "OS" na lista e clique em Instalar; 9 | - Por fim, clique em Habilitar. 10 | 11 | Configurar: 12 | - Após instalar e habilitar o Plug-in, surgirá o submenu "Ordem de Serviço" no menu Plug-ins. 13 | - Preencha conforme as informações solicitadas, essas informações farão parte do cabeçalho da impressão. 14 | 15 | Modo de usar: 16 | - Para configurar o CNPJ das entidades, entre no Menu: Administração > Entidades, procure pela aba “Dados para O.S.” e insira o CNPJ de cada entidade. 17 | - Dentro de cada Ticket surgirá uma aba "Ordem de Serviço", ao entrar já será exibido o Layout A4 da Ordem de Serviço. 18 | - Escolha o Layout "Label" e terá uma versão para impressão em impressoras de etiquetas e/ou não fiscais. 19 | # FIM (PT_BR) 20 | -------------------------------------------------------------------------------- /ajax/remove.txt: -------------------------------------------------------------------------------- 1 | You can safely remove this file. -------------------------------------------------------------------------------- /docs/remove.txt: -------------------------------------------------------------------------------- 1 | You can safely remove this file. -------------------------------------------------------------------------------- /front/config.php: -------------------------------------------------------------------------------- 1 | . 20 | ------------------------------------------------------------------------ 21 | @package Plugin OS 22 | @author Junior Marcati 23 | @co-author 24 | @copyright Copyright (c) 2016-2024 OS Plugin Development team 25 | @license AGPL License 3.0 or (at your option) any later version 26 | http://www.gnu.org/licenses/agpl-3.0-standalone.html 27 | @link https://github.com/juniormarcati/os 28 | @since 2016 29 | ------------------------------------------------------------------------ 30 | */ 31 | session_start(); 32 | include ("../../../inc/includes.php"); 33 | include ("../../../config/config.php"); 34 | $name_form = $_REQUEST["name_form"]; 35 | $cnpj_form = $_REQUEST["cnpj_form"]; 36 | $address_form = $_REQUEST["address_form"]; 37 | $phone_form = $_REQUEST["phone_form"]; 38 | $city_form = $_REQUEST["city_form"]; 39 | $site_form = $_REQUEST["site_form"]; 40 | $query = "REPLACE INTO glpi_plugin_os_config (name, cnpj, address, phone, city, site) 41 | VALUES ('".$name_form."', '".$cnpj_form."', '".$address_form."', '".$phone_form."', '".$city_form."', '".$site_form."')"; 42 | $result = $DB->query($query); 43 | echo ""; -------------------------------------------------------------------------------- /front/css/styles2.css: -------------------------------------------------------------------------------- 1 | @media print { 2 | body {print-color-adjust: exact;} 3 | .botao, #botoes { display: none; } 4 | table > tr > td {text-align: left; padding: 5px;} 5 | td, th {text-align: left; padding: 5px;} 6 | } 7 | td, th {text-align: left; padding: 5px;} 8 | .left {text-align: left;} 9 | .botao {height: 27px;} 10 | input[type="submit1"] {height: 27px;} -------------------------------------------------------------------------------- /front/img/logo_os.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juniormarcati/os/1ece479e0e14f38df375b41d070025a636207bb5/front/img/logo_os.png -------------------------------------------------------------------------------- /front/img/logotipo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juniormarcati/os/1ece479e0e14f38df375b41d070025a636207bb5/front/img/logotipo.png -------------------------------------------------------------------------------- /front/img/os.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juniormarcati/os/1ece479e0e14f38df375b41d070025a636207bb5/front/img/os.ico -------------------------------------------------------------------------------- /front/insert_rn.php: -------------------------------------------------------------------------------- 1 | . 20 | ------------------------------------------------------------------------ 21 | @package Plugin OS 22 | @author Junior Marcati 23 | @co-author 24 | @copyright Copyright (c) 2016-2024 OS Plugin Development team 25 | @license AGPL License 3.0 or (at your option) any later version 26 | http://www.gnu.org/licenses/agpl-3.0-standalone.html 27 | @link https://github.com/juniormarcati/os 28 | @since 2016 29 | ------------------------------------------------------------------------ 30 | */ 31 | include ("../../../inc/includes.php"); 32 | include ("../../../inc/config.php"); 33 | 34 | Session::checkLoginUser(); 35 | Session::checkRight("profile", READ); 36 | 37 | $ent_id = $_POST["id"]; 38 | 39 | if(isset($_POST["rn"])) { 40 | $rn = $_POST["rn"]; 41 | 42 | $query = "SELECT name FROM glpi_entities WHERE id = ".$ent_id; 43 | $result = $DB->query($query) or die ("error insert"); 44 | 45 | $location = $DB->result($result,0,'name'); 46 | 47 | $insert = " 48 | INSERT INTO glpi_plugin_os_rn (entities_id, rn) 49 | VALUES ('$ent_id', '$rn') 50 | ON DUPLICATE KEY UPDATE rn='$rn'"; 51 | 52 | $DB->query($insert) or die ("Error inserting rn"); 53 | 54 | echo ""; 55 | } 56 | 57 | if($_POST["rn"] == "") { 58 | 59 | $query = "DELETE FROM glpi_plugin_os_rn WHERE entities_id = ".$_POST["id"]; 60 | $DB->query($query) or die ("error removing rn"); 61 | 62 | echo ""; 63 | } -------------------------------------------------------------------------------- /inc/pdf/README.md: -------------------------------------------------------------------------------- 1 | # FPDF 2 | **This repository is only made for cloning official FPDF releases which are available at: http://www.fpdf.org** 3 | **THERE WILL BE NO DEVELOPMENT IN THIS REPOSITORY!** 4 | 5 | FPDF is a PHP class which allows to generate PDF files with pure PHP. F from FPDF stands for Free: you may use it for any kind of usage and modify it to suit your needs. 6 | 7 | ## Installation with [Composer](https://packagist.org/packages/setasign/fpdf) 8 | 9 | If you're using Composer to manage dependencies, you can use 10 | 11 | $ composer require setasign/fpdf:^1.8 12 | 13 | or you can include the following in your composer.json file: 14 | 15 | ```json 16 | { 17 | "require": { 18 | "setasign/fpdf": "^1.8" 19 | } 20 | } 21 | ``` 22 | -------------------------------------------------------------------------------- /inc/pdf/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "setasign/fpdf", 3 | "homepage": "http://www.fpdf.org", 4 | "description": "FPDF is a PHP class which allows to generate PDF files with pure PHP. F from FPDF stands for Free: you may use it for any kind of usage and modify it to suit your needs.", 5 | "type": "library", 6 | "keywords": ["pdf", "fpdf"], 7 | "license": "MIT", 8 | "authors": [ 9 | { 10 | "name": "Olivier Plathey", 11 | "email": "oliver@fpdf.org", 12 | "homepage": "http://fpdf.org/" 13 | } 14 | ], 15 | "autoload": { 16 | "classmap": [ 17 | "fpdf.php" 18 | ] 19 | }, 20 | "require": { 21 | "ext-zlib": "*", 22 | "ext-gd": "*" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /inc/pdf/doc/__construct.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | __construct 6 | 7 | 8 | 9 |

__construct

10 | __construct([string orientation [, string unit [, mixed size]]]) 11 |

Description

12 | This is the class constructor. It allows to set up the page size, the orientation and the 13 | unit of measure used in all methods (except for font sizes). 14 |

Parameters

15 |
16 |
orientation
17 |
18 | Default page orientation. Possible values are (case insensitive): 19 | 23 | Default value is P. 24 |
25 |
unit
26 |
27 | User unit. Possible values are: 28 | 34 | A point equals 1/72 of inch, that is to say about 0.35 mm (an inch being 2.54 cm). This 35 | is a very common unit in typography; font sizes are expressed in that unit. 36 |
37 |
38 | Default value is mm. 39 |
40 |
size
41 |
42 | The size used for pages. It can be either one of the following values (case insensitive): 43 | 50 | or an array containing the width and the height (expressed in the unit given by unit).
51 |
52 | Default value is A4. 53 |
54 |
55 |

Example

56 | Example with a custom 100x150 mm page size: 57 |
58 |
$pdf = new FPDF('P','mm',array(100,150));
59 |
60 |
61 |
Index
62 | 63 | 64 | -------------------------------------------------------------------------------- /inc/pdf/doc/acceptpagebreak.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | AcceptPageBreak 6 | 7 | 8 | 9 |

AcceptPageBreak

10 | boolean AcceptPageBreak() 11 |

Description

12 | Whenever a page break condition is met, the method is called, and the break is issued or not 13 | depending on the returned value. The default implementation returns a value according to the 14 | mode selected by SetAutoPageBreak(). 15 |
16 | This method is called automatically and should not be called directly by the application. 17 |

Example

18 | The method is overriden in an inherited class in order to obtain a 3 column layout: 19 |
20 |
class PDF extends FPDF
21 | {
22 | var $col = 0;
23 | 
24 | function SetCol($col)
25 | {
26 |     // Move position to a column
27 |     $this->col = $col;
28 |     $x = 10+$col*65;
29 |     $this->SetLeftMargin($x);
30 |     $this->SetX($x);
31 | }
32 | 
33 | function AcceptPageBreak()
34 | {
35 |     if($this->col<2)
36 |     {
37 |         // Go to next column
38 |         $this->SetCol($this->col+1);
39 |         $this->SetY(10);
40 |         return false;
41 |     }
42 |     else
43 |     {
44 |         // Go back to first column and issue page break
45 |         $this->SetCol(0);
46 |         return true;
47 |     }
48 | }
49 | }
50 | 
51 | $pdf = new PDF();
52 | $pdf->AddPage();
53 | $pdf->SetFont('Arial','',12);
54 | for($i=1;$i<=300;$i++)
55 |     $pdf->Cell(0,5,"Line $i",0,1);
56 | $pdf->Output();
57 |
58 |

See also

59 | SetAutoPageBreak 60 |
61 |
Index
62 | 63 | 64 | -------------------------------------------------------------------------------- /inc/pdf/doc/addfont.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | AddFont 6 | 7 | 8 | 9 |

AddFont

10 | AddFont(string family [, string style [, string file]]) 11 |

Description

12 | Imports a TrueType, OpenType or Type1 font and makes it available. It is necessary to generate a font 13 | definition file first with the MakeFont utility. 14 |
15 | The definition file (and the font file itself when embedding) must be present in the font directory. 16 | If it is not found, the error "Could not include font definition file" is raised. 17 |

Parameters

18 |
19 |
family
20 |
21 | Font family. The name can be chosen arbitrarily. If it is a standard family name, it will 22 | override the corresponding font. 23 |
24 |
style
25 |
26 | Font style. Possible values are (case insensitive): 27 | 33 | The default value is regular. 34 |
35 |
file
36 |
37 | The font definition file. 38 |
39 | By default, the name is built from the family and style, in lower case with no space. 40 |
41 |
42 |

Example

43 |
44 |
$pdf->AddFont('Comic','I');
45 |
46 | is equivalent to: 47 |
48 |
$pdf->AddFont('Comic','I','comici.php');
49 |
50 |

See also

51 | SetFont 52 |
53 |
Index
54 | 55 | 56 | -------------------------------------------------------------------------------- /inc/pdf/doc/addlink.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | AddLink 6 | 7 | 8 | 9 |

AddLink

10 | int AddLink() 11 |

Description

12 | Creates a new internal link and returns its identifier. An internal link is a clickable area 13 | which directs to another place within the document. 14 |
15 | The identifier can then be passed to Cell(), Write(), Image() or Link(). The destination is 16 | defined with SetLink(). 17 |

See also

18 | Cell, 19 | Write, 20 | Image, 21 | Link, 22 | SetLink 23 |
24 |
Index
25 | 26 | 27 | -------------------------------------------------------------------------------- /inc/pdf/doc/addpage.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | AddPage 6 | 7 | 8 | 9 |

AddPage

10 | AddPage([string orientation [, mixed size [, int rotation]]]) 11 |

Description

12 | Adds a new page to the document. If a page is already present, the Footer() method is called 13 | first to output the footer. Then the page is added, the current position set to the top-left 14 | corner according to the left and top margins, and Header() is called to display the header. 15 |
16 | The font which was set before calling is automatically restored. There is no need to call 17 | SetFont() again if you want to continue with the same font. The same is true for colors and 18 | line width. 19 |
20 | The origin of the coordinate system is at the top-left corner and increasing ordinates go 21 | downwards. 22 |

Parameters

23 |
24 |
orientation
25 |
26 | Page orientation. Possible values are (case insensitive): 27 | 31 | The default value is the one passed to the constructor. 32 |
33 |
size
34 |
35 | Page size. It can be either one of the following values (case insensitive): 36 | 43 | or an array containing the width and the height (expressed in user unit).
44 |
45 | The default value is the one passed to the constructor. 46 |
47 |
rotation
48 |
49 | Angle by which to rotate the page. It must be a multiple of 90; positive values 50 | mean clockwise rotation. The default value is 0. 51 |
52 |
53 |

See also

54 | __construct, 55 | Header, 56 | Footer, 57 | SetMargins 58 |
59 |
Index
60 | 61 | 62 | -------------------------------------------------------------------------------- /inc/pdf/doc/aliasnbpages.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | AliasNbPages 6 | 7 | 8 | 9 |

AliasNbPages

10 | AliasNbPages([string alias]) 11 |

Description

12 | Defines an alias for the total number of pages. It will be substituted as the document is 13 | closed. 14 |

Parameters

15 |
16 |
alias
17 |
18 | The alias. Default value: {nb}. 19 |
20 |
21 |

Example

22 |
23 |
class PDF extends FPDF
24 | {
25 | function Footer()
26 | {
27 |     // Go to 1.5 cm from bottom
28 |     $this->SetY(-15);
29 |     // Select Arial italic 8
30 |     $this->SetFont('Arial','I',8);
31 |     // Print current and total page numbers
32 |     $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
33 | }
34 | }
35 | 
36 | $pdf = new PDF();
37 | $pdf->AliasNbPages();
38 |
39 |

See also

40 | PageNo, 41 | Footer 42 |
43 |
Index
44 | 45 | 46 | -------------------------------------------------------------------------------- /inc/pdf/doc/close.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Close 6 | 7 | 8 | 9 |

Close

10 | Close() 11 |

Description

12 | Terminates the PDF document. It is not necessary to call this method explicitly because Output() 13 | does it automatically. 14 |
15 | If the document contains no page, AddPage() is called to prevent from getting an invalid document. 16 |

See also

17 | Output 18 |
19 |
Index
20 | 21 | 22 | -------------------------------------------------------------------------------- /inc/pdf/doc/error.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Error 6 | 7 | 8 | 9 |

Error

10 | Error(string msg) 11 |

Description

12 | This method is automatically called in case of a fatal error; it simply throws an exception 13 | with the provided message.
14 | An inherited class may override it to customize the error handling but the method should 15 | never return, otherwise the resulting document would probably be invalid. 16 |

Parameters

17 |
18 |
msg
19 |
20 | The error message. 21 |
22 |
23 |
24 |
Index
25 | 26 | 27 | -------------------------------------------------------------------------------- /inc/pdf/doc/footer.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Footer 6 | 7 | 8 | 9 |

Footer

10 | Footer() 11 |

Description

12 | This method is used to render the page footer. It is automatically called by AddPage() and 13 | Close() and should not be called directly by the application. The implementation in FPDF is 14 | empty, so you have to subclass it and override the method if you want a specific processing. 15 |

Example

16 |
17 |
class PDF extends FPDF
18 | {
19 | function Footer()
20 | {
21 |     // Go to 1.5 cm from bottom
22 |     $this->SetY(-15);
23 |     // Select Arial italic 8
24 |     $this->SetFont('Arial','I',8);
25 |     // Print centered page number
26 |     $this->Cell(0,10,'Page '.$this->PageNo(),0,0,'C');
27 | }
28 | }
29 |
30 |

See also

31 | Header 32 |
33 |
Index
34 | 35 | 36 | -------------------------------------------------------------------------------- /inc/pdf/doc/getpageheight.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | GetPageHeight 6 | 7 | 8 | 9 |

GetPageHeight

10 | float GetPageHeight() 11 |

Description

12 | Returns the current page height. 13 |

See also

14 | GetPageWidth 15 |
16 |
Index
17 | 18 | 19 | -------------------------------------------------------------------------------- /inc/pdf/doc/getpagewidth.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | GetPageWidth 6 | 7 | 8 | 9 |

GetPageWidth

10 | float GetPageWidth() 11 |

Description

12 | Returns the current page width. 13 |

See also

14 | GetPageHeight 15 |
16 |
Index
17 | 18 | 19 | -------------------------------------------------------------------------------- /inc/pdf/doc/getstringwidth.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | GetStringWidth 6 | 7 | 8 | 9 |

GetStringWidth

10 | float GetStringWidth(string s) 11 |

Description

12 | Returns the length of a string in user unit. A font must be selected. 13 |

Parameters

14 |
15 |
s
16 |
17 | The string whose length is to be computed. 18 |
19 |
20 |
21 |
Index
22 | 23 | 24 | -------------------------------------------------------------------------------- /inc/pdf/doc/getx.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | GetX 6 | 7 | 8 | 9 |

GetX

10 | float GetX() 11 |

Description

12 | Returns the abscissa of the current position. 13 |

See also

14 | SetX, 15 | GetY, 16 | SetY 17 |
18 |
Index
19 | 20 | 21 | -------------------------------------------------------------------------------- /inc/pdf/doc/gety.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | GetY 6 | 7 | 8 | 9 |

GetY

10 | float GetY() 11 |

Description

12 | Returns the ordinate of the current position. 13 |

See also

14 | SetY, 15 | GetX, 16 | SetX 17 |
18 |
Index
19 | 20 | 21 | -------------------------------------------------------------------------------- /inc/pdf/doc/header.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Header 6 | 7 | 8 | 9 |

Header

10 | Header() 11 |

Description

12 | This method is used to render the page header. It is automatically called by AddPage() and 13 | should not be called directly by the application. The implementation in FPDF is empty, so 14 | you have to subclass it and override the method if you want a specific processing. 15 |

Example

16 |
17 |
class PDF extends FPDF
18 | {
19 | function Header()
20 | {
21 |     // Select Arial bold 15
22 |     $this->SetFont('Arial','B',15);
23 |     // Move to the right
24 |     $this->Cell(80);
25 |     // Framed title
26 |     $this->Cell(30,10,'Title',1,0,'C');
27 |     // Line break
28 |     $this->Ln(20);
29 | }
30 | }
31 |
32 |

See also

33 | Footer 34 |
35 |
Index
36 | 37 | 38 | -------------------------------------------------------------------------------- /inc/pdf/doc/line.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Line 6 | 7 | 8 | 9 |

Line

10 | Line(float x1, float y1, float x2, float y2) 11 |

Description

12 | Draws a line between two points. 13 |

Parameters

14 |
15 |
x1
16 |
17 | Abscissa of first point. 18 |
19 |
y1
20 |
21 | Ordinate of first point. 22 |
23 |
x2
24 |
25 | Abscissa of second point. 26 |
27 |
y2
28 |
29 | Ordinate of second point. 30 |
31 |
32 |

See also

33 | SetLineWidth, 34 | SetDrawColor 35 |
36 |
Index
37 | 38 | 39 | -------------------------------------------------------------------------------- /inc/pdf/doc/link.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Link 6 | 7 | 8 | 9 |

Link

10 | Link(float x, float y, float w, float h, mixed link) 11 |

Description

12 | Puts a link on a rectangular area of the page. Text or image links are generally put via Cell(), 13 | Write() or Image(), but this method can be useful for instance to define a clickable area inside 14 | an image. 15 |

Parameters

16 |
17 |
x
18 |
19 | Abscissa of the upper-left corner of the rectangle. 20 |
21 |
y
22 |
23 | Ordinate of the upper-left corner of the rectangle. 24 |
25 |
w
26 |
27 | Width of the rectangle. 28 |
29 |
h
30 |
31 | Height of the rectangle. 32 |
33 |
link
34 |
35 | URL or identifier returned by AddLink(). 36 |
37 |
38 |

See also

39 | AddLink, 40 | Cell, 41 | Write, 42 | Image 43 |
44 |
Index
45 | 46 | 47 | -------------------------------------------------------------------------------- /inc/pdf/doc/ln.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Ln 6 | 7 | 8 | 9 |

Ln

10 | Ln([float h]) 11 |

Description

12 | Performs a line break. The current abscissa goes back to the left margin and the ordinate 13 | increases by the amount passed in parameter. 14 |

Parameters

15 |
16 |
h
17 |
18 | The height of the break. 19 |
20 | By default, the value equals the height of the last printed cell. 21 |
22 |
23 |

See also

24 | Cell 25 |
26 |
Index
27 | 28 | 29 | -------------------------------------------------------------------------------- /inc/pdf/doc/multicell.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | MultiCell 6 | 7 | 8 | 9 |

MultiCell

10 | MultiCell(float w, float h, string txt [, mixed border [, string align [, boolean fill]]]) 11 |

Description

12 | This method allows printing text with line breaks. They can be automatic (as soon as the 13 | text reaches the right border of the cell) or explicit (via the \n character). As many cells 14 | as necessary are output, one below the other. 15 |
16 | Text can be aligned, centered or justified. The cell block can be framed and the background 17 | painted. 18 |

Parameters

19 |
20 |
w
21 |
22 | Width of cells. If 0, they extend up to the right margin of the page. 23 |
24 |
h
25 |
26 | Height of cells. 27 |
28 |
txt
29 |
30 | String to print. 31 |
32 |
border
33 |
34 | Indicates if borders must be drawn around the cell block. The value can be either a number: 35 | 39 | or a string containing some or all of the following characters (in any order): 40 | 46 | Default value: 0. 47 |
48 |
align
49 |
50 | Sets the text alignment. Possible values are: 51 | 57 |
58 |
fill
59 |
60 | Indicates if the cell background must be painted (true) or transparent (false). 61 | Default value: false. 62 |
63 |
64 |

See also

65 | SetFont, 66 | SetDrawColor, 67 | SetFillColor, 68 | SetTextColor, 69 | SetLineWidth, 70 | Cell, 71 | Write, 72 | SetAutoPageBreak 73 |
74 |
Index
75 | 76 | 77 | -------------------------------------------------------------------------------- /inc/pdf/doc/output.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Output 6 | 7 | 8 | 9 |

Output

10 | string Output([string dest [, string name [, boolean isUTF8]]]) 11 |

Description

12 | Send the document to a given destination: browser, file or string. In the case of a browser, the 13 | PDF viewer may be used or a download may be forced. 14 |
15 | The method first calls Close() if necessary to terminate the document. 16 |

Parameters

17 |
18 |
dest
19 |
20 | Destination where to send the document. It can be one of the following: 21 | 27 | The default value is I. 28 |
29 |
name
30 |
31 | The name of the file. It is ignored in case of destination S.
32 | The default value is doc.pdf. 33 |
34 |
isUTF8
35 |
36 | Indicates if name is encoded in ISO-8859-1 (false) or UTF-8 (true). 37 | Only used for destinations I and D.
38 | The default value is false. 39 |
40 |
41 |

See also

42 | Close 43 |
44 |
Index
45 | 46 | 47 | -------------------------------------------------------------------------------- /inc/pdf/doc/pageno.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PageNo 6 | 7 | 8 | 9 |

PageNo

10 | int PageNo() 11 |

Description

12 | Returns the current page number. 13 |

See also

14 | AliasNbPages 15 |
16 |
Index
17 | 18 | 19 | -------------------------------------------------------------------------------- /inc/pdf/doc/rect.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Rect 6 | 7 | 8 | 9 |

Rect

10 | Rect(float x, float y, float w, float h [, string style]) 11 |

Description

12 | Outputs a rectangle. It can be drawn (border only), filled (with no border) or both. 13 |

Parameters

14 |
15 |
x
16 |
17 | Abscissa of upper-left corner. 18 |
19 |
y
20 |
21 | Ordinate of upper-left corner. 22 |
23 |
w
24 |
25 | Width. 26 |
27 |
h
28 |
29 | Height. 30 |
31 |
style
32 |
33 | Style of rendering. Possible values are: 34 | 39 |
40 |
41 |

See also

42 | SetLineWidth, 43 | SetDrawColor, 44 | SetFillColor 45 |
46 |
Index
47 | 48 | 49 | -------------------------------------------------------------------------------- /inc/pdf/doc/setauthor.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SetAuthor 6 | 7 | 8 | 9 |

SetAuthor

10 | SetAuthor(string author [, boolean isUTF8]) 11 |

Description

12 | Defines the author of the document. 13 |

Parameters

14 |
15 |
author
16 |
17 | The name of the author. 18 |
19 |
isUTF8
20 |
21 | Indicates if the string is encoded in ISO-8859-1 (false) or UTF-8 (true).
22 | Default value: false. 23 |
24 |
25 |

See also

26 | SetCreator, 27 | SetKeywords, 28 | SetSubject, 29 | SetTitle 30 |
31 |
Index
32 | 33 | 34 | -------------------------------------------------------------------------------- /inc/pdf/doc/setautopagebreak.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SetAutoPageBreak 6 | 7 | 8 | 9 |

SetAutoPageBreak

10 | SetAutoPageBreak(boolean auto [, float margin]) 11 |

Description

12 | Enables or disables the automatic page breaking mode. When enabling, the second parameter is 13 | the distance from the bottom of the page that defines the triggering limit. By default, the 14 | mode is on and the margin is 2 cm. 15 |

Parameters

16 |
17 |
auto
18 |
19 | Boolean indicating if mode should be on or off. 20 |
21 |
margin
22 |
23 | Distance from the bottom of the page. 24 |
25 |
26 |

See also

27 | Cell, 28 | MultiCell, 29 | AcceptPageBreak 30 |
31 |
Index
32 | 33 | 34 | -------------------------------------------------------------------------------- /inc/pdf/doc/setcompression.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SetCompression 6 | 7 | 8 | 9 |

SetCompression

10 | SetCompression(boolean compress) 11 |

Description

12 | Activates or deactivates page compression. When activated, the internal representation of 13 | each page is compressed, which leads to a compression ratio of about 2 for the resulting 14 | document. 15 |
16 | Compression is on by default. 17 |
18 |
19 | Note: the Zlib extension is required for this feature. If not present, compression 20 | will be turned off. 21 |

Parameters

22 |
23 |
compress
24 |
25 | Boolean indicating if compression must be enabled. 26 |
27 |
28 |
29 |
Index
30 | 31 | 32 | -------------------------------------------------------------------------------- /inc/pdf/doc/setcreator.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SetCreator 6 | 7 | 8 | 9 |

SetCreator

10 | SetCreator(string creator [, boolean isUTF8]) 11 |

Description

12 | Defines the creator of the document. This is typically the name of the application that 13 | generates the PDF. 14 |

Parameters

15 |
16 |
creator
17 |
18 | The name of the creator. 19 |
20 |
isUTF8
21 |
22 | Indicates if the string is encoded in ISO-8859-1 (false) or UTF-8 (true).
23 | Default value: false. 24 |
25 |
26 |

See also

27 | SetAuthor, 28 | SetKeywords, 29 | SetSubject, 30 | SetTitle 31 |
32 |
Index
33 | 34 | 35 | -------------------------------------------------------------------------------- /inc/pdf/doc/setdisplaymode.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SetDisplayMode 6 | 7 | 8 | 9 |

SetDisplayMode

10 | SetDisplayMode(mixed zoom [, string layout]) 11 |

Description

12 | Defines the way the document is to be displayed by the viewer. The zoom level can be set: pages can be 13 | displayed entirely on screen, occupy the full width of the window, use real size, be scaled by a 14 | specific zooming factor or use viewer default (configured in the Preferences menu of Adobe Reader). 15 | The page layout can be specified too: single at once, continuous display, two columns or viewer 16 | default. 17 |

Parameters

18 |
19 |
zoom
20 |
21 | The zoom to use. It can be one of the following string values: 22 | 28 | or a number indicating the zooming factor to use. 29 |
30 |
layout
31 |
32 | The page layout. Possible values are: 33 | 39 | Default value is default. 40 |
41 |
42 |
43 |
Index
44 | 45 | 46 | -------------------------------------------------------------------------------- /inc/pdf/doc/setdrawcolor.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SetDrawColor 6 | 7 | 8 | 9 |

SetDrawColor

10 | SetDrawColor(int r [, int g, int b]) 11 |

Description

12 | Defines the color used for all drawing operations (lines, rectangles and cell borders). It 13 | can be expressed in RGB components or gray scale. The method can be called before the first 14 | page is created and the value is retained from page to page. 15 |

Parameters

16 |
17 |
r
18 |
19 | If g et b are given, red component; if not, indicates the gray level. 20 | Value between 0 and 255. 21 |
22 |
g
23 |
24 | Green component (between 0 and 255). 25 |
26 |
b
27 |
28 | Blue component (between 0 and 255). 29 |
30 |
31 |

See also

32 | SetFillColor, 33 | SetTextColor, 34 | Line, 35 | Rect, 36 | Cell, 37 | MultiCell 38 |
39 |
Index
40 | 41 | 42 | -------------------------------------------------------------------------------- /inc/pdf/doc/setfillcolor.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SetFillColor 6 | 7 | 8 | 9 |

SetFillColor

10 | SetFillColor(int r [, int g, int b]) 11 |

Description

12 | Defines the color used for all filling operations (filled rectangles and cell backgrounds). 13 | It can be expressed in RGB components or gray scale. The method can be called before the first 14 | page is created and the value is retained from page to page. 15 |

Parameters

16 |
17 |
r
18 |
19 | If g and b are given, red component; if not, indicates the gray level. 20 | Value between 0 and 255. 21 |
22 |
g
23 |
24 | Green component (between 0 and 255). 25 |
26 |
b
27 |
28 | Blue component (between 0 and 255). 29 |
30 |
31 |

See also

32 | SetDrawColor, 33 | SetTextColor, 34 | Rect, 35 | Cell, 36 | MultiCell 37 |
38 |
Index
39 | 40 | 41 | -------------------------------------------------------------------------------- /inc/pdf/doc/setfontsize.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SetFontSize 6 | 7 | 8 | 9 |

SetFontSize

10 | SetFontSize(float size) 11 |

Description

12 | Defines the size of the current font. 13 |

Parameters

14 |
15 |
size
16 |
17 | The size (in points). 18 |
19 |
20 |

See also

21 | SetFont 22 |
23 |
Index
24 | 25 | 26 | -------------------------------------------------------------------------------- /inc/pdf/doc/setkeywords.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SetKeywords 6 | 7 | 8 | 9 |

SetKeywords

10 | SetKeywords(string keywords [, boolean isUTF8]) 11 |

Description

12 | Associates keywords with the document, generally in the form 'keyword1 keyword2 ...'. 13 |

Parameters

14 |
15 |
keywords
16 |
17 | The list of keywords. 18 |
19 |
isUTF8
20 |
21 | Indicates if the string is encoded in ISO-8859-1 (false) or UTF-8 (true).
22 | Default value: false. 23 |
24 |
25 |

See also

26 | SetAuthor, 27 | SetCreator, 28 | SetSubject, 29 | SetTitle 30 |
31 |
Index
32 | 33 | 34 | -------------------------------------------------------------------------------- /inc/pdf/doc/setleftmargin.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SetLeftMargin 6 | 7 | 8 | 9 |

SetLeftMargin

10 | SetLeftMargin(float margin) 11 |

Description

12 | Defines the left margin. The method can be called before creating the first page. 13 |
14 | If the current abscissa gets out of page, it is brought back to the margin. 15 |

Parameters

16 |
17 |
margin
18 |
19 | The margin. 20 |
21 |
22 |

See also

23 | SetTopMargin, 24 | SetRightMargin, 25 | SetAutoPageBreak, 26 | SetMargins 27 |
28 |
Index
29 | 30 | 31 | -------------------------------------------------------------------------------- /inc/pdf/doc/setlinewidth.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SetLineWidth 6 | 7 | 8 | 9 |

SetLineWidth

10 | SetLineWidth(float width) 11 |

Description

12 | Defines the line width. By default, the value equals 0.2 mm. The method can be called before 13 | the first page is created and the value is retained from page to page. 14 |

Parameters

15 |
16 |
width
17 |
18 | The width. 19 |
20 |
21 |

See also

22 | Line, 23 | Rect, 24 | Cell, 25 | MultiCell 26 |
27 |
Index
28 | 29 | 30 | -------------------------------------------------------------------------------- /inc/pdf/doc/setlink.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SetLink 6 | 7 | 8 | 9 |

SetLink

10 | SetLink(int link [, float y [, int page]]) 11 |

Description

12 | Defines the page and position a link points to. 13 |

Parameters

14 |
15 |
link
16 |
17 | The link identifier returned by AddLink(). 18 |
19 |
y
20 |
21 | Ordinate of target position; -1 indicates the current position. 22 | The default value is 0 (top of page). 23 |
24 |
page
25 |
26 | Number of target page; -1 indicates the current page. This is the default value. 27 |
28 |
29 |

See also

30 | AddLink 31 |
32 |
Index
33 | 34 | 35 | -------------------------------------------------------------------------------- /inc/pdf/doc/setmargins.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SetMargins 6 | 7 | 8 | 9 |

SetMargins

10 | SetMargins(float left, float top [, float right]) 11 |

Description

12 | Defines the left, top and right margins. By default, they equal 1 cm. Call this method to change 13 | them. 14 |

Parameters

15 |
16 |
left
17 |
18 | Left margin. 19 |
20 |
top
21 |
22 | Top margin. 23 |
24 |
right
25 |
26 | Right margin. Default value is the left one. 27 |
28 |
29 |

See also

30 | SetLeftMargin, 31 | SetTopMargin, 32 | SetRightMargin, 33 | SetAutoPageBreak 34 |
35 |
Index
36 | 37 | 38 | -------------------------------------------------------------------------------- /inc/pdf/doc/setrightmargin.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SetRightMargin 6 | 7 | 8 | 9 |

SetRightMargin

10 | SetRightMargin(float margin) 11 |

Description

12 | Defines the right margin. The method can be called before creating the first page. 13 |

Parameters

14 |
15 |
margin
16 |
17 | The margin. 18 |
19 |
20 |

See also

21 | SetLeftMargin, 22 | SetTopMargin, 23 | SetAutoPageBreak, 24 | SetMargins 25 |
26 |
Index
27 | 28 | 29 | -------------------------------------------------------------------------------- /inc/pdf/doc/setsubject.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SetSubject 6 | 7 | 8 | 9 |

SetSubject

10 | SetSubject(string subject [, boolean isUTF8]) 11 |

Description

12 | Defines the subject of the document. 13 |

Parameters

14 |
15 |
subject
16 |
17 | The subject. 18 |
19 |
isUTF8
20 |
21 | Indicates if the string is encoded in ISO-8859-1 (false) or UTF-8 (true).
22 | Default value: false. 23 |
24 |
25 |

See also

26 | SetAuthor, 27 | SetCreator, 28 | SetKeywords, 29 | SetTitle 30 |
31 |
Index
32 | 33 | 34 | -------------------------------------------------------------------------------- /inc/pdf/doc/settextcolor.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SetTextColor 6 | 7 | 8 | 9 |

SetTextColor

10 | SetTextColor(int r [, int g, int b]) 11 |

Description

12 | Defines the color used for text. It can be expressed in RGB components or gray scale. The 13 | method can be called before the first page is created and the value is retained from page to 14 | page. 15 |

Parameters

16 |
17 |
r
18 |
19 | If g et b are given, red component; if not, indicates the gray level. 20 | Value between 0 and 255. 21 |
22 |
g
23 |
24 | Green component (between 0 and 255). 25 |
26 |
b
27 |
28 | Blue component (between 0 and 255). 29 |
30 |
31 |

See also

32 | SetDrawColor, 33 | SetFillColor, 34 | Text, 35 | Cell, 36 | MultiCell 37 |
38 |
Index
39 | 40 | 41 | -------------------------------------------------------------------------------- /inc/pdf/doc/settitle.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SetTitle 6 | 7 | 8 | 9 |

SetTitle

10 | SetTitle(string title [, boolean isUTF8]) 11 |

Description

12 | Defines the title of the document. 13 |

Parameters

14 |
15 |
title
16 |
17 | The title. 18 |
19 |
isUTF8
20 |
21 | Indicates if the string is encoded in ISO-8859-1 (false) or UTF-8 (true).
22 | Default value: false. 23 |
24 |
25 |

See also

26 | SetAuthor, 27 | SetCreator, 28 | SetKeywords, 29 | SetSubject 30 |
31 |
Index
32 | 33 | 34 | -------------------------------------------------------------------------------- /inc/pdf/doc/settopmargin.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SetTopMargin 6 | 7 | 8 | 9 |

SetTopMargin

10 | SetTopMargin(float margin) 11 |

Description

12 | Defines the top margin. The method can be called before creating the first page. 13 |

Parameters

14 |
15 |
margin
16 |
17 | The margin. 18 |
19 |
20 |

See also

21 | SetLeftMargin, 22 | SetRightMargin, 23 | SetAutoPageBreak, 24 | SetMargins 25 |
26 |
Index
27 | 28 | 29 | -------------------------------------------------------------------------------- /inc/pdf/doc/setx.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SetX 6 | 7 | 8 | 9 |

SetX

10 | SetX(float x) 11 |

Description

12 | Defines the abscissa of the current position. If the passed value is negative, it is relative 13 | to the right of the page. 14 |

Parameters

15 |
16 |
x
17 |
18 | The value of the abscissa. 19 |
20 |
21 |

See also

22 | GetX, 23 | GetY, 24 | SetY, 25 | SetXY 26 |
27 |
Index
28 | 29 | 30 | -------------------------------------------------------------------------------- /inc/pdf/doc/setxy.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SetXY 6 | 7 | 8 | 9 |

SetXY

10 | SetXY(float x, float y) 11 |

Description

12 | Defines the abscissa and ordinate of the current position. If the passed values are negative, 13 | they are relative respectively to the right and bottom of the page. 14 |

Parameters

15 |
16 |
x
17 |
18 | The value of the abscissa. 19 |
20 |
y
21 |
22 | The value of the ordinate. 23 |
24 |
25 |

See also

26 | SetX, 27 | SetY 28 |
29 |
Index
30 | 31 | 32 | -------------------------------------------------------------------------------- /inc/pdf/doc/sety.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SetY 6 | 7 | 8 | 9 |

SetY

10 | SetY(float y [, boolean resetX]) 11 |

Description

12 | Sets the ordinate and optionally moves the current abscissa back to the left margin. If the value 13 | is negative, it is relative to the bottom of the page. 14 |

Parameters

15 |
16 |
y
17 |
18 | The value of the ordinate. 19 |
20 |
resetX
21 |
22 | Whether to reset the abscissa. Default value: true. 23 |
24 |
25 |

See also

26 | GetX, 27 | GetY, 28 | SetX, 29 | SetXY 30 |
31 |
Index
32 | 33 | 34 | -------------------------------------------------------------------------------- /inc/pdf/doc/text.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Text 6 | 7 | 8 | 9 |

Text

10 | Text(float x, float y, string txt) 11 |

Description

12 | Prints a character string. The origin is on the left of the first character, on the baseline. 13 | This method allows to place a string precisely on the page, but it is usually easier to use 14 | Cell(), MultiCell() or Write() which are the standard methods to print text. 15 |

Parameters

16 |
17 |
x
18 |
19 | Abscissa of the origin. 20 |
21 |
y
22 |
23 | Ordinate of the origin. 24 |
25 |
txt
26 |
27 | String to print. 28 |
29 |
30 |

See also

31 | SetFont, 32 | SetTextColor, 33 | Cell, 34 | MultiCell, 35 | Write 36 |
37 |
Index
38 | 39 | 40 | -------------------------------------------------------------------------------- /inc/pdf/doc/write.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Write 6 | 7 | 8 | 9 |

Write

10 | Write(float h, string txt [, mixed link]) 11 |

Description

12 | This method prints text from the current position. When the right margin is reached (or the \n 13 | character is met) a line break occurs and text continues from the left margin. Upon method exit, 14 | the current position is left just at the end of the text. 15 |
16 | It is possible to put a link on the text. 17 |

Parameters

18 |
19 |
h
20 |
21 | Line height. 22 |
23 |
txt
24 |
25 | String to print. 26 |
27 |
link
28 |
29 | URL or identifier returned by AddLink(). 30 |
31 |
32 |

Example

33 |
34 |
// Begin with regular font
35 | $pdf->SetFont('Arial','',14);
36 | $pdf->Write(5,'Visit ');
37 | // Then put a blue underlined link
38 | $pdf->SetTextColor(0,0,255);
39 | $pdf->SetFont('','U');
40 | $pdf->Write(5,'www.fpdf.org','http://www.fpdf.org');
41 |
42 |

See also

43 | SetFont, 44 | SetTextColor, 45 | AddLink, 46 | MultiCell, 47 | SetAutoPageBreak 48 |
49 |
Index
50 | 51 | 52 | -------------------------------------------------------------------------------- /inc/pdf/font/courier.php: -------------------------------------------------------------------------------- 1 | array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96)); 10 | ?> 11 | -------------------------------------------------------------------------------- /inc/pdf/font/courierb.php: -------------------------------------------------------------------------------- 1 | array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96)); 10 | ?> 11 | -------------------------------------------------------------------------------- /inc/pdf/font/courierbi.php: -------------------------------------------------------------------------------- 1 | array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96)); 10 | ?> 11 | -------------------------------------------------------------------------------- /inc/pdf/font/courieri.php: -------------------------------------------------------------------------------- 1 | array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96)); 10 | ?> 11 | -------------------------------------------------------------------------------- /inc/pdf/fpdf.css: -------------------------------------------------------------------------------- 1 | body {font-family:"Times New Roman",serif} 2 | h1 {font:bold 135% Arial,sans-serif; color:#4000A0; margin-bottom:0.9em} 3 | h2 {font:bold 95% Arial,sans-serif; color:#900000; margin-top:1.5em; margin-bottom:1em} 4 | dl.param dt {text-decoration:underline} 5 | dl.param dd {margin-top:1em; margin-bottom:1em} 6 | dl.param ul {margin-top:1em; margin-bottom:1em} 7 | tt, code, kbd {font-family:"Courier New",Courier,monospace; font-size:82%} 8 | div.source {margin-top:1.4em; margin-bottom:1.3em} 9 | div.source pre {display:table; border:1px solid #24246A; width:100%; margin:0em; font-family:inherit; font-size:100%} 10 | div.source code {display:block; border:1px solid #C5C5EC; background-color:#F0F5FF; padding:6px; color:#000000} 11 | div.doc-source {margin-top:1.4em; margin-bottom:1.3em} 12 | div.doc-source pre {display:table; width:100%; margin:0em; font-family:inherit; font-size:100%} 13 | div.doc-source code {display:block; background-color:#E0E0E0; padding:4px} 14 | .kw {color:#000080; font-weight:bold} 15 | .str {color:#CC0000} 16 | .cmt {color:#008000} 17 | p.demo {text-align:center; margin-top:-0.9em} 18 | a.demo {text-decoration:none; font-weight:bold; color:#0000CC} 19 | a.demo:link {text-decoration:none; font-weight:bold; color:#0000CC} 20 | a.demo:hover {text-decoration:none; font-weight:bold; color:#0000FF} 21 | a.demo:active {text-decoration:none; font-weight:bold; color:#0000FF} 22 | -------------------------------------------------------------------------------- /inc/pdf/install.txt: -------------------------------------------------------------------------------- 1 | The FPDF library is made up of the following elements: 2 | 3 | - the main file, fpdf.php, which contains the class 4 | - the font definition files located in the font directory 5 | 6 | The font definition files are necessary as soon as you want to output some text in a document. 7 | If they are not accessible, the SetFont() method will produce the following error: 8 | 9 | FPDF error: Could not include font definition file 10 | 11 | 12 | Remarks: 13 | 14 | - Only the files corresponding to the fonts actually used are necessary 15 | - The tutorials provided in this package are ready to be executed 16 | -------------------------------------------------------------------------------- /inc/pdf/license.txt: -------------------------------------------------------------------------------- 1 | Permission is hereby granted, free of charge, to any person obtaining a copy 2 | of this software to use, copy, modify, distribute, sublicense, and/or sell 3 | copies of the software, and to permit persons to whom the software is furnished 4 | to do so. 5 | 6 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. -------------------------------------------------------------------------------- /inc/pdf/tutorial/20k_c1.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juniormarcati/os/1ece479e0e14f38df375b41d070025a636207bb5/inc/pdf/tutorial/20k_c1.txt -------------------------------------------------------------------------------- /inc/pdf/tutorial/calligra.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juniormarcati/os/1ece479e0e14f38df375b41d070025a636207bb5/inc/pdf/tutorial/calligra.ttf -------------------------------------------------------------------------------- /inc/pdf/tutorial/calligra.z: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juniormarcati/os/1ece479e0e14f38df375b41d070025a636207bb5/inc/pdf/tutorial/calligra.z -------------------------------------------------------------------------------- /inc/pdf/tutorial/countries.txt: -------------------------------------------------------------------------------- 1 | Austria;Vienna;83859;8075 2 | Belgium;Brussels;30518;10192 3 | Denmark;Copenhagen;43094;5295 4 | Finland;Helsinki;304529;5147 5 | France;Paris;543965;58728 6 | Germany;Berlin;357022;82057 7 | Greece;Athens;131625;10511 8 | Ireland;Dublin;70723;3694 9 | Italy;Roma;301316;57563 10 | Luxembourg;Luxembourg;2586;424 11 | Netherlands;Amsterdam;41526;15654 12 | Portugal;Lisbon;91906;9957 13 | Spain;Madrid;504790;39348 14 | Sweden;Stockholm;410934;8839 15 | United Kingdom;London;243820;58862 16 | -------------------------------------------------------------------------------- /inc/pdf/tutorial/index.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Tutorials 6 | 7 | 8 | 9 |

Tutorials

10 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /inc/pdf/tutorial/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juniormarcati/os/1ece479e0e14f38df375b41d070025a636207bb5/inc/pdf/tutorial/logo.png -------------------------------------------------------------------------------- /inc/pdf/tutorial/makefont.php: -------------------------------------------------------------------------------- 1 | 7 | -------------------------------------------------------------------------------- /inc/pdf/tutorial/tuto1.php: -------------------------------------------------------------------------------- 1 | AddPage(); 6 | $pdf->SetFont('Arial','B',16); 7 | $pdf->Cell(40,10,'Hello World!'); 8 | $pdf->Output(); 9 | ?> 10 | -------------------------------------------------------------------------------- /inc/pdf/tutorial/tuto2.php: -------------------------------------------------------------------------------- 1 | Image('logo.png',10,6,30); 11 | // Arial bold 15 12 | $this->SetFont('Arial','B',15); 13 | // Move to the right 14 | $this->Cell(80); 15 | // Title 16 | $this->Cell(30,10,'Title',1,0,'C'); 17 | // Line break 18 | $this->Ln(20); 19 | } 20 | 21 | // Page footer 22 | function Footer() 23 | { 24 | // Position at 1.5 cm from bottom 25 | $this->SetY(-15); 26 | // Arial italic 8 27 | $this->SetFont('Arial','I',8); 28 | // Page number 29 | $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C'); 30 | } 31 | } 32 | 33 | // Instanciation of inherited class 34 | $pdf = new PDF(); 35 | $pdf->AliasNbPages(); 36 | $pdf->AddPage(); 37 | $pdf->SetFont('Times','',12); 38 | for($i=1;$i<=40;$i++) 39 | $pdf->Cell(0,10,'Printing line number '.$i,0,1); 40 | $pdf->Output(); 41 | ?> 42 | -------------------------------------------------------------------------------- /inc/pdf/tutorial/tuto3.php: -------------------------------------------------------------------------------- 1 | SetFont('Arial','B',15); 12 | // Calculate width of title and position 13 | $w = $this->GetStringWidth($title)+6; 14 | $this->SetX((210-$w)/2); 15 | // Colors of frame, background and text 16 | $this->SetDrawColor(0,80,180); 17 | $this->SetFillColor(230,230,0); 18 | $this->SetTextColor(220,50,50); 19 | // Thickness of frame (1 mm) 20 | $this->SetLineWidth(1); 21 | // Title 22 | $this->Cell($w,9,$title,1,1,'C',true); 23 | // Line break 24 | $this->Ln(10); 25 | } 26 | 27 | function Footer() 28 | { 29 | // Position at 1.5 cm from bottom 30 | $this->SetY(-15); 31 | // Arial italic 8 32 | $this->SetFont('Arial','I',8); 33 | // Text color in gray 34 | $this->SetTextColor(128); 35 | // Page number 36 | $this->Cell(0,10,'Page '.$this->PageNo(),0,0,'C'); 37 | } 38 | 39 | function ChapterTitle($num, $label) 40 | { 41 | // Arial 12 42 | $this->SetFont('Arial','',12); 43 | // Background color 44 | $this->SetFillColor(200,220,255); 45 | // Title 46 | $this->Cell(0,6,"Chapter $num : $label",0,1,'L',true); 47 | // Line break 48 | $this->Ln(4); 49 | } 50 | 51 | function ChapterBody($file) 52 | { 53 | // Read text file 54 | $txt = file_get_contents($file); 55 | // Times 12 56 | $this->SetFont('Times','',12); 57 | // Output justified text 58 | $this->MultiCell(0,5,$txt); 59 | // Line break 60 | $this->Ln(); 61 | // Mention in italics 62 | $this->SetFont('','I'); 63 | $this->Cell(0,5,'(end of excerpt)'); 64 | } 65 | 66 | function PrintChapter($num, $title, $file) 67 | { 68 | $this->AddPage(); 69 | $this->ChapterTitle($num,$title); 70 | $this->ChapterBody($file); 71 | } 72 | } 73 | 74 | $pdf = new PDF(); 75 | $title = '20000 Leagues Under the Seas'; 76 | $pdf->SetTitle($title); 77 | $pdf->SetAuthor('Jules Verne'); 78 | $pdf->PrintChapter(1,'A RUNAWAY REEF','20k_c1.txt'); 79 | $pdf->PrintChapter(2,'THE PROS AND CONS','20k_c2.txt'); 80 | $pdf->Output(); 81 | ?> 82 | -------------------------------------------------------------------------------- /inc/pdf/tutorial/tuto4.php: -------------------------------------------------------------------------------- 1 | SetFont('Arial','B',15); 15 | $w = $this->GetStringWidth($title)+6; 16 | $this->SetX((210-$w)/2); 17 | $this->SetDrawColor(0,80,180); 18 | $this->SetFillColor(230,230,0); 19 | $this->SetTextColor(220,50,50); 20 | $this->SetLineWidth(1); 21 | $this->Cell($w,9,$title,1,1,'C',true); 22 | $this->Ln(10); 23 | // Save ordinate 24 | $this->y0 = $this->GetY(); 25 | } 26 | 27 | function Footer() 28 | { 29 | // Page footer 30 | $this->SetY(-15); 31 | $this->SetFont('Arial','I',8); 32 | $this->SetTextColor(128); 33 | $this->Cell(0,10,'Page '.$this->PageNo(),0,0,'C'); 34 | } 35 | 36 | function SetCol($col) 37 | { 38 | // Set position at a given column 39 | $this->col = $col; 40 | $x = 10+$col*65; 41 | $this->SetLeftMargin($x); 42 | $this->SetX($x); 43 | } 44 | 45 | function AcceptPageBreak() 46 | { 47 | // Method accepting or not automatic page break 48 | if($this->col<2) 49 | { 50 | // Go to next column 51 | $this->SetCol($this->col+1); 52 | // Set ordinate to top 53 | $this->SetY($this->y0); 54 | // Keep on page 55 | return false; 56 | } 57 | else 58 | { 59 | // Go back to first column 60 | $this->SetCol(0); 61 | // Page break 62 | return true; 63 | } 64 | } 65 | 66 | function ChapterTitle($num, $label) 67 | { 68 | // Title 69 | $this->SetFont('Arial','',12); 70 | $this->SetFillColor(200,220,255); 71 | $this->Cell(0,6,"Chapter $num : $label",0,1,'L',true); 72 | $this->Ln(4); 73 | // Save ordinate 74 | $this->y0 = $this->GetY(); 75 | } 76 | 77 | function ChapterBody($file) 78 | { 79 | // Read text file 80 | $txt = file_get_contents($file); 81 | // Font 82 | $this->SetFont('Times','',12); 83 | // Output text in a 6 cm width column 84 | $this->MultiCell(60,5,$txt); 85 | $this->Ln(); 86 | // Mention 87 | $this->SetFont('','I'); 88 | $this->Cell(0,5,'(end of excerpt)'); 89 | // Go back to first column 90 | $this->SetCol(0); 91 | } 92 | 93 | function PrintChapter($num, $title, $file) 94 | { 95 | // Add chapter 96 | $this->AddPage(); 97 | $this->ChapterTitle($num,$title); 98 | $this->ChapterBody($file); 99 | } 100 | } 101 | 102 | $pdf = new PDF(); 103 | $title = '20000 Leagues Under the Seas'; 104 | $pdf->SetTitle($title); 105 | $pdf->SetAuthor('Jules Verne'); 106 | $pdf->PrintChapter(1,'A RUNAWAY REEF','20k_c1.txt'); 107 | $pdf->PrintChapter(2,'THE PROS AND CONS','20k_c2.txt'); 108 | $pdf->Output(); 109 | ?> 110 | -------------------------------------------------------------------------------- /inc/pdf/tutorial/tuto5.php: -------------------------------------------------------------------------------- 1 | Cell(40,7,$col,1); 23 | $this->Ln(); 24 | // Data 25 | foreach($data as $row) 26 | { 27 | foreach($row as $col) 28 | $this->Cell(40,6,$col,1); 29 | $this->Ln(); 30 | } 31 | } 32 | 33 | // Better table 34 | function ImprovedTable($header, $data) 35 | { 36 | // Column widths 37 | $w = array(40, 35, 40, 45); 38 | // Header 39 | for($i=0;$iCell($w[$i],7,$header[$i],1,0,'C'); 41 | $this->Ln(); 42 | // Data 43 | foreach($data as $row) 44 | { 45 | $this->Cell($w[0],6,$row[0],'LR'); 46 | $this->Cell($w[1],6,$row[1],'LR'); 47 | $this->Cell($w[2],6,number_format($row[2]),'LR',0,'R'); 48 | $this->Cell($w[3],6,number_format($row[3]),'LR',0,'R'); 49 | $this->Ln(); 50 | } 51 | // Closing line 52 | $this->Cell(array_sum($w),0,'','T'); 53 | } 54 | 55 | // Colored table 56 | function FancyTable($header, $data) 57 | { 58 | // Colors, line width and bold font 59 | $this->SetFillColor(255,0,0); 60 | $this->SetTextColor(255); 61 | $this->SetDrawColor(128,0,0); 62 | $this->SetLineWidth(.3); 63 | $this->SetFont('','B'); 64 | // Header 65 | $w = array(40, 35, 40, 45); 66 | for($i=0;$iCell($w[$i],7,$header[$i],1,0,'C',true); 68 | $this->Ln(); 69 | // Color and font restoration 70 | $this->SetFillColor(224,235,255); 71 | $this->SetTextColor(0); 72 | $this->SetFont(''); 73 | // Data 74 | $fill = false; 75 | foreach($data as $row) 76 | { 77 | $this->Cell($w[0],6,$row[0],'LR',0,'L',$fill); 78 | $this->Cell($w[1],6,$row[1],'LR',0,'L',$fill); 79 | $this->Cell($w[2],6,number_format($row[2]),'LR',0,'R',$fill); 80 | $this->Cell($w[3],6,number_format($row[3]),'LR',0,'R',$fill); 81 | $this->Ln(); 82 | $fill = !$fill; 83 | } 84 | // Closing line 85 | $this->Cell(array_sum($w),0,'','T'); 86 | } 87 | } 88 | 89 | $pdf = new PDF(); 90 | // Column headings 91 | $header = array('Country', 'Capital', 'Area (sq km)', 'Pop. (thousands)'); 92 | // Data loading 93 | $data = $pdf->LoadData('countries.txt'); 94 | $pdf->SetFont('Arial','',14); 95 | $pdf->AddPage(); 96 | $pdf->BasicTable($header,$data); 97 | $pdf->AddPage(); 98 | $pdf->ImprovedTable($header,$data); 99 | $pdf->AddPage(); 100 | $pdf->FancyTable($header,$data); 101 | $pdf->Output(); 102 | ?> 103 | -------------------------------------------------------------------------------- /inc/pdf/tutorial/tuto7.php: -------------------------------------------------------------------------------- 1 | AddFont('Calligrapher','','calligra.php'); 7 | $pdf->AddPage(); 8 | $pdf->SetFont('Calligrapher','',35); 9 | $pdf->Cell(0,10,'Enjoy new fonts with FPDF!'); 10 | $pdf->Output(); 11 | ?> 12 | -------------------------------------------------------------------------------- /inc/qrcode/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": { 3 | "chillerlan/php-qrcode": "^3.4" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /inc/qrcode/src/Data/AlphaNum.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright 2015 Smiley 10 | * @license MIT 11 | */ 12 | 13 | namespace chillerlan\QRCode\Data; 14 | 15 | use chillerlan\QRCode\QRCode; 16 | 17 | use function array_search, ord, sprintf; 18 | 19 | /** 20 | * Alphanumeric mode: 0 to 9, A to Z, space, $ % * + - . / : 21 | */ 22 | class AlphaNum extends QRDataAbstract{ 23 | 24 | /** 25 | * @inheritdoc 26 | */ 27 | protected $datamode = QRCode::DATA_ALPHANUM; 28 | 29 | /** 30 | * @inheritdoc 31 | */ 32 | protected $lengthBits = [9, 11, 13]; 33 | 34 | /** 35 | * @inheritdoc 36 | */ 37 | protected function write(string $data):void{ 38 | 39 | for($i = 0; $i + 1 < $this->strlen; $i += 2){ 40 | $this->bitBuffer->put($this->getCharCode($data[$i]) * 45 + $this->getCharCode($data[$i + 1]), 11); 41 | } 42 | 43 | if($i < $this->strlen){ 44 | $this->bitBuffer->put($this->getCharCode($data[$i]), 6); 45 | } 46 | 47 | } 48 | 49 | /** 50 | * @param string $chr 51 | * 52 | * @return int 53 | * @throws \chillerlan\QRCode\Data\QRCodeDataException 54 | */ 55 | protected function getCharCode(string $chr):int{ 56 | $i = array_search($chr, $this::ALPHANUM_CHAR_MAP); 57 | 58 | if($i !== false){ 59 | return $i; 60 | } 61 | 62 | throw new QRCodeDataException(sprintf('illegal char: "%s" [%d]', $chr, ord($chr))); 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /inc/qrcode/src/Data/Byte.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright 2015 Smiley 10 | * @license MIT 11 | */ 12 | 13 | namespace chillerlan\QRCode\Data; 14 | 15 | use chillerlan\QRCode\QRCode; 16 | 17 | use function ord; 18 | 19 | /** 20 | * Byte mode, ISO-8859-1 or UTF-8 21 | */ 22 | class Byte extends QRDataAbstract{ 23 | 24 | /** 25 | * @inheritdoc 26 | */ 27 | protected $datamode = QRCode::DATA_BYTE; 28 | 29 | /** 30 | * @inheritdoc 31 | */ 32 | protected $lengthBits = [8, 16, 16]; 33 | 34 | /** 35 | * @inheritdoc 36 | */ 37 | protected function write(string $data):void{ 38 | $i = 0; 39 | 40 | while($i < $this->strlen){ 41 | $this->bitBuffer->put(ord($data[$i]), 8); 42 | $i++; 43 | } 44 | 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /inc/qrcode/src/Data/Kanji.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright 2015 Smiley 10 | * @license MIT 11 | */ 12 | 13 | namespace chillerlan\QRCode\Data; 14 | 15 | use chillerlan\QRCode\QRCode; 16 | 17 | use function mb_strlen, ord, sprintf, strlen; 18 | 19 | /** 20 | * Kanji mode: double-byte characters from the Shift JIS character set 21 | */ 22 | class Kanji extends QRDataAbstract{ 23 | 24 | /** 25 | * @inheritdoc 26 | */ 27 | protected $datamode = QRCode::DATA_KANJI; 28 | 29 | /** 30 | * @inheritdoc 31 | */ 32 | protected $lengthBits = [8, 10, 12]; 33 | 34 | /** 35 | * @inheritdoc 36 | */ 37 | protected function getLength(string $data):int{ 38 | return mb_strlen($data, 'SJIS'); 39 | } 40 | 41 | /** 42 | * @inheritdoc 43 | */ 44 | protected function write(string $data):void{ 45 | $len = strlen($data); 46 | 47 | for($i = 0; $i + 1 < $len; $i += 2){ 48 | $c = ((0xff & ord($data[$i])) << 8) | (0xff & ord($data[$i + 1])); 49 | 50 | if(0x8140 <= $c && $c <= 0x9FFC){ 51 | $c -= 0x8140; 52 | } 53 | elseif(0xE040 <= $c && $c <= 0xEBBF){ 54 | $c -= 0xC140; 55 | } 56 | else{ 57 | throw new QRCodeDataException(sprintf('illegal char at %d [%d]', $i + 1, $c)); 58 | } 59 | 60 | $this->bitBuffer->put((($c >> 8) & 0xff) * 0xC0 + ($c & 0xff), 13); 61 | 62 | } 63 | 64 | if($i < $len){ 65 | throw new QRCodeDataException(sprintf('illegal char at %d', $i + 1)); 66 | } 67 | 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /inc/qrcode/src/Data/Number.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright 2015 Smiley 10 | * @license MIT 11 | */ 12 | 13 | namespace chillerlan\QRCode\Data; 14 | 15 | use chillerlan\QRCode\QRCode; 16 | 17 | use function ord, sprintf, substr; 18 | 19 | /** 20 | * Numeric mode: decimal digits 0 through 9 21 | */ 22 | class Number extends QRDataAbstract{ 23 | 24 | /** 25 | * @inheritdoc 26 | */ 27 | protected $datamode = QRCode::DATA_NUMBER; 28 | 29 | /** 30 | * @inheritdoc 31 | */ 32 | protected $lengthBits = [10, 12, 14]; 33 | 34 | /** 35 | * @inheritdoc 36 | */ 37 | protected function write(string $data):void{ 38 | $i = 0; 39 | 40 | while($i + 2 < $this->strlen){ 41 | $this->bitBuffer->put($this->parseInt(substr($data, $i, 3)), 10); 42 | $i += 3; 43 | } 44 | 45 | if($i < $this->strlen){ 46 | 47 | if($this->strlen - $i === 1){ 48 | $this->bitBuffer->put($this->parseInt(substr($data, $i, $i + 1)), 4); 49 | } 50 | elseif($this->strlen - $i === 2){ 51 | $this->bitBuffer->put($this->parseInt(substr($data, $i, $i + 2)), 7); 52 | } 53 | 54 | } 55 | 56 | } 57 | 58 | /** 59 | * @param string $string 60 | * 61 | * @return int 62 | * @throws \chillerlan\QRCode\Data\QRCodeDataException 63 | */ 64 | protected function parseInt(string $string):int{ 65 | $num = 0; 66 | 67 | $len = strlen($string); 68 | for($i = 0; $i < $len; $i++){ 69 | $c = ord($string[$i]); 70 | 71 | if(!in_array($string[$i], $this::NUMBER_CHAR_MAP, true)){ 72 | throw new QRCodeDataException(sprintf('illegal char: "%s" [%d]', $string[$i], $c)); 73 | } 74 | 75 | $c = $c - 48; // ord('0') 76 | $num = $num * 10 + $c; 77 | } 78 | 79 | return $num; 80 | } 81 | 82 | } 83 | -------------------------------------------------------------------------------- /inc/qrcode/src/Data/QRCodeDataException.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright 2015 Smiley 10 | * @license MIT 11 | */ 12 | 13 | namespace chillerlan\QRCode\Data; 14 | 15 | use chillerlan\QRCode\QRCodeException; 16 | 17 | class QRCodeDataException extends QRCodeException{} 18 | -------------------------------------------------------------------------------- /inc/qrcode/src/Helpers/BitBuffer.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright 2015 Smiley 10 | * @license MIT 11 | */ 12 | 13 | namespace chillerlan\QRCode\Helpers; 14 | 15 | use function count, floor; 16 | 17 | class BitBuffer{ 18 | 19 | /** 20 | * @var int[] 21 | */ 22 | public $buffer = []; 23 | 24 | /** 25 | * @var int 26 | */ 27 | public $length = 0; 28 | 29 | /** 30 | * @return \chillerlan\QRCode\Helpers\BitBuffer 31 | */ 32 | public function clear():BitBuffer{ 33 | $this->buffer = []; 34 | $this->length = 0; 35 | 36 | return $this; 37 | } 38 | 39 | /** 40 | * @param int $num 41 | * @param int $length 42 | * 43 | * @return \chillerlan\QRCode\Helpers\BitBuffer 44 | */ 45 | public function put(int $num, int $length):BitBuffer{ 46 | 47 | for($i = 0; $i < $length; $i++){ 48 | $this->putBit((($num >> ($length - $i - 1)) & 1) === 1); 49 | } 50 | 51 | return $this; 52 | } 53 | 54 | /** 55 | * @param bool $bit 56 | * 57 | * @return \chillerlan\QRCode\Helpers\BitBuffer 58 | */ 59 | public function putBit(bool $bit):BitBuffer{ 60 | $bufIndex = floor($this->length / 8); 61 | 62 | if(count($this->buffer) <= $bufIndex){ 63 | $this->buffer[] = 0; 64 | } 65 | 66 | if($bit === true){ 67 | $this->buffer[(int)$bufIndex] |= (0x80 >> ($this->length % 8)); 68 | } 69 | 70 | $this->length++; 71 | 72 | return $this; 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /inc/qrcode/src/Output/QRCodeOutputException.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright 2015 Smiley 10 | * @license MIT 11 | */ 12 | 13 | namespace chillerlan\QRCode\Output; 14 | 15 | use chillerlan\QRCode\QRCodeException; 16 | 17 | class QRCodeOutputException extends QRCodeException{} 18 | -------------------------------------------------------------------------------- /inc/qrcode/src/Output/QROutputInterface.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright 2015 Smiley 10 | * @license MIT 11 | */ 12 | 13 | namespace chillerlan\QRCode\Output; 14 | 15 | use chillerlan\QRCode\Data\QRMatrix; 16 | 17 | /** 18 | * Converts the data matrix into readable output 19 | */ 20 | interface QROutputInterface{ 21 | 22 | const DEFAULT_MODULE_VALUES = [ 23 | // light 24 | QRMatrix::M_DATA => false, // 4 25 | QRMatrix::M_FINDER => false, // 6 26 | QRMatrix::M_SEPARATOR => false, // 8 27 | QRMatrix::M_ALIGNMENT => false, // 10 28 | QRMatrix::M_TIMING => false, // 12 29 | QRMatrix::M_FORMAT => false, // 14 30 | QRMatrix::M_VERSION => false, // 16 31 | QRMatrix::M_QUIETZONE => false, // 18 32 | QRMatrix::M_LOGO => false, // 20 33 | QRMatrix::M_TEST => false, // 255 34 | // dark 35 | QRMatrix::M_DARKMODULE << 8 => true, // 512 36 | QRMatrix::M_DATA << 8 => true, // 1024 37 | QRMatrix::M_FINDER << 8 => true, // 1536 38 | QRMatrix::M_ALIGNMENT << 8 => true, // 2560 39 | QRMatrix::M_TIMING << 8 => true, // 3072 40 | QRMatrix::M_FORMAT << 8 => true, // 3584 41 | QRMatrix::M_VERSION << 8 => true, // 4096 42 | QRMatrix::M_FINDER_DOT << 8 => true, // 5632 43 | QRMatrix::M_TEST << 8 => true, // 65280 44 | ]; 45 | 46 | /** 47 | * generates the output, optionally dumps it to a file, and returns it 48 | * 49 | * @param string|null $file 50 | * 51 | * @return mixed 52 | */ 53 | public function dump(string $file = null); 54 | 55 | } 56 | -------------------------------------------------------------------------------- /inc/qrcode/src/Output/QRString.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright 2015 Smiley 10 | * @license MIT 11 | */ 12 | 13 | namespace chillerlan\QRCode\Output; 14 | 15 | use chillerlan\QRCode\QRCode; 16 | 17 | use function implode, is_string, json_encode; 18 | 19 | /** 20 | * Converts the matrix data into string types 21 | */ 22 | class QRString extends QROutputAbstract{ 23 | 24 | /** 25 | * @var string 26 | */ 27 | protected $defaultMode = QRCode::OUTPUT_STRING_TEXT; 28 | 29 | /** 30 | * @inheritDoc 31 | */ 32 | protected function setModuleValues():void{ 33 | 34 | foreach($this::DEFAULT_MODULE_VALUES as $M_TYPE => $defaultValue){ 35 | $v = $this->options->moduleValues[$M_TYPE] ?? null; 36 | 37 | if(!is_string($v)){ 38 | $this->moduleValues[$M_TYPE] = $defaultValue 39 | ? $this->options->textDark 40 | : $this->options->textLight; 41 | } 42 | else{ 43 | $this->moduleValues[$M_TYPE] = $v; 44 | } 45 | 46 | } 47 | 48 | } 49 | 50 | /** 51 | * @return string 52 | */ 53 | protected function text():string{ 54 | $str = []; 55 | 56 | foreach($this->matrix->matrix() as $row){ 57 | $r = []; 58 | 59 | foreach($row as $M_TYPE){ 60 | $r[] = $this->moduleValues[$M_TYPE]; 61 | } 62 | 63 | $str[] = implode('', $r); 64 | } 65 | 66 | return implode($this->options->eol, $str); 67 | } 68 | 69 | /** 70 | * @return string 71 | */ 72 | protected function json():string{ 73 | return json_encode($this->matrix->matrix()); 74 | } 75 | 76 | } 77 | -------------------------------------------------------------------------------- /inc/qrcode/src/QRCodeException.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright 2015 Smiley 10 | * @license MIT 11 | */ 12 | 13 | namespace chillerlan\QRCode; 14 | 15 | class QRCodeException extends \Exception{} 16 | -------------------------------------------------------------------------------- /inc/qrcode/src/QROptions.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright 2015 Smiley 10 | * @license MIT 11 | */ 12 | 13 | namespace chillerlan\QRCode; 14 | 15 | use chillerlan\Settings\SettingsContainerAbstract; 16 | 17 | /** 18 | * @property int $version 19 | * @property int $versionMin 20 | * @property int $versionMax 21 | * @property int $eccLevel 22 | * @property int $maskPattern 23 | * @property bool $addQuietzone 24 | * @property bool $quietzoneSize 25 | * 26 | * @property string $dataMode 27 | * @property string $outputType 28 | * @property string $outputInterface 29 | * @property string $cachefile 30 | * 31 | * @property string $eol 32 | * @property int $scale 33 | * 34 | * @property string $cssClass 35 | * @property string $svgOpacity 36 | * @property string $svgDefs 37 | * @property int $svgViewBoxSize 38 | * 39 | * @property string $textDark 40 | * @property string $textLight 41 | * 42 | * @property string $markupDark 43 | * @property string $markupLight 44 | * 45 | * @property bool $returnResource 46 | * @property bool $imageBase64 47 | * @property bool $imageTransparent 48 | * @property array $imageTransparencyBG 49 | * @property int $pngCompression 50 | * @property int $jpegQuality 51 | * 52 | * @property string $imagickFormat 53 | * @property string $imagickBG 54 | * 55 | * @property string $fpdfMeasureUnit 56 | * 57 | * @property array $moduleValues 58 | */ 59 | class QROptions extends SettingsContainerAbstract{ 60 | use QROptionsTrait; 61 | } 62 | -------------------------------------------------------------------------------- /inc/qrcode/tests/Data/AlphaNumTest.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright 2017 Smiley 10 | * @license MIT 11 | */ 12 | 13 | namespace chillerlan\QRCodeTest\Data; 14 | 15 | use chillerlan\QRCode\Data\{AlphaNum, QRCodeDataException}; 16 | 17 | class AlphaNumTest extends DatainterfaceTestAbstract{ 18 | 19 | protected $FQCN = AlphaNum::class; 20 | protected $testdata = '0 $%*+-./:'; 21 | protected $expected = [ 22 | 32, 80, 36, 212, 252, 15, 175, 251, 23 | 176, 236, 17, 236, 17, 236, 17, 236, 24 | 17, 236, 17, 236, 17, 236, 17, 236, 25 | 17, 236, 17, 236, 17, 236, 17, 236, 26 | 17, 236, 17, 236, 17, 236, 17, 236, 27 | 17, 236, 17, 236, 17, 236, 17, 236, 28 | 17, 236, 17, 236, 17, 236, 17, 236, 29 | 17, 236, 17, 236, 17, 236, 17, 236, 30 | 17, 236, 17, 236, 17, 236, 17, 236, 31 | 17, 236, 17, 236, 17, 236, 17, 236, 32 | 112, 43, 9, 248, 200, 194, 75, 25, 33 | 205, 173, 154, 68, 191, 16, 128, 34 | 92, 112, 20, 198, 27 35 | ]; 36 | 37 | public function testGetCharCodeException(){ 38 | $this->expectException(QRCodeDataException::class); 39 | $this->expectExceptionMessage('illegal char: "#" [35]'); 40 | 41 | $this->dataInterface->setData('#'); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /inc/qrcode/tests/Data/ByteTest.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright 2017 Smiley 10 | * @license MIT 11 | */ 12 | 13 | namespace chillerlan\QRCodeTest\Data; 14 | 15 | use chillerlan\QRCode\Data\Byte; 16 | 17 | class ByteTest extends DatainterfaceTestAbstract{ 18 | 19 | protected $FQCN = Byte::class; 20 | protected $testdata = '[¯\_(ツ)_/¯]'; 21 | protected $expected = [ 22 | 64, 245, 188, 42, 245, 197, 242, 142, 23 | 56, 56, 66, 149, 242, 252, 42, 245, 24 | 208, 236, 17, 236, 17, 236, 17, 236, 25 | 17, 236, 17, 236, 17, 236, 17, 236, 26 | 17, 236, 17, 236, 17, 236, 17, 236, 27 | 17, 236, 17, 236, 17, 236, 17, 236, 28 | 17, 236, 17, 236, 17, 236, 17, 236, 29 | 17, 236, 17, 236, 17, 236, 17, 236, 30 | 17, 236, 17, 236, 17, 236, 17, 236, 31 | 17, 236, 17, 236, 17, 236, 17, 236, 32 | 79, 89, 226, 48, 209, 89, 151, 1, 33 | 12, 73, 42, 163, 11, 34, 255, 205, 34 | 21, 47, 250, 101 35 | ]; 36 | 37 | 38 | } 39 | -------------------------------------------------------------------------------- /inc/qrcode/tests/Data/DatainterfaceTestAbstract.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright 2017 Smiley 10 | * @license MIT 11 | */ 12 | 13 | namespace chillerlan\QRCodeTest\Data; 14 | 15 | use chillerlan\QRCode\QROptions; 16 | use chillerlan\QRCode\Data\{QRCodeDataException, QRDataInterface, QRMatrix}; 17 | use chillerlan\QRCodeTest\QRTestAbstract; 18 | 19 | abstract class DatainterfaceTestAbstract extends QRTestAbstract{ 20 | 21 | /** 22 | * @var \chillerlan\QRCode\Data\QRDataAbstract 23 | */ 24 | protected $dataInterface; 25 | 26 | protected $testdata; 27 | protected $expected; 28 | 29 | protected function setUp():void{ 30 | parent::setUp(); 31 | 32 | $this->dataInterface = $this->reflection->newInstanceArgs([new QROptions(['version' => 4])]); 33 | } 34 | 35 | public function testInstance(){ 36 | $this->dataInterface = $this->reflection->newInstanceArgs([new QROptions, $this->testdata]); 37 | 38 | $this->assertInstanceOf(QRDataInterface::class, $this->dataInterface); 39 | } 40 | 41 | public function testSetData(){ 42 | $this->dataInterface->setData($this->testdata); 43 | 44 | $this->assertSame($this->expected, $this->getProperty('matrixdata')->getValue($this->dataInterface)); 45 | } 46 | 47 | public function testInitMatrix(){ 48 | $m = $this->dataInterface->setData($this->testdata)->initMatrix(0); 49 | 50 | $this->assertInstanceOf(QRMatrix::class, $m); 51 | } 52 | 53 | public function testGetMinimumVersion(){ 54 | $this->assertSame(1, $this->getMethod('getMinimumVersion')->invoke($this->dataInterface)); 55 | } 56 | 57 | public function testGetMinimumVersionException(){ 58 | $this->expectException(QRCodeDataException::class); 59 | $this->expectExceptionMessage('data exceeds'); 60 | 61 | $this->getProperty('strlen')->setValue($this->dataInterface, 13370); 62 | $this->getMethod('getMinimumVersion')->invoke($this->dataInterface); 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /inc/qrcode/tests/Data/KanjiTest.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright 2017 Smiley 10 | * @license MIT 11 | */ 12 | 13 | namespace chillerlan\QRCodeTest\Data; 14 | 15 | use chillerlan\QRCode\Data\{Kanji, QRCodeDataException}; 16 | 17 | class KanjiTest extends DatainterfaceTestAbstract{ 18 | 19 | protected $FQCN = Kanji::class; 20 | protected $testdata = '茗荷茗荷茗荷茗荷茗荷'; 21 | protected $expected = [ 22 | 128, 173, 85, 26, 95, 85, 70, 151, 23 | 213, 81, 165, 245, 84, 105, 125, 85, 24 | 26, 92, 0, 236, 17, 236, 17, 236, 25 | 17, 236, 17, 236, 17, 236, 17, 236, 26 | 17, 236, 17, 236, 17, 236, 17, 236, 27 | 17, 236, 17, 236, 17, 236, 17, 236, 28 | 17, 236, 17, 236, 17, 236, 17, 236, 29 | 17, 236, 17, 236, 17, 236, 17, 236, 30 | 17, 236, 17, 236, 17, 236, 17, 236, 31 | 17, 236, 17, 236, 17, 236, 17, 236, 32 | 195, 11, 221, 91, 141, 220, 163, 46, 33 | 165, 37, 163, 176, 79, 0, 64, 68, 34 | 96, 113, 54, 191 35 | ]; 36 | 37 | public function testIllegalCharException1(){ 38 | $this->expectException(QRCodeDataException::class); 39 | $this->expectExceptionMessage('illegal char at 1 [16191]'); 40 | 41 | $this->dataInterface->setData('ÃÃ'); 42 | } 43 | 44 | public function testIllegalCharException2(){ 45 | $this->expectException(QRCodeDataException::class); 46 | $this->expectExceptionMessage('illegal char at 1'); 47 | 48 | $this->dataInterface->setData('Ã'); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /inc/qrcode/tests/Data/MaskPatternTesterTest.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright 2017 Smiley 10 | * @license MIT 11 | */ 12 | 13 | namespace chillerlan\QRCodeTest\Data; 14 | 15 | use chillerlan\QRCode\{QROptions, Data\Byte, Data\MaskPatternTester}; 16 | use chillerlan\QRCodeTest\QRTestAbstract; 17 | 18 | class MaskPatternTesterTest extends QRTestAbstract{ 19 | 20 | protected $FQCN = MaskPatternTester::class; 21 | 22 | // coverage 23 | public function testMaskpattern(){ 24 | $matrix = (new Byte(new QROptions(['version' => 10]), 'test'))->initMatrix(3, true); 25 | 26 | $this->assertSame(4243, (new MaskPatternTester($matrix))->testPattern()); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /inc/qrcode/tests/Data/NumberTest.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright 2017 Smiley 10 | * @license MIT 11 | */ 12 | 13 | namespace chillerlan\QRCodeTest\Data; 14 | 15 | use chillerlan\QRCode\Data\{Number, QRCodeDataException}; 16 | 17 | class NumberTest extends DatainterfaceTestAbstract{ 18 | 19 | protected $FQCN = Number::class; 20 | protected $testdata = '0123456789'; 21 | protected $expected = [ 22 | 16, 40, 12, 86, 106, 105, 0, 236, 23 | 17, 236, 17, 236, 17, 236, 17, 236, 24 | 17, 236, 17, 236, 17, 236, 17, 236, 25 | 17, 236, 17, 236, 17, 236, 17, 236, 26 | 17, 236, 17, 236, 17, 236, 17, 236, 27 | 17, 236, 17, 236, 17, 236, 17, 236, 28 | 17, 236, 17, 236, 17, 236, 17, 236, 29 | 17, 236, 17, 236, 17, 236, 17, 236, 30 | 17, 236, 17, 236, 17, 236, 17, 236, 31 | 17, 236, 17, 236, 17, 236, 17, 236, 32 | 201, 141, 102, 116, 238, 162, 239, 230, 33 | 222, 37, 79, 192, 42, 109, 188, 72, 34 | 89, 63, 168, 151 35 | ]; 36 | 37 | public function testGetCharCodeException(){ 38 | $this->expectException(QRCodeDataException::class); 39 | $this->expectExceptionMessage('illegal char: "#" [35]'); 40 | 41 | $this->dataInterface->setData('#'); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /inc/qrcode/tests/Helpers/BitBufferTest.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright 2015 Smiley 10 | * @license MIT 11 | */ 12 | 13 | namespace chillerlan\QRCodeTest\Helpers; 14 | 15 | use chillerlan\QRCode\{QRCode, Helpers\BitBuffer}; 16 | use chillerlan\QRCodeTest\QRTestAbstract; 17 | 18 | class BitBufferTest extends QRTestAbstract{ 19 | 20 | /** 21 | * @var \chillerlan\QRCode\Helpers\BitBuffer 22 | */ 23 | protected $bitBuffer; 24 | 25 | protected function setUp():void{ 26 | $this->bitBuffer = new BitBuffer; 27 | } 28 | 29 | public function bitProvider(){ 30 | return [ 31 | 'number' => [QRCode::DATA_NUMBER, 16], 32 | 'alphanum' => [QRCode::DATA_ALPHANUM, 32], 33 | 'byte' => [QRCode::DATA_BYTE, 64], 34 | 'kanji' => [QRCode::DATA_KANJI, 128], 35 | ]; 36 | } 37 | 38 | /** 39 | * @dataProvider bitProvider 40 | */ 41 | public function testPut($data, $value){ 42 | $this->bitBuffer->put($data, 4); 43 | $this->assertSame($value, $this->bitBuffer->buffer[0]); 44 | $this->assertSame(4, $this->bitBuffer->length); 45 | } 46 | 47 | public function testClear(){ 48 | $this->bitBuffer->clear(); 49 | $this->assertSame([], $this->bitBuffer->buffer); 50 | $this->assertSame(0, $this->bitBuffer->length); 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /inc/qrcode/tests/Helpers/PolynomialTest.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright 2015 Smiley 10 | * @license MIT 11 | */ 12 | 13 | namespace chillerlan\QRCodeTest\Helpers; 14 | 15 | use chillerlan\QRCode\Helpers\Polynomial; 16 | use chillerlan\QRCode\QRCodeException; 17 | use chillerlan\QRCodeTest\QRTestAbstract; 18 | 19 | class PolynomialTest extends QRTestAbstract{ 20 | 21 | /** 22 | * @var \chillerlan\QRCode\Helpers\Polynomial 23 | */ 24 | protected $polynomial; 25 | 26 | protected function setUp():void{ 27 | $this->polynomial = new Polynomial; 28 | } 29 | 30 | public function testGexp(){ 31 | $this->assertSame(142, $this->polynomial->gexp(-1)); 32 | $this->assertSame(133, $this->polynomial->gexp(128)); 33 | $this->assertSame(2, $this->polynomial->gexp(256)); 34 | } 35 | 36 | public function testGlogException(){ 37 | $this->expectException(QRCodeException::class); 38 | $this->expectExceptionMessage('log(0)'); 39 | 40 | $this->polynomial->glog(0); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /inc/qrcode/tests/Output/QRFpdfTest.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright 2020 smiley 10 | * @license MIT 11 | */ 12 | 13 | namespace chillerlan\QRCodeTest\Output; 14 | 15 | use FPDF; 16 | use chillerlan\QRCode\Output\{QRFpdf, QROutputInterface}; 17 | use chillerlan\QRCode\{QRCode, QROptions}; 18 | 19 | use function class_exists, substr; 20 | 21 | /** 22 | * Tests the QRFpdf output module 23 | */ 24 | class QRFpdfTest extends QROutputTestAbstract{ 25 | 26 | protected $FQCN = QRFpdf::class; 27 | 28 | /** 29 | * @inheritDoc 30 | * @internal 31 | */ 32 | public function setUp():void{ 33 | 34 | if(!class_exists(FPDF::class)){ 35 | $this->markTestSkipped('FPDF not available'); 36 | return; 37 | } 38 | 39 | parent::setUp(); 40 | } 41 | 42 | /** 43 | * @inheritDoc 44 | */ 45 | public function testSetModuleValues():void{ 46 | 47 | $this->options->moduleValues = [ 48 | // data 49 | 1024 => [0, 0, 0], 50 | 4 => [255, 255, 255], 51 | ]; 52 | 53 | $this->outputInterface->dump(); 54 | 55 | $this::assertTrue(true); // tricking the code coverage 56 | } 57 | 58 | /** 59 | * @inheritDoc 60 | */ 61 | public function testRenderImage():void{ 62 | $type = QRCode::OUTPUT_FPDF; 63 | 64 | $this->options->outputType = $type; 65 | $this->options->imageBase64 = false; 66 | $this->outputInterface->dump($this::cachefile.$type); 67 | 68 | // substr() to avoid CreationDate 69 | $expected = substr(file_get_contents($this::cachefile.$type), 0, 2000); 70 | $actual = substr($this->outputInterface->dump(), 0, 2000); 71 | 72 | $this::assertSame($expected, $actual); 73 | } 74 | 75 | public function testOutputGetResource():void{ 76 | $this->options->returnResource = true; 77 | 78 | $this->setOutputInterface(); 79 | 80 | $this::assertInstanceOf(FPDF::class, $this->outputInterface->dump()); 81 | } 82 | 83 | } 84 | -------------------------------------------------------------------------------- /inc/qrcode/tests/Output/QRImageTest.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright 2017 Smiley 10 | * @license MIT 11 | */ 12 | 13 | namespace chillerlan\QRCodeTest\Output; 14 | 15 | use chillerlan\QRCode\{QRCode, Output\QRImage}; 16 | 17 | class QRImageTest extends QROutputTestAbstract{ 18 | 19 | protected $FQCN = QRImage::class; 20 | 21 | public function types(){ 22 | return [ 23 | 'png' => [QRCode::OUTPUT_IMAGE_PNG], 24 | 'gif' => [QRCode::OUTPUT_IMAGE_GIF], 25 | 'jpg' => [QRCode::OUTPUT_IMAGE_JPG], 26 | ]; 27 | } 28 | 29 | /** 30 | * @dataProvider types 31 | * @param $type 32 | */ 33 | public function testImageOutput($type){ 34 | $this->options->outputType = $type; 35 | $this->options->imageBase64 = false; 36 | 37 | $this->setOutputInterface(); 38 | $this->outputInterface->dump($this::cachefile.$type); 39 | $img = $this->outputInterface->dump(); 40 | 41 | if($type === QRCode::OUTPUT_IMAGE_JPG){ // jpeg encoding may cause different results 42 | $this->markAsRisky(); 43 | } 44 | 45 | $this->assertSame($img, file_get_contents($this::cachefile.$type)); 46 | } 47 | 48 | public function testSetModuleValues(){ 49 | 50 | $this->options->moduleValues = [ 51 | // data 52 | 1024 => [0, 0, 0], 53 | 4 => [255, 255, 255], 54 | ]; 55 | 56 | $this->setOutputInterface()->dump(); 57 | 58 | $this->assertTrue(true); // tricking the code coverage 59 | } 60 | 61 | public function testOutputGetResource():void{ 62 | $this->options->returnResource = true; 63 | 64 | $this->setOutputInterface(); 65 | 66 | $this::assertIsResource($this->outputInterface->dump()); 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /inc/qrcode/tests/Output/QRImagickTest.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright 2018 smiley 10 | * @license MIT 11 | * 12 | * @noinspection PhpComposerExtensionStubsInspection 13 | */ 14 | 15 | namespace chillerlan\QRCodeTest\Output; 16 | 17 | use Imagick; 18 | use chillerlan\QRCode\{QRCode, Output\QRImagick}; 19 | 20 | class QRImagickTest extends QROutputTestAbstract{ 21 | 22 | protected $FQCN = QRImagick::class; 23 | 24 | public function setUp():void{ 25 | 26 | if(!extension_loaded('imagick')){ 27 | $this->markTestSkipped('ext-imagick not loaded'); 28 | return; 29 | } 30 | 31 | parent::setUp(); 32 | } 33 | 34 | public function testImageOutput(){ 35 | $type = QRCode::OUTPUT_IMAGICK; 36 | 37 | $this->options->outputType = $type; 38 | $this->setOutputInterface(); 39 | $this->outputInterface->dump($this::cachefile.$type); 40 | $img = $this->outputInterface->dump(); 41 | 42 | $this->assertSame($img, file_get_contents($this::cachefile.$type)); 43 | } 44 | 45 | public function testSetModuleValues(){ 46 | 47 | $this->options->moduleValues = [ 48 | // data 49 | 1024 => '#4A6000', 50 | 4 => '#ECF9BE', 51 | ]; 52 | 53 | $this->setOutputInterface()->dump(); 54 | 55 | $this->assertTrue(true); // tricking the code coverage 56 | } 57 | 58 | public function testOutputGetResource():void{ 59 | $this->options->returnResource = true; 60 | 61 | $this->setOutputInterface(); 62 | 63 | $this::assertInstanceOf(Imagick::class, $this->outputInterface->dump()); 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /inc/qrcode/tests/Output/QRMarkupTest.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright 2017 Smiley 10 | * @license MIT 11 | */ 12 | 13 | namespace chillerlan\QRCodeTest\Output; 14 | 15 | use chillerlan\QRCode\{QRCode, Output\QRMarkup}; 16 | 17 | class QRMarkupTest extends QROutputTestAbstract{ 18 | 19 | protected $FQCN = QRMarkup::class; 20 | 21 | public function types(){ 22 | return [ 23 | 'html' => [QRCode::OUTPUT_MARKUP_HTML], 24 | 'svg' => [QRCode::OUTPUT_MARKUP_SVG], 25 | ]; 26 | } 27 | 28 | /** 29 | * @dataProvider types 30 | * @param $type 31 | */ 32 | public function testMarkupOutputFile($type){ 33 | $this->options->outputType = $type; 34 | $this->options->cachefile = $this::cachefile.$type; 35 | $this->setOutputInterface(); 36 | $data = $this->outputInterface->dump(); 37 | 38 | $this->assertSame($data, file_get_contents($this->options->cachefile)); 39 | } 40 | 41 | /** 42 | * @dataProvider types 43 | * @param $type 44 | */ 45 | public function testMarkupOutput($type){ 46 | $this->options->imageBase64 = false; 47 | $this->options->outputType = $type; 48 | $this->setOutputInterface(); 49 | 50 | $expected = explode($this->options->eol, file_get_contents($this::cachefile.$type)); 51 | // cut off the doctype & head 52 | array_shift($expected); 53 | 54 | if($type === QRCode::OUTPUT_MARKUP_HTML){ 55 | // cut off the tag 56 | array_pop($expected); 57 | } 58 | 59 | $expected = implode($this->options->eol, $expected); 60 | 61 | $this->assertSame(trim($expected), trim($this->outputInterface->dump())); 62 | } 63 | 64 | public function testSetModuleValues(){ 65 | 66 | $this->options->imageBase64 = false; 67 | $this->options->moduleValues = [ 68 | // data 69 | 1024 => '#4A6000', 70 | 4 => '#ECF9BE', 71 | ]; 72 | 73 | $this->setOutputInterface(); 74 | $data = $this->outputInterface->dump(); 75 | $this->assertStringContainsString('#4A6000', $data); 76 | $this->assertStringContainsString('#ECF9BE', $data); 77 | } 78 | 79 | } 80 | -------------------------------------------------------------------------------- /inc/qrcode/tests/Output/QROutputTestAbstract.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright 2017 Smiley 10 | * @license MIT 11 | */ 12 | 13 | namespace chillerlan\QRCodeTest\Output; 14 | 15 | use chillerlan\QRCode\QROptions; 16 | use chillerlan\QRCode\Data\Byte; 17 | use chillerlan\QRCode\Output\{QRCodeOutputException, QROutputInterface}; 18 | use chillerlan\QRCodeTest\QRTestAbstract; 19 | 20 | use function dirname, file_exists, mkdir; 21 | 22 | abstract class QROutputTestAbstract extends QRTestAbstract{ 23 | 24 | const cachefile = __DIR__.'/../../.build/output_test/test.'; 25 | 26 | /** 27 | * @var \chillerlan\QRCode\Output\QROutputInterface 28 | */ 29 | protected $outputInterface; 30 | 31 | /** 32 | * @var \chillerlan\QRCode\QROptions 33 | */ 34 | protected $options; 35 | 36 | /** 37 | * @var \chillerlan\QRCode\Data\QRMatrix 38 | */ 39 | protected $matrix; 40 | 41 | protected function setUp():void{ 42 | parent::setUp(); 43 | 44 | $buildDir = dirname($this::cachefile); 45 | if(!file_exists($buildDir)){ 46 | mkdir($buildDir, 0777, true); 47 | } 48 | 49 | $this->options = new QROptions; 50 | $this->setOutputInterface(); 51 | } 52 | 53 | protected function setOutputInterface(){ 54 | $this->outputInterface = $this->reflection->newInstanceArgs([$this->options, (new Byte($this->options, 'testdata'))->initMatrix(0)]); 55 | return $this->outputInterface; 56 | } 57 | 58 | public function testInstance(){ 59 | $this->assertInstanceOf(QROutputInterface::class, $this->outputInterface); 60 | } 61 | 62 | public function testSaveException(){ 63 | $this->expectException(QRCodeOutputException::class); 64 | $this->expectExceptionMessage('Could not write data to cache file: /foo'); 65 | 66 | $this->options->cachefile = '/foo'; 67 | $this->setOutputInterface(); 68 | $this->outputInterface->dump(); 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /inc/qrcode/tests/Output/QRStringTest.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright 2017 Smiley 10 | * @license MIT 11 | */ 12 | 13 | namespace chillerlan\QRCodeTest\Output; 14 | 15 | use chillerlan\QRCode\{QRCode, Output\QRString}; 16 | 17 | class QRStringTest extends QROutputTestAbstract{ 18 | 19 | protected $FQCN = QRString::class; 20 | 21 | public function types(){ 22 | return [ 23 | 'json' => [QRCode::OUTPUT_STRING_JSON], 24 | 'text' => [QRCode::OUTPUT_STRING_TEXT], 25 | ]; 26 | } 27 | 28 | /** 29 | * @dataProvider types 30 | * @param $type 31 | */ 32 | public function testStringOutput($type){ 33 | $this->options->outputType = $type; 34 | $this->options->cachefile = $this::cachefile.$type; 35 | $this->setOutputInterface(); 36 | $data = $this->outputInterface->dump(); 37 | 38 | $this->assertSame($data, file_get_contents($this->options->cachefile)); 39 | } 40 | 41 | public function testSetModuleValues(){ 42 | 43 | $this->options->moduleValues = [ 44 | // data 45 | 1024 => 'A', 46 | 4 => 'B', 47 | ]; 48 | 49 | $this->setOutputInterface(); 50 | $data = $this->outputInterface->dump(); 51 | 52 | $this->assertStringContainsString('A', $data); 53 | $this->assertStringContainsString('B', $data); 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /inc/qrcode/tests/QROptionsTest.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright 2018 smiley 10 | * @license MIT 11 | */ 12 | 13 | namespace chillerlan\QRCodeTest; 14 | 15 | use chillerlan\QRCode\{QRCode, QRCodeException, QROptions}; 16 | use PHPUnit\Framework\TestCase; 17 | 18 | class QROptionsTest extends TestCase{ 19 | 20 | /** 21 | * @var \chillerlan\QRCode\QROptions 22 | */ 23 | protected $options; 24 | 25 | public function testVersionClamp(){ 26 | $this->assertSame(40, (new QROptions(['version' => 42]))->version); 27 | $this->assertSame(1, (new QROptions(['version' => -42]))->version); 28 | $this->assertSame(21, (new QROptions(['version' => 21]))->version); 29 | $this->assertSame(QRCode::VERSION_AUTO, (new QROptions)->version); // QRCode::VERSION_AUTO = -1, default 30 | } 31 | 32 | public function testVersionMinMaxClamp(){ 33 | // normal clamp 34 | $o = new QROptions(['versionMin' => 5, 'versionMax' => 10]); 35 | $this->assertSame(5, $o->versionMin); 36 | $this->assertSame(10, $o->versionMax); 37 | 38 | // exceeding values 39 | $o = new QROptions(['versionMin' => -42, 'versionMax' => 42]); 40 | $this->assertSame(1, $o->versionMin); 41 | $this->assertSame(40, $o->versionMax); 42 | 43 | // min > max 44 | $o = new QROptions(['versionMin' => 10, 'versionMax' => 5]); 45 | $this->assertSame(5, $o->versionMin); 46 | $this->assertSame(10, $o->versionMax); 47 | 48 | $o = new QROptions(['versionMin' => 42, 'versionMax' => -42]); 49 | $this->assertSame(1, $o->versionMin); 50 | $this->assertSame(40, $o->versionMax); 51 | } 52 | 53 | public function testMaskPatternClamp(){ 54 | $this->assertSame(7, (new QROptions(['maskPattern' => 42]))->maskPattern); 55 | $this->assertSame(0, (new QROptions(['maskPattern' => -42]))->maskPattern); 56 | $this->assertSame(QRCode::MASK_PATTERN_AUTO, (new QROptions)->maskPattern); // QRCode::MASK_PATTERN_AUTO = -1, default 57 | } 58 | 59 | public function testInvalidEccLevelException(){ 60 | $this->expectException(QRCodeException::class); 61 | $this->expectExceptionMessage('Invalid error correct level: 42'); 62 | 63 | new QROptions(['eccLevel' => 42]); 64 | } 65 | 66 | public function testClampRGBValues(){ 67 | $o = new QROptions(['imageTransparencyBG' => [-1, 0, 999]]); 68 | 69 | $this->assertSame(0, $o->imageTransparencyBG[0]); 70 | $this->assertSame(0, $o->imageTransparencyBG[1]); 71 | $this->assertSame(255, $o->imageTransparencyBG[2]); 72 | } 73 | 74 | public function testInvalidRGBValueException(){ 75 | $this->expectException(QRCodeException::class); 76 | $this->expectExceptionMessage('Invalid RGB value.'); 77 | 78 | new QROptions(['imageTransparencyBG' => ['r', 'g', 'b']]); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /inc/qrcode/tests/QRTestAbstract.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright 2017 Smiley 10 | * @license MIT 11 | */ 12 | 13 | namespace chillerlan\QRCodeTest; 14 | 15 | use PHPUnit\Framework\TestCase; 16 | use ReflectionClass, ReflectionMethod, ReflectionProperty; 17 | 18 | abstract class QRTestAbstract extends TestCase{ 19 | 20 | /** 21 | * @var \ReflectionClass 22 | */ 23 | protected $reflection; 24 | 25 | /** 26 | * @var string 27 | */ 28 | protected $FQCN; 29 | 30 | protected function setUp():void{ 31 | $this->reflection = new ReflectionClass($this->FQCN); 32 | } 33 | 34 | /** 35 | * @param string $method 36 | * 37 | * @return \ReflectionMethod 38 | */ 39 | protected function getMethod(string $method):ReflectionMethod { 40 | $method = $this->reflection->getMethod($method); 41 | $method->setAccessible(true); 42 | 43 | return $method; 44 | } 45 | 46 | /** 47 | * @param string $property 48 | * 49 | * @return \ReflectionProperty 50 | */ 51 | protected function getProperty(string $property):ReflectionProperty{ 52 | $property = $this->reflection->getProperty($property); 53 | $property->setAccessible(true); 54 | 55 | return $property; 56 | } 57 | 58 | /** 59 | * @param $object 60 | * @param string $property 61 | * @param $value 62 | * 63 | * @return void 64 | */ 65 | protected function setProperty($object, string $property, $value){ 66 | $property = $this->getProperty($property); 67 | $property->setAccessible(true); 68 | $property->setValue($object, $value); 69 | } 70 | 71 | 72 | } 73 | -------------------------------------------------------------------------------- /inc/qrcode/vendor/autoload.php: -------------------------------------------------------------------------------- 1 | 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /inc/qrcode/vendor/chillerlan/php-qrcode/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "chillerlan/php-qrcode", 3 | "description": "A QR code generator. PHP 7.2+", 4 | "homepage": "https://github.com/chillerlan/php-qrcode", 5 | "license": "MIT", 6 | "minimum-stability": "stable", 7 | "type": "library", 8 | "keywords": [ 9 | "QR code", "qrcode", "qr", "qrcode-generator", "phpqrcode" 10 | ], 11 | "authors": [ 12 | { 13 | "name": "Kazuhiko Arase", 14 | "homepage": "https://github.com/kazuhikoarase" 15 | }, 16 | { 17 | "name": "Smiley", 18 | "email": "smiley@chillerlan.net", 19 | "homepage": "https://github.com/codemasher" 20 | }, 21 | { 22 | "name": "Contributors", 23 | "homepage":"https://github.com/chillerlan/php-qrcode/graphs/contributors" 24 | } 25 | ], 26 | "require": { 27 | "php": "^7.2", 28 | "ext-mbstring": "*", 29 | "chillerlan/php-settings-container": "^1.2" 30 | }, 31 | "require-dev": { 32 | "phpunit/phpunit": "^8.5", 33 | "setasign/fpdf": "^1.8.2" 34 | }, 35 | "suggest": { 36 | "chillerlan/php-authenticator": "Yet another Google authenticator! Also creates URIs for mobile apps.", 37 | "setasign/fpdf": "Required to use the QR FPDF output." 38 | }, 39 | "autoload": { 40 | "psr-4": { 41 | "chillerlan\\QRCode\\": "src/" 42 | } 43 | }, 44 | "autoload-dev": { 45 | "psr-4": { 46 | "chillerlan\\QRCodePublic\\": "public/", 47 | "chillerlan\\QRCodeTest\\": "tests/", 48 | "chillerlan\\QRCodeExamples\\": "examples/" 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /inc/qrcode/vendor/chillerlan/php-qrcode/examples/MyCustomOutput.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright 2017 Smiley 10 | * @license MIT 11 | */ 12 | 13 | namespace chillerlan\QRCodeExamples; 14 | 15 | use chillerlan\QRCode\Output\QROutputAbstract; 16 | 17 | class MyCustomOutput extends QROutputAbstract{ 18 | 19 | protected function setModuleValues():void{ 20 | // TODO: Implement setModuleValues() method. 21 | } 22 | 23 | public function dump(string $file = null){ 24 | 25 | $output = ''; 26 | 27 | for($row = 0; $row < $this->moduleCount; $row++){ 28 | for($col = 0; $col < $this->moduleCount; $col++){ 29 | $output .= (int)$this->matrix->check($col, $row); 30 | } 31 | } 32 | 33 | return $output; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /inc/qrcode/vendor/chillerlan/php-qrcode/examples/QRImageWithLogo.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright 2020 smiley 10 | * @license MIT 11 | * 12 | * @noinspection PhpComposerExtensionStubsInspection 13 | */ 14 | 15 | namespace chillerlan\QRCodeExamples; 16 | 17 | use chillerlan\QRCode\Output\{QRCodeOutputException, QRImage}; 18 | 19 | use function imagecopyresampled, imagecreatefrompng, imagesx, imagesy, is_file, is_readable; 20 | 21 | /** 22 | * @property \chillerlan\QRCodeExamples\LogoOptions $options 23 | */ 24 | class QRImageWithLogo extends QRImage{ 25 | 26 | /** 27 | * @param string|null $file 28 | * @param string|null $logo 29 | * 30 | * @return string 31 | * @throws \chillerlan\QRCode\Output\QRCodeOutputException 32 | */ 33 | public function dump(string $file = null, string $logo = null):string{ 34 | // set returnResource to true to skip further processing for now 35 | $this->options->returnResource = true; 36 | 37 | // of course you could accept other formats too (such as resource or Imagick) 38 | // i'm not checking for the file type either for simplicity reasons (assuming PNG) 39 | if(!is_file($logo) || !is_readable($logo)){ 40 | throw new QRCodeOutputException('invalid logo'); 41 | } 42 | 43 | $this->matrix->setLogoSpace( 44 | $this->options->logoWidth, 45 | $this->options->logoHeight 46 | // not utilizing the position here 47 | ); 48 | 49 | // there's no need to save the result of dump() into $this->image here 50 | parent::dump($file); 51 | 52 | $im = imagecreatefrompng($logo); 53 | 54 | // get logo image size 55 | $w = imagesx($im); 56 | $h = imagesy($im); 57 | 58 | // set new logo size, leave a border of 1 module 59 | $lw = ($this->options->logoWidth - 2) * $this->options->scale; 60 | $lh = ($this->options->logoHeight - 2) * $this->options->scale; 61 | 62 | // get the qrcode size 63 | $ql = $this->matrix->size() * $this->options->scale; 64 | 65 | // scale the logo and copy it over. done! 66 | imagecopyresampled($this->image, $im, ($ql - $lw) / 2, ($ql - $lh) / 2, 0, 0, $lw, $lh, $w, $h); 67 | 68 | $imageData = $this->dumpImage(); 69 | 70 | if($file !== null){ 71 | $this->saveToFile($imageData, $file); 72 | } 73 | 74 | if($this->options->imageBase64){ 75 | $imageData = 'data:image/'.$this->options->outputType.';base64,'.base64_encode($imageData); 76 | } 77 | 78 | return $imageData; 79 | } 80 | 81 | } 82 | -------------------------------------------------------------------------------- /inc/qrcode/vendor/chillerlan/php-qrcode/examples/custom_output.php: -------------------------------------------------------------------------------- 1 | 7 | * @copyright 2017 Smiley 8 | * @license MIT 9 | */ 10 | 11 | namespace chillerlan\QRCodeExamples; 12 | 13 | use chillerlan\QRCode\{QRCode, QROptions}; 14 | 15 | require_once __DIR__.'/../vendor/autoload.php'; 16 | 17 | $data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s'; 18 | 19 | // invoke the QROutputInterface manually 20 | $options = new QROptions([ 21 | 'version' => 5, 22 | 'eccLevel' => QRCode::ECC_L, 23 | ]); 24 | 25 | $qrOutputInterface = new MyCustomOutput($options, (new QRCode($options))->getMatrix($data)); 26 | 27 | var_dump($qrOutputInterface->dump()); 28 | 29 | 30 | // or just 31 | $options = new QROptions([ 32 | 'version' => 5, 33 | 'eccLevel' => QRCode::ECC_L, 34 | 'outputType' => QRCode::OUTPUT_CUSTOM, 35 | 'outputInterface' => MyCustomOutput::class, 36 | ]); 37 | 38 | var_dump((new QRCode($options))->render($data)); 39 | -------------------------------------------------------------------------------- /inc/qrcode/vendor/chillerlan/php-qrcode/examples/example_image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juniormarcati/os/1ece479e0e14f38df375b41d070025a636207bb5/inc/qrcode/vendor/chillerlan/php-qrcode/examples/example_image.png -------------------------------------------------------------------------------- /inc/qrcode/vendor/chillerlan/php-qrcode/examples/example_svg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juniormarcati/os/1ece479e0e14f38df375b41d070025a636207bb5/inc/qrcode/vendor/chillerlan/php-qrcode/examples/example_svg.png -------------------------------------------------------------------------------- /inc/qrcode/vendor/chillerlan/php-qrcode/examples/fpdf.php: -------------------------------------------------------------------------------- 1 | 7, 13 | 'outputType' => QRCode::OUTPUT_FPDF, 14 | 'eccLevel' => QRCode::ECC_L, 15 | 'scale' => 5, 16 | 'imageBase64' => false, 17 | 'moduleValues' => [ 18 | // finder 19 | 1536 => [0, 63, 255], // dark (true) 20 | 6 => [255, 255, 255], // light (false), white is the transparency color and is enabled by default 21 | // alignment 22 | 2560 => [255, 0, 255], 23 | 10 => [255, 255, 255], 24 | // timing 25 | 3072 => [255, 0, 0], 26 | 12 => [255, 255, 255], 27 | // format 28 | 3584 => [67, 191, 84], 29 | 14 => [255, 255, 255], 30 | // version 31 | 4096 => [62, 174, 190], 32 | 16 => [255, 255, 255], 33 | // data 34 | 1024 => [0, 0, 0], 35 | 4 => [255, 255, 255], 36 | // darkmodule 37 | 512 => [0, 0, 0], 38 | // separator 39 | 8 => [255, 255, 255], 40 | // quietzone 41 | 18 => [255, 255, 255], 42 | ], 43 | ]); 44 | 45 | \header('Content-type: application/pdf'); 46 | 47 | echo (new QRCode($options))->render($data); 48 | -------------------------------------------------------------------------------- /inc/qrcode/vendor/chillerlan/php-qrcode/examples/html.php: -------------------------------------------------------------------------------- 1 | 7 | * @copyright 2017 Smiley 8 | * @license MIT 9 | */ 10 | 11 | namespace chillerlan\QRCodeExamples; 12 | 13 | use chillerlan\QRCode\{QRCode, QROptions}; 14 | 15 | require_once '../vendor/autoload.php'; 16 | 17 | header('Content-Type: text/html; charset=utf-8'); 18 | 19 | ?> 20 | 21 | 22 | 23 | 24 | 25 | QRCode test 26 | 55 | 56 | 57 |
58 | 5, 64 | 'outputType' => QRCode::OUTPUT_MARKUP_HTML, 65 | 'eccLevel' => QRCode::ECC_L, 66 | 'moduleValues' => [ 67 | // finder 68 | 1536 => '#A71111', // dark (true) 69 | 6 => '#FFBFBF', // light (false) 70 | // alignment 71 | 2560 => '#A70364', 72 | 10 => '#FFC9C9', 73 | // timing 74 | 3072 => '#98005D', 75 | 12 => '#FFB8E9', 76 | // format 77 | 3584 => '#003804', 78 | 14 => '#00FB12', 79 | // version 80 | 4096 => '#650098', 81 | 16 => '#E0B8FF', 82 | // data 83 | 1024 => '#4A6000', 84 | 4 => '#ECF9BE', 85 | // darkmodule 86 | 512 => '#080063', 87 | // separator 88 | 8 => '#AFBFBF', 89 | // quietzone 90 | 18 => '#FFFFFF', 91 | ], 92 | ]); 93 | 94 | echo (new QRCode($options))->render($data); 95 | 96 | ?> 97 |
98 | 99 | 100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /inc/qrcode/vendor/chillerlan/php-qrcode/examples/image.php: -------------------------------------------------------------------------------- 1 | 7 | * @copyright 2017 Smiley 8 | * @license MIT 9 | */ 10 | 11 | namespace chillerlan\QRCodeExamples; 12 | 13 | use chillerlan\QRCode\{QRCode, QROptions}; 14 | 15 | require_once __DIR__.'/../vendor/autoload.php'; 16 | 17 | $data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s'; 18 | 19 | $options = new QROptions([ 20 | 'version' => 7, 21 | 'outputType' => QRCode::OUTPUT_IMAGE_PNG, 22 | 'eccLevel' => QRCode::ECC_L, 23 | 'scale' => 5, 24 | 'imageBase64' => false, 25 | 'moduleValues' => [ 26 | // finder 27 | 1536 => [0, 63, 255], // dark (true) 28 | 6 => [255, 255, 255], // light (false), white is the transparency color and is enabled by default 29 | // alignment 30 | 2560 => [255, 0, 255], 31 | 10 => [255, 255, 255], 32 | // timing 33 | 3072 => [255, 0, 0], 34 | 12 => [255, 255, 255], 35 | // format 36 | 3584 => [67, 191, 84], 37 | 14 => [255, 255, 255], 38 | // version 39 | 4096 => [62, 174, 190], 40 | 16 => [255, 255, 255], 41 | // data 42 | 1024 => [0, 0, 0], 43 | 4 => [255, 255, 255], 44 | // darkmodule 45 | 512 => [0, 0, 0], 46 | // separator 47 | 8 => [255, 255, 255], 48 | // quietzone 49 | 18 => [255, 255, 255], 50 | ], 51 | ]); 52 | 53 | header('Content-type: image/png'); 54 | 55 | echo (new QRCode($options))->render($data); 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /inc/qrcode/vendor/chillerlan/php-qrcode/examples/imageWithLogo.php: -------------------------------------------------------------------------------- 1 | 7 | * @copyright 2020 smiley 8 | * @license MIT 9 | */ 10 | 11 | namespace chillerlan\QRCodeExamples; 12 | 13 | use chillerlan\QRCode\{QRCode, QROptions}; 14 | 15 | require_once __DIR__.'/../vendor/autoload.php'; 16 | 17 | $data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s'; 18 | /** 19 | * @property int $logoWidth 20 | * @property int $logoHeight 21 | * 22 | * @noinspection PhpIllegalPsrClassPathInspection 23 | */ 24 | class LogoOptions extends QROptions{ 25 | protected $logoWidth; 26 | protected $logoHeight; 27 | } 28 | 29 | $options = new LogoOptions; 30 | 31 | $options->version = 7; 32 | $options->eccLevel = QRCode::ECC_H; 33 | $options->imageBase64 = false; 34 | $options->logoWidth = 13; 35 | $options->logoHeight = 13; 36 | $options->scale = 5; 37 | $options->imageTransparent = false; 38 | 39 | header('Content-type: image/png'); 40 | 41 | $qrOutputInterface = new QRImageWithLogo($options, (new QRCode($options))->getMatrix($data)); 42 | 43 | // dump the output, with an additional logo 44 | echo $qrOutputInterface->dump(null, __DIR__.'/octocat.png'); 45 | -------------------------------------------------------------------------------- /inc/qrcode/vendor/chillerlan/php-qrcode/examples/imageWithText.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright 2019 Smiley 10 | * @license MIT 11 | */ 12 | 13 | namespace chillerlan\QRCodeExamples; 14 | 15 | use chillerlan\QRCode\{QRCode, QROptions}; 16 | 17 | require_once __DIR__.'/../vendor/autoload.php'; 18 | 19 | $data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s'; 20 | 21 | $options = new QROptions([ 22 | 'version' => 7, 23 | 'outputType' => QRCode::OUTPUT_IMAGE_PNG, 24 | 'scale' => 3, 25 | 'imageBase64' => false, 26 | ]); 27 | 28 | header('Content-type: image/png'); 29 | 30 | $qrOutputInterface = new QRImageWithText($options, (new QRCode($options))->getMatrix($data)); 31 | 32 | // dump the output, with additional text 33 | echo $qrOutputInterface->dump(null, 'example text'); 34 | -------------------------------------------------------------------------------- /inc/qrcode/vendor/chillerlan/php-qrcode/examples/imagick.php: -------------------------------------------------------------------------------- 1 | 7 | * @copyright 2017 Smiley 8 | * @license MIT 9 | */ 10 | 11 | namespace chillerlan\QRCodeExamples; 12 | 13 | use chillerlan\QRCode\{QRCode, QROptions}; 14 | 15 | require_once __DIR__.'/../vendor/autoload.php'; 16 | 17 | $data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s'; 18 | 19 | $options = new QROptions([ 20 | 'version' => 7, 21 | 'outputType' => QRCode::OUTPUT_IMAGICK, 22 | 'eccLevel' => QRCode::ECC_L, 23 | 'scale' => 5, 24 | 'moduleValues' => [ 25 | // finder 26 | 1536 => '#A71111', // dark (true) 27 | 6 => '#FFBFBF', // light (false) 28 | // alignment 29 | 2560 => '#A70364', 30 | 10 => '#FFC9C9', 31 | // timing 32 | 3072 => '#98005D', 33 | 12 => '#FFB8E9', 34 | // format 35 | 3584 => '#003804', 36 | 14 => '#00FB12', 37 | // version 38 | 4096 => '#650098', 39 | 16 => '#E0B8FF', 40 | // data 41 | 1024 => '#4A6000', 42 | 4 => '#ECF9BE', 43 | // darkmodule 44 | 512 => '#080063', 45 | // separator 46 | 8 => '#DDDDDD', 47 | // quietzone 48 | 18 => '#DDDDDD', 49 | ], 50 | ]); 51 | 52 | header('Content-type: image/png'); 53 | 54 | echo (new QRCode($options))->render($data); 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /inc/qrcode/vendor/chillerlan/php-qrcode/examples/octocat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juniormarcati/os/1ece479e0e14f38df375b41d070025a636207bb5/inc/qrcode/vendor/chillerlan/php-qrcode/examples/octocat.png -------------------------------------------------------------------------------- /inc/qrcode/vendor/chillerlan/php-qrcode/examples/svg.php: -------------------------------------------------------------------------------- 1 | 7 | * @copyright 2017 Smiley 8 | * @license MIT 9 | */ 10 | 11 | namespace chillerlan\QRCodeExamples; 12 | 13 | use chillerlan\QRCode\{QRCode, QROptions}; 14 | 15 | require_once __DIR__.'/../vendor/autoload.php'; 16 | 17 | $data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s'; 18 | $gzip = true; 19 | 20 | $options = new QROptions([ 21 | 'version' => 7, 22 | 'outputType' => QRCode::OUTPUT_MARKUP_SVG, 23 | 'eccLevel' => QRCode::ECC_L, 24 | 'svgViewBoxSize' => 530, 25 | 'addQuietzone' => true, 26 | 'cssClass' => 'my-css-class', 27 | 'svgOpacity' => 1.0, 28 | 'svgDefs' => ' 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | ', 38 | 'moduleValues' => [ 39 | // finder 40 | 1536 => 'url(#g1)', // dark (true) 41 | 6 => '#fff', // light (false) 42 | // alignment 43 | 2560 => 'url(#g1)', 44 | 10 => '#fff', 45 | // timing 46 | 3072 => 'url(#g1)', 47 | 12 => '#fff', 48 | // format 49 | 3584 => 'url(#g1)', 50 | 14 => '#fff', 51 | // version 52 | 4096 => 'url(#g1)', 53 | 16 => '#fff', 54 | // data 55 | 1024 => 'url(#g2)', 56 | 4 => '#fff', 57 | // darkmodule 58 | 512 => 'url(#g1)', 59 | // separator 60 | 8 => '#fff', 61 | // quietzone 62 | 18 => '#fff', 63 | ], 64 | ]); 65 | 66 | $qrcode = (new QRCode($options))->render($data); 67 | 68 | header('Content-type: image/svg+xml'); 69 | 70 | if($gzip === true){ 71 | header('Vary: Accept-Encoding'); 72 | header('Content-Encoding: gzip'); 73 | $qrcode = gzencode($qrcode ,9); 74 | } 75 | echo $qrcode; 76 | 77 | 78 | -------------------------------------------------------------------------------- /inc/qrcode/vendor/chillerlan/php-qrcode/examples/text.php: -------------------------------------------------------------------------------- 1 | 7 | * @copyright 2017 Smiley 8 | * @license MIT 9 | */ 10 | 11 | namespace chillerlan\QRCodeExamples; 12 | 13 | use chillerlan\QRCode\{QRCode, QROptions}; 14 | 15 | require_once __DIR__.'/../vendor/autoload.php'; 16 | 17 | $data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s'; 18 | 19 | $options = new QROptions([ 20 | 'version' => 5, 21 | 'outputType' => QRCode::OUTPUT_STRING_TEXT, 22 | 'eccLevel' => QRCode::ECC_L, 23 | ]); 24 | 25 | //
 to view it in a browser
26 | echo '
'.(new QRCode($options))->render($data).'
'; 27 | 28 | 29 | // custom values 30 | $options = new QROptions([ 31 | 'version' => 5, 32 | 'outputType' => QRCode::OUTPUT_STRING_TEXT, 33 | 'eccLevel' => QRCode::ECC_L, 34 | 'moduleValues' => [ 35 | // finder 36 | 1536 => 'A', // dark (true) 37 | 6 => 'a', // light (false) 38 | // alignment 39 | 2560 => 'B', 40 | 10 => 'b', 41 | // timing 42 | 3072 => 'C', 43 | 12 => 'c', 44 | // format 45 | 3584 => 'D', 46 | 14 => 'd', 47 | // version 48 | 4096 => 'E', 49 | 16 => 'e', 50 | // data 51 | 1024 => 'F', 52 | 4 => 'f', 53 | // darkmodule 54 | 512 => 'G', 55 | // separator 56 | 8 => 'h', 57 | // quietzone 58 | 18 => 'i', 59 | ], 60 | ]); 61 | 62 | //
 to view it in a browser
63 | echo '
'.(new QRCode($options))->render($data).'
'; 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /inc/qrcode/vendor/chillerlan/php-qrcode/phpdoc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | public/docs 5 | 6 | 7 | public/docs 8 | 9 | 10 | src 11 | 12 | 13 |