Compare commits

...

14 Commits

Author SHA1 Message Date
Mario Fetka
770aca21de correct fuzzy patch 2017-10-20 17:30:58 +02:00
Mario Fetka
0b991e6294 Bump 2017-10-20 17:19:42 +02:00
Mario Fetka
25de787b3b Merge tag 'upstream/0.6.26'
Upstream version 0.6.26
2017-10-20 17:10:51 +02:00
Mario Fetka
a6b4158f1f Imported Upstream version 0.6.26 2017-10-20 17:10:51 +02:00
Mario Fetka
6f819398fe prepare for bump 2017-10-20 17:10:37 +02:00
Mario Fetka
997a632ca7 Bump 2017-05-23 20:55:41 +02:00
Mario Fetka
6ca723cebe upstream js and fpdf 2017-05-20 22:16:12 +02:00
Mario Fetka
bd7f077c77 kohana to webapp dir 2017-05-20 22:08:10 +02:00
Mario Fetka
bd55adea07 update fpdf and fpdi 2017-05-20 22:02:18 +02:00
Mario Fetka
cb87236f6b update fpdf and fpdi 2017-05-20 21:59:50 +02:00
Mario Fetka
c0391eb5ba php7 compat first round 2017-05-20 21:41:48 +02:00
Mario Fetka
fce3ef7f28 no no need for jsmin 2017-05-20 18:33:39 +02:00
Mario Fetka
1635f8cf19 no dfsg source package 2017-05-20 18:12:33 +02:00
Mario Fetka
45853aaaf7 Bump patches 2017-05-20 17:53:41 +02:00
170 changed files with 14053 additions and 2919 deletions

3
.gitignore vendored

@ -36,3 +36,6 @@ scripts/rrd_convert.pl
scripts/rrd_converter.pl
man/npcd.8
*.swp
*.swo

@ -1,4 +1,12 @@
**pnp-0.6.?? ??/??/2015**
**pnp-0.6.?? ??/??/2017**
**pnp-0.6.26 08/21/2017**
* Bugfix: Use complete option arguments for compatibility with rrdtool 1.6.0 (sbraz)
* Bugfix: Zoom on a special template not possbile (stinnux)
* Update: Update for FPDF (1.81) and FPDI (1.6.1) (Jan T. Bein )
* Bugfix: address behaviour of rrdtool1.5+ tp not export timestamp by default
* Feature: Template for icinga2's built-in icinga check (Tontonitch)
* Bugfix: fix non well formed numeric value encountered (sni)
**pnp-0.6.25 01/03/2015**
* Update: FPDF Update to Version 1.7

22
configure vendored

@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.61 for pnp 0.6.25.
# Generated by GNU Autoconf 2.61 for pnp 0.6.26.
#
# Report bugs to <pnp4nagios-devel@lists.sourceforge.net>.
#
@ -574,8 +574,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='pnp'
PACKAGE_TARNAME='pnp'
PACKAGE_VERSION='0.6.25'
PACKAGE_STRING='pnp 0.6.25'
PACKAGE_VERSION='0.6.26'
PACKAGE_STRING='pnp 0.6.26'
PACKAGE_BUGREPORT='pnp4nagios-devel@lists.sourceforge.net'
ac_unique_file="src/"
@ -1219,7 +1219,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures pnp 0.6.25 to adapt to many kinds of systems.
\`configure' configures pnp 0.6.26 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1284,7 +1284,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of pnp 0.6.25:";;
short | recursive ) echo "Configuration of pnp 0.6.26:";;
esac
cat <<\_ACEOF
@ -1380,7 +1380,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
pnp configure 0.6.25
pnp configure 0.6.26
generated by GNU Autoconf 2.61
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@ -1394,7 +1394,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by pnp $as_me 0.6.25, which was
It was created by pnp $as_me 0.6.26, which was
generated by GNU Autoconf 2.61. Invocation command line was
$ $0 $@
@ -1764,9 +1764,9 @@ _ACEOF
PKG_NAME=pnp4nagios
PKG_VERSION="0.6.25"
PKG_VERSION="0.6.26"
PKG_HOME_URL="http://www.pnp4nagios.org/pnp/start"
PKG_REL_DATE="03-01-2015"
PKG_REL_DATE="08-21-2017"
@ -6330,7 +6330,7 @@ exec 6>&1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by pnp $as_me 0.6.25, which was
This file was extended by pnp $as_me 0.6.26, which was
generated by GNU Autoconf 2.61. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -6379,7 +6379,7 @@ Report bugs to <bug-autoconf@gnu.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
pnp config.status 0.6.25
pnp config.status 0.6.26
configured by $0, generated by GNU Autoconf 2.61,
with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"

@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.61)
AC_INIT(pnp, 0.6.25, pnp4nagios-devel@lists.sourceforge.net)
AC_INIT(pnp, 0.6.26, pnp4nagios-devel@lists.sourceforge.net)
AC_CONFIG_SRCDIR(src/)
AC_CONFIG_HEADERS(include/config.h:include/config.h.in)
AC_PREFIX_DEFAULT(/usr/local/pnp4nagios)
@ -11,9 +11,9 @@ AC_DEFINE([DEFAULT_NAGIOS_USER], [nagios], [Default Nagios User])
AC_DEFINE([DEFAULT_NAGIOS_GROUP], [nagios], [Default Nagios Group])
PKG_NAME=pnp4nagios
PKG_VERSION="0.6.25"
PKG_VERSION="0.6.26"
PKG_HOME_URL="http://www.pnp4nagios.org/pnp/start"
PKG_REL_DATE="03-01-2015"
PKG_REL_DATE="08-21-2017"
AC_SUBST(PKG_NAME)
AC_SUBST(PKG_VERSION)
AC_SUBST(PKG_HOME_URL)

6
debian/changelog vendored

@ -1,3 +1,9 @@
pnp4nagios (0.6.26-1) UNRELEASED; urgency=medium
* 0.6.26
-- Mario Fetka <mario.fetka@gmail.com> Fri, 20 Oct 2017 17:15:49 +0200
pnp4nagios (0.6.25-1) UNRELEASED; urgency=medium
* Bump to new upstream verison

12
debian/control vendored

@ -12,8 +12,7 @@ Build-Depends:
quilt,
rrdtool,
librrds-perl,
python,
python-jsmin
python
Standards-Version: 3.9.6
Homepage: http://www.pnp4nagios.org/
Vcs-Git: git://anonscm.debian.org/pkg-nagios/pkg-pnp4nagios.git
@ -97,13 +96,8 @@ Package: pnp4nagios-web
Architecture: all
Depends:
${misc:Depends},
libapache2-mod-php5 | php5-cgi | php5,
php5-gd,
libkohana2-php,
libfpdi-php,
libjs-jquery (>= 1.6.2),
libjs-jquery-ui (>= 1.8.ooops.14),
libjs-jquery-mobile,
libapache2-mod-php5 | libapache2-mod-php7.0 | php5-cgi | php7.0-cgi | php7.0 | php5,
php7.0-gd | php5-gd ,
rrdtool,
adduser
Recommends: pnp4nagios-bin, pnp4nagios-web-config-icinga | pnp4nagios-web-config-nagios4

1
debian/docs vendored

@ -1 +1,2 @@
AUTHORS
README.md

@ -3,19 +3,19 @@ Author: Markus Frosch <lazyfrosch@debian.org>
Last-Update: 2017-05-20
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/sample-config/pnp/config.php.in 2015-01-03 14:09:06.000000000 +0100
+++ b/sample-config/pnp/config.php.in 2017-05-20 17:21:56.852000000 +0200
--- a/sample-config/pnp/config.php.in 2017-05-20 17:52:02.532000000 +0200
+++ b/sample-config/pnp/config.php.in 2017-05-20 17:48:33.008000000 +0200
@@ -89,7 +89,8 @@
#
# Link back to Nagios or Thruk ( www.thruk.org )
#
-$conf['nagios_base'] = "/nagios/cgi-bin";
-$conf['nagios_base'] = "/cgi-bin/nagios4";
+## Debian: please see /etc/pnp4nagios/config.<NAME>.php
+##$conf['nagios_base'] = "/cgi-bin/nagios4";
#
# Link back to check_mk´s multisite ( http://mathias-kettner.de/checkmk_multisite.html )
@@ -272,4 +273,10 @@
@@ -278,4 +279,10 @@
'#F6E8C3','#C7EAE5','#DFC27D','#80CDC1','#BF812D','#35978F','#8C510A','#01665E');
$scheme['mixed3'] = array ('#67001F','#80CDC1','#B2182B','#35978F','#D6604D','#01665E','#F4A582','#003C30',
'#FDDBC7','#92C5DE','#D1E5F0','#2166AC','#4393C3','#8C510A','#053061','#BF812D');

@ -1,15 +0,0 @@
Description: FPDI is shipped in its own subdirectory -- adopt path in pdf.php.
Author: Sven Velt <sven@velt.de>
Forwarded: not-needed
--- a/share/pnp/application/controllers/pdf.php 2015-01-03 14:09:06.000000000 +0100
+++ b/share/pnp/application/controllers/pdf.php 2017-05-20 15:37:12.472000000 +0200
@@ -259,7 +259,7 @@
*
*/
require Kohana::find_file('vendor/fpdf', 'fpdf');
-require Kohana::find_file('vendor/fpdf', 'fpdi');
+require Kohana::find_file('vendor/fpdi', 'fpdi');
class PDF extends FPDI {
//Page header
function Header() {

475
debian/patches/pnp-metrics-api vendored Normal file

@ -0,0 +1,475 @@
diff -uNr pnp4nagios.orig/README pnp4nagios-0.6.26/README
--- pnp4nagios.orig/README 2017-08-21 17:52:37.000000000 +0200
+++ pnp4nagios-0.6.26/README 2017-10-20 17:29:21.680000000 +0200
@@ -8,3 +8,8 @@
http://pnp4nagios.sourceforge.net or:
http://docs.pnp4nagios.org/
+
+## pnp-metrics-api ###
+
+https://github.com/lingej/pnp-metrics-api
+README.md
diff -uNr pnp4nagios.orig/README.md pnp4nagios-0.6.26/README.md
--- pnp4nagios.orig/README.md 1970-01-01 01:00:00.000000000 +0100
+++ pnp4nagios-0.6.26/README.md 2017-10-20 17:02:31.336000000 +0200
@@ -0,0 +1,56 @@
+# pnp-metrics-api
+## Usage examples
+### CURL
+#### Query metrics of a service on a specific host
+```
+curl -s -u '<username>:<password>' -H "Content-Type: application/json" -X POST -d '
+{
+ "targets":[
+ {
+ "host":"host1.example.org",
+ "service":"_HOST_",
+ "perflabel":"rta",
+ "type":"AVERAGE"
+ },
+ {
+ "host":"host2.example.org",
+ "service":"_HOST_",
+ "perflabel":"rta",
+ "type":"AVERAGE"
+ }
+ ],
+ "start":'UNIXEPOCHTIMESTAMP_START',
+ "end":'UNIXEPOCHTIMESTAMP_END'
+}' https://example.org/pnp4nagios/index.php/api/metrics
+```
+#### List all hosts
+```
+curl -s -u '<username>:<password>' https://example.org/pnp4nagios/index.php/api/hosts
+```
+
+#### List services of a host
+```
+curl -s -u '<username>:<password>' -H "Content-Type: application/json" -X POST -d '
+{
+ "host":"host.example.org"
+}' https://example.org/pnp4nagios/index.php/api/services
+```
+
+You can use regular expressions for host lists:
+
+```
+curl -s -u '<username>:<password>' -H "Content-Type: application/json" -X POST -d '
+{
+ "host":"/^local"
+}' https://example.org/pnp4nagios/index.php/api/services
+```
+
+
+#### List labels of a service of specific host
+```
+curl -s -u '<username>:<password>' -H "Content-Type: application/json" -X POST -d '
+{
+ "host":"host.example.org",
+ "service":"_HOST_"
+}' https://example.org/pnp4nagios/index.php/api/labels
+```
diff -uNr pnp4nagios.orig/share/pnp/application/controllers/api.php pnp4nagios-0.6.26/share/pnp/application/controllers/api.php
--- pnp4nagios.orig/share/pnp/application/controllers/api.php 1970-01-01 01:00:00.000000000 +0100
+++ pnp4nagios-0.6.26/share/pnp/application/controllers/api.php 2017-10-20 17:29:56.444000000 +0200
@@ -0,0 +1,399 @@
+<?php defined('SYSPATH') OR die('No direct access allowed.');
+/**
+* API controller.
+*
+* @package pnp4nagios
+* @author Joerg Linge
+* @license GPL
+*/
+class Api_Controller extends System_Controller {
+
+ public function __construct(){
+ parent::__construct();
+ // Disable auto-rendering
+ $this->auto_render = FALSE;
+ $this->data->getTimeRange($this->start,$this->end,$this->view);
+ // Graphana sends JSON via POST
+ $this->post_data = json_decode(file_get_contents('php://input'), true);
+
+ }
+
+ public function index() {
+ $data['pnp_version'] = PNP_VERSION;
+ $data['pnp_rel_date'] = PNP_REL_DATE;
+ $data['error'] = "";
+ return_json($data, 200);
+ }
+
+ /*
+ *
+ *
+ */
+ public function hosts($query = false) {
+ $data = array();
+ $hosts = getHosts($this->data, $query);
+ foreach ( $hosts as $host ){
+ $data['hosts'][] = array(
+ 'name' => $host
+ );
+ }
+ return_json($data, 200);
+ }
+
+ /*
+ *
+ *
+ */
+ public function services() {
+ $data = array();
+ if ($_SERVER['REQUEST_METHOD'] != 'POST') {
+ // Only Post Reuests
+ $data['error'] = "Only POST Requests allowed";
+ return_json($data, 901);
+ return;
+ }
+ $pdata = json_decode(file_get_contents('php://input'), TRUE);
+
+ $host = arr_get($pdata, "host");
+ if ( $host === false ){
+ $data['error'] = "No hostname specified";
+ return_json($data, 901);
+ return;
+ }
+ $services = array();
+ $hosts = getHosts($this->data, $host);
+ $services = getServices($this->data, $hosts);
+ $duplicates = array();
+
+ foreach($services as $service){
+ // skip duplicates
+ if(isset($duplicates[$service['servicedesc']])) {
+ continue;
+ }
+ $duplicates[$service['servicedesc']] = true;
+ $data['services'][] = array(
+ 'name' => $service['name'],
+ 'servicedesc' => $service['servicedesc'],
+ 'hostname' => $service['hostname']
+ );
+ }
+ return_json($data, 200);
+ }
+
+ /*
+ *
+ *
+ */
+ public function labels ( $host=false, $service=false ) {
+ $data = array();
+ if ($_SERVER['REQUEST_METHOD'] != 'POST') {
+ // Only Post Reuests
+ $data['error'] = "Only POST Requests allowed";
+ return_json($data, 901);
+ return;
+ }
+ $pdata = json_decode(file_get_contents('php://input'), TRUE);
+ $host = arr_get($pdata, "host");
+ $service = arr_get($pdata, "service");
+
+ if ( $host === false ){
+ $data['error'] = "No hostname specified";
+ return_json($data, 901);
+ return;
+ }
+ if ( $service === false ){
+ $data['error'] = "No service specified";
+ return_json($data, 901);
+ return;
+ }
+
+ $hosts = getHosts($this->data, $host);
+ $services = getServices($this->data, $hosts, $service);
+ $duplicates = array();
+
+ foreach($services as $service){
+ try {
+ // read XML file
+ $this->data->readXML($service['hostname'], $service['name']);
+ } catch (Kohana_Exception $e) {
+ $data['error'] = "$e";
+ return_json($data, 901);
+ return;
+ }
+
+ foreach( $this->data->DS as $KEY => $DS) {
+ // skip duplicates
+ if(isset($duplicates[$DS['LABEL']])) {
+ continue;
+ }
+ $duplicates[$DS['LABEL']] = true;
+ $data['labels'][] = array(
+ 'name' => $DS['NAME'],
+ 'label' => $DS['LABEL'],
+ 'service' => $service['name'],
+ 'hostname' => $service['hostname']
+ );
+ }
+ }
+ return_json($data, 200);
+ }
+
+
+ public function metrics(){
+ // extract metrics for a given datasource
+ // TODO Multiple sources via regex
+ if ($_SERVER['REQUEST_METHOD'] != 'POST') {
+ // Only Post Reuests
+ $data['error'] = "Only POST Requests allowed";
+ return_json($data, 901);
+ return;
+ }
+ $hosts = array(); // List of all Hosts
+ $services = array(); // List of services for a given host
+ $pdata = json_decode(file_get_contents('php://input'), TRUE);
+ $data = array();
+
+ if ( !isset($pdata['targets']) ){
+ $data['error'] = "No targets specified";
+ return_json($data, 901);
+ return;
+ }
+
+ foreach( $pdata['targets'] as $key => $target){
+
+ $this->data->TIMERANGE['start'] = arr_get($pdata, 'start');
+ $this->data->TIMERANGE['end'] = arr_get($pdata, 'end');
+ $host = arr_get($target, 'host');
+ $service = arr_get($target, 'service');
+ $perflabel = arr_get($target, 'perflabel');
+ $type = arr_get($target, 'type');
+ $refid = arr_get($target, 'refid');
+ if ( $host === false ){
+ $data['error'] = "No hostname specified";
+ return_json($data, 901);
+ return;
+ }
+ if ( $service === false ){
+ $data['error'] = "No service specified";
+ return_json($data, 901);
+ return;
+ }
+ if ( $perflabel === false ){
+ $data['error'] = "No perfdata label specified";
+ return_json($data, 901);
+ return;
+ }
+ if ( $type === false ){
+ $data['error'] = "No perfdata type specified";
+ return_json($data, 901);
+ return;
+ }
+ $hosts = getHosts($this->data, $host);
+ $services = getServices($this->data, $hosts, $service);
+
+ $hk = 0; // Host Key
+
+ foreach ( $services as $service) {
+ $host = $service['hostname'];
+ $service = $service['name'];
+ try {
+ // read XML file
+ $this->data->readXML($host, $service);
+ } catch (Kohana_Exception $e) {
+ $data['error'] = "$e";
+ return_json($data, 901);
+ return;
+ }
+
+ // create a Perflabel List
+ $perflabels = array();
+ foreach( $this->data->DS as $value){
+ $label = arr_get($value, "LABEL" );
+ if (isRegex($perflabel)) {
+ if(!preg_match( $perflabel, $label ) ){
+ continue;
+ }
+ } elseif ( $perflabel != $label ) {
+ continue;
+ }
+ $perflabels[] = array(
+ "label" => arr_get($value, "NAME" ),
+ "warn" => arr_get($value, "WARN" ),
+ "crit" => arr_get($value, "CRIT" )
+ );
+ }
+
+ foreach ( $perflabels as $tmp_perflabel){
+ try {
+ $this->data->buildXport($host, $service);
+ $xml = $this->rrdtool->doXport($this->data->XPORT);
+ } catch (Kohana_Exception $e) {
+ $data['error'] = "$e";
+ return_json($data, 901);
+ return;
+ }
+
+ $xpd = simplexml_load_string($xml);
+ $i = 0;
+ $index = -1;
+ foreach ( $xpd->meta->legend->entry as $k=>$v){
+ if($type == "WARNING" || $type == "CRITICAL") {
+ if( $v == $tmp_perflabel['label']."_AVERAGE"){
+ $index = $i;
+ break;
+ }
+ }
+ else {
+ if( $v == $tmp_perflabel['label']."_".$type){
+ $index = $i;
+ break;
+ }
+ }
+ $i++;
+ }
+ if ( $index === -1 ){
+ $data['error'] = "No perfdata found for ".$tmp_perflabel['label']."_".$type;
+ return_json($data, 901);
+ return;
+ }
+
+ $start = (string) $xpd->meta->start;
+ $end = (string) $xpd->meta->end;
+ $step = (string) $xpd->meta->step;
+ $data['targets'][$key][$hk]['start'] = $start * 1000;
+ $data['targets'][$key][$hk]['end'] = $end * 1000;
+ $data['targets'][$key][$hk]['host'] = $host;
+ $data['targets'][$key][$hk]['service'] = $service;
+ $data['targets'][$key][$hk]['perflabel'] = $tmp_perflabel['label'];
+ $data['targets'][$key][$hk]['type'] = $type;
+
+ $i = 0;
+ if($type == "WARNING" || $type == "CRITICAL") {
+ foreach ( $xpd->data->row as $row=>$value){
+ // timestamp in milliseconds
+ $timestamp = ( $start + $i * $step ) * 1000;
+ if($type == "WARNING") {
+ $d = floatval($tmp_perflabel['warn']);
+ } else {
+ $d = floatval($tmp_perflabel['crit']);
+ }
+ $data['targets'][$key][$hk]['datapoints'][] = array( $d, $timestamp );
+ $i++;
+ }
+ } else {
+ foreach ( $xpd->data->row as $row=>$value){
+ // timestamp in milliseconds
+ $timestamp = ( $start + $i * $step ) * 1000;
+ $d = (string) $value->v->$index;
+ if ($d == "NaN"){
+ $d = null;
+ }else{
+ $d = floatval($d);
+ }
+ $data['targets'][$key][$hk]['datapoints'][] = array( $d, $timestamp );
+ $i++;
+ }
+ }
+
+ $hk++;
+
+ }
+ }
+ }
+
+ return_json($data, 200);
+ }
+}
+/*
+* return array key
+*/
+function arr_get($array, $key=false, $default=false){
+ if ( isset($array) && $key == false ){
+ return $array;
+ }
+ $keys = explode(".", $key);
+ foreach ($keys as $key_part) {
+ if ( isset($array[$key_part] ) === false ) {
+ if (! is_array($array) or ! array_key_exists($key_part, $array)) {
+ return $default;
+ }
+ }
+ $array = $array[$key_part];
+ }
+ return $array;
+}
+
+/*
+*
+*/
+function return_json( $data, $status=200 ){
+ $json = json_encode($data);
+ header('Status: '.$status);
+ header('Content-type: application/json');
+ print $json;
+}
+
+function isRegex($string){
+ // if string looks like an regex /regex/
+ if ( substr($string,0,1) == "/" && substr($string,-1,1) == "/" && strlen($string) >= 2 ){
+ return true;
+ }else{
+ return false;
+ }
+}
+
+function getHosts($data, $query = false) {
+ $result = array();
+ $hosts = $data->getHosts();
+ $isRegex = false;
+ if ($query !== false && isRegex($query) ) {
+ $isRegex = true;
+ }
+ foreach ( $hosts as $host ){
+ if ( $host['state'] != 'active' ){
+ continue;
+ }
+ if($isRegex) {
+ if(preg_match("$query", $host['name']) ) {
+ $result[] = $host['name'];
+ }
+ }
+ elseif ($query !== false) {
+ if("$query" == $host['name']) {
+ $result[] = $host['name'];
+ }
+ } else {
+ $result[] = $host['name'];
+ }
+ }
+ return($result);
+}
+
+/*
+* returns list of service hashes
+*/
+function getServices($data, $hosts, $query = false) {
+ $result = array();
+ $isRegex = false;
+ if ($query !== false && isRegex($query) ) {
+ $isRegex = true;
+ }
+ foreach ( $hosts as $host){
+ $services = $data->getServices($host);
+ foreach ($services as $value) {
+ if ($isRegex) {
+ if ( preg_match("$query", $value['name']) || preg_match("$query", $value['servicedesc'])) {
+ $result[] = $value;
+ }
+ }
+ elseif ($query !== false) {
+ if("$query" == $value['name'] || "$query" == $value['servicedesc']) {
+ $result[] = $value;
+ }
+ } else {
+ $result[] = $value;
+ }
+ }
+ }
+ return($result);
+}

@ -1,23 +0,0 @@
Description: Remove flattr link code from documentation
The code is actually not used, because the flattr JS stuff is not included.
.
But we are disabling it anyways.
Author: Markus Frosch <markus@lazyfrosch.de>
Last-Update: 2014-10-26
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/share/pnp/documents/de_DE/start.html
+++ b/share/pnp/documents/de_DE/start.html
@@ -12,12 +12,6 @@
</div>
<p>
-
-<div class="flattr_left"><a class="FlattrButton" style="display:none;" title="PNP Dokumentation" href="http://docs.pnp4nagios.org/de/pnp-0.6/start" rev="flattr;uid:44827;category:text;language:de;tags:;">PNP4Nagios Dokumentation Version 0.6.x[...]</a></div>
-</p>
-
-<p>
-
<a href="/_detail/pnp-0.6/gallery/pnp-preview-05-08-2009.png?id=de%3Apnp-0.6%3Astart" class="media" title="pnp-0.6:gallery:pnp-preview-05-08-2009.png"><img src="/_media/pnp-0.6/gallery/pnp-preview-05-08-2009.png?w=215" class="mediaright" align="right" title="Theme &quot;smoothness&quot;" alt="Theme &quot;smoothness&quot;" width="215" /></a>
</p>

@ -1,9 +1,8 @@
fix-path-fpdi
apache-fix-path-to-userfile
fix-npcd-path
fix-nagios-url
adjust-template-path
privacy-warning
config_instances
install_opts
hardening
pnp-metrics-api

@ -1,7 +1,8 @@
etc/pnp4nagios/nagios.cfg
etc/pnp4nagios/check_commands/
etc/pnp4nagios/*.cfg
usr/lib/pnp4nagios/
usr/lib/pnp4nagios/libexec/
usr/lib/pnp4nagios/npcdmod.o
../../scripts/verify_pnp_config_v2.pl /usr/lib/pnp4nagios/libexec/
usr/sbin/npcd
usr/share/doc/pnp4nagios/examples/*.cfg

@ -9,5 +9,6 @@ usr/share/doc/pnp4nagios/examples/templates.special/
usr/share/doc/pnp4nagios/examples/pages/
usr/share/doc/pnp4nagios/examples/ssi/
usr/share/pnp4nagios/html/
usr/lib/pnp4nagios/kohana/
var/log/pnp4nagios/kohana/
var/lib/pnp4nagios/

@ -1,6 +0,0 @@
/usr/share/php/fpdf /usr/share/pnp4nagios/html/application/vendor/fpdf
/usr/share/php/fpdi /usr/share/pnp4nagios/html/application/vendor/fpdi
/usr/share/javascript/jquery/jquery.min.js /usr/share/pnp4nagios/html/media/js/jquery-min.js
/usr/share/javascript/jquery-ui/jquery-ui.js /usr/share/pnp4nagios/html/media/js/jquery-ui.min.js
/usr/share/javascript/jquery-mobile/jquery.mobile.min.js /usr/share/pnp4nagios/html/media/js/jquery.mobile.min.js
/usr/share/javascript/jquery-mobile/jquery.mobile.min.css /usr/share/pnp4nagios/html/media/css/jquery.mobile.min.css

16
debian/rules vendored

@ -15,14 +15,14 @@ override_dh_auto_configure:
dh_auto_configure -- \
--with-layout=debian \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--without-kohana \
--with-kohana_system=/usr/share/php/kohana2/system
--infodir=/usr/share/info
# --without-kohana \
# --with-kohana_system=/usr/share/php/kohana2/system
override_dh_auto_build:
dh_auto_build -- all
python -m jsmin share/pnp/media/js/jquery.imgareaselect.js \
> share/pnp/media/js/jquery.imgareaselect.min.js
#python -m jsmin share/pnp/media/js/jquery.imgareaselect.js \
# > share/pnp/media/js/jquery.imgareaselect.min.js
override_dh_auto_install:
dh_auto_install -- install-config
@ -67,11 +67,11 @@ override_dh_auto_install:
cp debian/icinga-module.cfg debian/tmp/usr/share/doc/pnp4nagios/examples/
# Remove external PHP classes/libraries: FPDF, FPDF-TPL, FPDI
rm -r debian/tmp/usr/share/pnp4nagios/html/application/vendor/fpdf
#rm -r debian/tmp/usr/share/pnp4nagios/html/application/vendor/fpdf
# remove source files
rm debian/tmp/usr/share/pnp4nagios/html/media/js/jquery.imgareaselect.Debian.txt
rm debian/tmp/usr/share/pnp4nagios/html/media/js/jquery.imgareaselect.js
#rm -f debian/tmp/usr/share/pnp4nagios/html/media/js/jquery.imgareaselect.Debian.txt
#rm -f debian/tmp/usr/share/pnp4nagios/html/media/js/jquery.imgareaselect.js
# Remove external JavaScript files: jQuery and jQuery-UI
# no longer present in DFSG tarball

@ -1044,6 +1044,7 @@ sub parse_perfstring {
my $check_multi_blockcount = 0;
my $multi_parent = cleanup( $NAGIOS{SERVICEDESC} );
my $auth_servicedesc = $NAGIOS{DISP_SERVICEDESC};
my $seen_multi_label = "";
while ($perfstring) {
( $perfstring, %p ) = _parse($perfstring);
if ( !$p{label} ) {
@ -1052,8 +1053,19 @@ sub parse_perfstring {
@perfs = ();
last;
}
if ( $p{label} =~ /$seen_multi_label/ ) {
# multi label format for each perfdata item (e.g Icinga2)
# we're in a sub tree of a multi block, adjust label for further processing
my $tmp_prefix = $seen_multi_label."::";
$p{label} =~ s/$tmp_prefix//;
}
if ( $p{label} =~ /^[']?([a-zA-Z0-9\.\-_\s\/\#]+)::([a-zA-Z0-9\.\-_\s]+)::([^=]+)[']?$/ ) {
@multi = ( $1, $2, $3 );
$seen_multi_label = $multi[0]."::".$multi[1];
if ( $count == 0 ) {
print_log( "DEBUG: First check_multi block", 3 );

@ -1,9 +1,9 @@
#!@SHELL@
#
#
### BEGIN INIT INFO
# Provides: npcd
# Required-Start:
# Required-Stop:
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: @PKG_NAME@ NPCD Daemon Version @PKG_VERSION@
@ -14,7 +14,7 @@
#
# File : npcd
#
servicename=@npcd_name@
prefix=@prefix@
exec_prefix=${prefix}
@ -47,10 +47,10 @@ printstatus_npcd(){
exit 0
elif test $? -eq 2; then
echo "$servicename is not running but subsystem locked"
exit 2
exit 3
else
echo "$servicename is not running"
exit 1
exit 3
fi
}
@ -86,7 +86,7 @@ if [ ! -f $NpcdCfgFile ]; then
echo "Configuration file $NpcdCfgFile not found. Exiting."
exit 1
fi
# See how we were called.
case "$1" in
@ -94,7 +94,7 @@ case "$1" in
status_npcd
if [ $? -eq 0 ]; then
echo "$servicename already started..."
exit 1
exit 0
fi
echo -n "Starting $servicename:"
touch $NpcdRunFile
@ -109,7 +109,7 @@ case "$1" in
status_npcd
if ! [ $? -eq 0 ]; then
echo "$servicename was not running... could not stop"
exit 1
exit 0
fi
echo -n "Stopping $servicename: "
@ -136,7 +136,7 @@ case "$1" in
else
echo 'done.'
fi
rm -f $NpcdLockDir/$NpcdLockFile
rm -f $NpcdLockDir/$NpcdLockFile
;;
status)
@ -158,5 +158,5 @@ case "$1" in
;;
esac
# End of this script

@ -49,7 +49,7 @@ my %conf = (
);
Getopt::Long::Configure('bundling');
my ( $opt_V, $opt_h, $opt_c, $opt_l, $opt_x, $opt_p );
my ( $opt_V, $opt_h, $opt_c, $opt_l, $opt_x, $opt_p, $opt_s, $opt_o, $opt_r );
# defaults
$opt_x = 1;
@ -59,15 +59,22 @@ GetOptions(
"c|check_command=s" => \$opt_c,
"p|cfg_dir=s" => \$opt_p,
"l|list_commands" => \$opt_l,
"s|stepwise" => \$opt_s,
"x|no_structure_check" => \$opt_x,
"o|log_old_xml" => \$opt_o,
"d|dry-run" => \$conf{DRY_RUN},
"t|tmp_dir=s" => \$conf{TMP_DIR},
"force" => \$conf{FORCE},
"r|read=s" => \$opt_r,
);
if (defined($opt_r)) {
$opt_c = "ALL";
}
print_help() if $opt_h;
print_help_opt_p() if !$opt_p;
print_help() if !$opt_c and !$opt_l;
print_help() if (!$opt_c and !$opt_l) and (!$opt_r);
print_version() if $opt_V;
if($opt_p){
@ -100,14 +107,22 @@ main();
sub main{
check_storage_type();
find(\&wanted_xml_files, $conf{RRDPATH});
if ($opt_o) {
create_dir($conf{TMP_DIR});
open(OLDXMLLOG, ">", $conf{TMP_DIR}."/pnp_old_xml_files.list");
print OLDXMLLOG "- generated by rrd_convert.pl - \n";
print OLDXMLLOG "The following XML files are older than $conf{XML_MAX_AGE} seconds:\n\n";
}
build_worklist();
close(OLDXMLLOG);
summary();
if($opt_l){ # List commands and exit
summary_command_list();
exit;
}
if($#worklist+1 > 0 ){
my $answer = read_choice("Start Converter [n|y]?");
my $question = "Start converter? " . ($opt_s ? "(Each conversion will be prompted.) " : "");
my $answer = read_choice($question . "[n|y]");
unless ( $answer =~ m/^y$/i ){
print "Exit...\n";
exit;
@ -123,7 +138,16 @@ sub main{
write_custom_template();
my $t0 = [gettimeofday];
my $i = 0;
my $answered = "";
foreach my $xmlfile ( @worklist ) {
if($opt_s && ($answered !~ $xmlfile)){
my $answer = read_choice("Continue with $xmlfile [n|y]?");
unless ( $answer =~ m/^y$/i ){
print "Exit... (remember to remove the custom template, if created in this run!)\n";
exit;
}
$answered = $xmlfile;
}
$i++;
undef %ds_list;
undef %original_ds_list;
@ -183,43 +207,72 @@ sub check_ds_list{
}
}
sub wanted_xml_files{
sub build_worklist {
if ($opt_r) {
process_xml_files($opt_r);
close XMLLIST;
}else{
find(\&find_xml_files, $conf{RRDPATH});
}
}
# bulk mode, find all XML files
sub find_xml_files{
if(m/.xml$/){
#printf("File: %s\n",$File::Find::name);
my $xmlfile = $File::Find::name;
my ($rrdfile) = $xmlfile =~ /^(.*)\.xml$/;
$rrdfile .= ".rrd";
my $mtime = (stat($xmlfile))[9];
if ( $mtime < $max_age ){
$stats{old_xml}++;
return;
}
open(XML, $xmlfile);
while (<XML>) {
if(/TEMPLATE>(.*)</){
my ($t) = split("!",$1);
push(@commands,$t);
if(( defined $opt_c) and ($t =~ /^$opt_c$/)){
if( -e $rrdfile ){
#print "Found: ".$t." in ".$xmlfile."\n";
push(@worklist,$xmlfile);
}else{
$stats{xml_without_rrd}++;
}
}elsif(( defined $opt_c) and ($opt_c eq 'ALL')){
if( -e $rrdfile ){
# Keyword 'ALL' retunrs all XML Files
push(@worklist,$xmlfile);
}else{
$stats{xml_without_rrd}++;
}
}
}
}
close(XML);
xml2worklist($File::Find::name);
}
}
# file mode, process file with XML filenames
sub process_xml_files{
my $xmllist = shift;
-r $xmllist or die "Cannot open $xmllist: $!";
open XMLLIST, "<$opt_r";
foreach (<XMLLIST>) {
my $file = $_;
chomp($file);
m/.xml$/ && xml2worklist($file);
}
}
sub xml2worklist {
my $xmlfile = shift;
my ($rrdfile) = $xmlfile =~ /^(.*)\.xml$/;
$rrdfile .= ".rrd";
my $mtime = (stat($xmlfile))[9];
if ( $mtime < $max_age ){
$stats{old_xml}++;
if ($opt_o) {
print OLDXMLLOG $xmlfile . ": " . scalar localtime($mtime) ."\n";
}
return;
}
open(XML, $xmlfile);
while (<XML>) {
if(/TEMPLATE>(.*)</){
my ($t) = split("!",$1);
push(@commands,$t);
if(( defined $opt_c) and ($t =~ /^$opt_c$/)){
if( -e $rrdfile ){
#print "Found: ".$t." in ".$xmlfile."\n";
push(@worklist,$xmlfile);
}else{
$stats{xml_without_rrd}++;
}
}elsif (( defined $opt_c) and ($opt_c eq 'ALL') ) {
if( -e $rrdfile ){
# Keyword 'ALL' retunrs all XML Files
push(@worklist,$xmlfile);
}else{
$stats{xml_without_rrd}++;
}
}
}
}
close(XML);
}
sub parse_xml_filename{
my $xmlfile = shift;
$_ = $xmlfile;
@ -327,7 +380,7 @@ sub restore_files(){
sub backup_rrd_file{
my $rrdfile = shift;
if ( $conf{RRD_BACKUP} == 1 ){
if ( $conf{RRD_BACKUP} == 1 && $conf{'DRY_RUN'} == 0 ){
move($rrdfile, $rrdfile.".backup");
}
}
@ -479,7 +532,7 @@ sub change_config {
sub check_storage_type{
if($conf{'RRD_STORAGE_TYPE'} eq "MULTIPLE"){
print "RRD_STORAGE_TYPE is already set to ".$conf{'RRD_STORAGE_TYPE'}."\n";
print "RRD_STORAGE_TYPE is already globally set to ".$conf{'RRD_STORAGE_TYPE'}."\n";
}
}
sub check_custom_template {
@ -500,6 +553,8 @@ sub check_custom_template {
}
sub write_custom_template {
# do not write custom template in --read mode
return if $opt_r;
my $command = $opt_c;
if ( $conf{DRY_RUN} == 1 ){
print "No config check while DRY_RUN = 1\n";
@ -535,8 +590,11 @@ sub print_help{
print " [ --dry-run ]\n";
print " [ --tmp_dir=<temp directory> ]\n";
print " [ --no_structure_check ]\n";
print " [ --log_old_xml ]\n";
print " [ --stepwise ]\n";
print " [ --read=<file with XML filenames> ]\n";
print "\n";
print "This script is used to switch to RRD_STORAGE_TYPE = MULTIPLE for a given Nagios Check Command\n";
print "This script is used to switch to RRD_STORAGE_TYPE = MULTIPLE for all RRDs/a given Nagios Check Command/single RRDs \n";
print "More info online http://docs.pnp4nagios.org/pnp-0.6/rrd_convert\n";
exit;
}

@ -82,7 +82,7 @@ $no = 1 unless (defined $no);
my $ds = `$rrdtool info $rrd | grep '^ds' | grep 'value' | wc -l`;
# determine the decimal sign
$sign = `$rrdtool info $rrd | grep '^ds' | grep 'value' | tail -1`;
($sign) = $sign =~ /.* \d(.)\d+/;
($sign) = $sign =~ /.* -?\d(.)\d+/;
my $end = ($action eq "insert" ? $ds+$no : $ds);
if (($start < 1) or ($start > $ds + 1)) {
print "ERROR: number ($start) must be within 1..".($ds+1)."\n";
@ -188,7 +188,7 @@ sub processing {
next;
}
# value enclosed in XML tags
if (/<(\S+)>\s+(\S+)\s+</) {
if (/<(\S+)>\s*(\S+)\s*</) {
$xml{$1} = $2;
}
next unless ($out);

@ -28,6 +28,12 @@ class Image_Controller extends System_Controller {
if($this->input->get('graph_height') != "" )
$this->rrdtool->config->conf['graph_height'] = intval($this->input->get('graph_height'));
if($this->input->get('graph_only') !== null)
$this->rrdtool->config->conf['graph_only'] = 1;
if($this->input->get('no_legend') !== null)
$this->rrdtool->config->conf['no_legend'] = 1;
$this->data->getTimeRange($this->start,$this->end,$this->view);
if($this->tpl != ""){

@ -121,6 +121,7 @@ class pnp_Core {
preg_match('/^(-?[0-9\.,]+)\s*(\S?)(\S?)/',$value,$matches);
$mag = 0;
$value = $matches[1];
while ($value >= $base){
$value /= $base;
$mag++;

@ -444,6 +444,35 @@ class rrd_Core {
return $line;
}
# http://stackoverflow.com/questions/3512311/how-to-generate-lighter-darker-color-with-php
public static function colbright($hex, $steps) {
if($hex === FALSE){
throw new Kohana_exception("rrd::". __FUNCTION__ . "() First Parameter 'hex' is missing");
}
if($steps === FALSE){
throw new Kohana_exception("rrd::". __FUNCTION__ . "() Second Parameter 'steps' is missing");
}
// Steps should be between -255 and 255. Negative = darker, positive = lighter
$steps = max(-255, min(255, $steps));
// Normalize into a six character long hex string
$hex = str_replace('#', '', $hex);
if (strlen($hex) == 3) {
$hex = str_repeat(substr($hex,0,1), 2).str_repeat(substr($hex,1,1), 2).str_repeat(substr($hex,2,1), 2);
}
// Split into three parts: R, G and B
$color_parts = str_split($hex, 2);
$return = '#';
foreach ($color_parts as $color) {
$color = hexdec($color); // Convert to decimal
$color = max(0,min(255,$color + $steps)); // Adjust color
$return .= str_pad(dechex($color), 2, '0', STR_PAD_LEFT); // Make two char hex code
}
return $return;
}
public static function debug($data=FALSE){
if($data != FALSE){
ob_start();

@ -1019,13 +1019,23 @@ class Data_Model extends System_Model
foreach($xml->meta->legend->entry as $key=>$value){
$csv .= ";" . $value ;
}
/*
* from rrdtool 1.5 on, timestamp ( value->t ) is not set anymore
* from 1.6 on it can be reactivated by -- showrime option to rrdtool xport
* here we take care of the timestamp ourselves regardless which
* rrdtool version is used
*/
$timestamp2 = $xml->meta->start;
$step = $xml->meta->step;
$csv .= "\n";
foreach($xml->data->row as $key=>$value){
$csv .= (string) $value->t ;
$csv .= $timestamp2;
foreach($value->v as $item){
$csv .= ";".floatval((string) $item);
}
$csv .= "\n";
$timestamp2 = $timestamp2 + $step;
}
return $csv;
}

@ -106,8 +106,11 @@ class Rrdtool_Model extends System_Model
if ($height > 0){
$command .= " --height=$height";
}
if ($height < 81 ){
$command .= " --only-graph ";
if ($height < 81 || (isset($conf['graph_only']) && $conf['graph_only'])){
$command .= " --only-graph";
}
elseif (isset($conf['no_legend']) && $conf['no_legend']){
$command .= " --no-legend";
}
$command .= $RRD_CMD;

21
share/pnp/application/vendor/fpdf/LICENSE vendored Executable file

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

@ -0,0 +1,30 @@
{
"name": "setasign/fpdi",
"version": "1.6.1",
"homepage": "https://www.setasign.com/fpdi",
"description": "FPDI is a collection of PHP classes facilitating developers to read pages from existing PDF documents and use them as templates in FPDF. Because it is also possible to use FPDI with TCPDF, there are no fixed dependencies defined. Please see suggestions for packages which evaluates the dependencies automatically.",
"type": "library",
"keywords": ["pdf", "fpdi", "fpdf"],
"license": "MIT",
"authors": [
{
"name": "Jan Slabon",
"email": "jan.slabon@setasign.com",
"homepage": "https://www.setasign.com"
}
],
"autoload": {
"classmap": [
"filters/",
"fpdi.php",
"fpdf_tpl.php",
"fpdi_pdf_parser.php",
"pdf_context.php"
]
},
"suggest": {
"setasign/fpdf": "FPDI will extend this class but as it is also possible to use \"tecnickcom/tcpdf\" as an alternative there's no fixed dependency configured.",
"setasign/fpdi-fpdf": "Use this package to automatically evaluate dependencies to FPDF.",
"setasign/fpdi-tcpdf": "Use this package to automatically evaluate dependencies to TCPDF."
}
}

@ -0,0 +1,63 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>__construct</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>__construct</h1>
<code>__construct([<b>string</b> orientation [, <b>string</b> unit [, <b>mixed</b> size]]])</code>
<h2>Description</h2>
This is the class constructor. It allows to set up the page size, the orientation and the
unit of measure used in all methods (except for font sizes).
<h2>Parameters</h2>
<dl class="param">
<dt><code>orientation</code></dt>
<dd>
Default page orientation. Possible values are (case insensitive):
<ul>
<li><code>P</code> or <code>Portrait</code></li>
<li><code>L</code> or <code>Landscape</code></li>
</ul>
Default value is <code>P</code>.
</dd>
<dt><code>unit</code></dt>
<dd>
User unit. Possible values are:
<ul>
<li><code>pt</code>: point</li>
<li><code>mm</code>: millimeter</li>
<li><code>cm</code>: centimeter</li>
<li><code>in</code>: inch</li>
</ul>
A point equals 1/72 of inch, that is to say about 0.35 mm (an inch being 2.54 cm). This
is a very common unit in typography; font sizes are expressed in that unit.
<br>
<br>
Default value is <code>mm</code>.
</dd>
<dt><code>size</code></dt>
<dd>
The size used for pages. It can be either one of the following values (case insensitive):
<ul>
<li><code>A3</code></li>
<li><code>A4</code></li>
<li><code>A5</code></li>
<li><code>Letter</code></li>
<li><code>Legal</code></li>
</ul>
or an array containing the width and the height (expressed in the unit given by <code>unit</code>).<br>
<br>
Default value is <code>A4</code>.
</dd>
</dl>
<h2>Example</h2>
Example with a custom 100x150 mm page size:
<div class="doc-source">
<pre><code>$pdf = new FPDF('P','mm',array(100,150));</code></pre>
</div>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

@ -0,0 +1,63 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>AcceptPageBreak</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>AcceptPageBreak</h1>
<code><b>boolean</b> AcceptPageBreak()</code>
<h2>Description</h2>
Whenever a page break condition is met, the method is called, and the break is issued or not
depending on the returned value. The default implementation returns a value according to the
mode selected by SetAutoPageBreak().
<br>
This method is called automatically and should not be called directly by the application.
<h2>Example</h2>
The method is overriden in an inherited class in order to obtain a 3 column layout:
<div class="doc-source">
<pre><code>class PDF extends FPDF
{
var $col = 0;
function SetCol($col)
{
// Move position to a column
$this-&gt;col = $col;
$x = 10+$col*65;
$this-&gt;SetLeftMargin($x);
$this-&gt;SetX($x);
}
function AcceptPageBreak()
{
if($this-&gt;col&lt;2)
{
// Go to next column
$this-&gt;SetCol($this-&gt;col+1);
$this-&gt;SetY(10);
return false;
}
else
{
// Go back to first column and issue page break
$this-&gt;SetCol(0);
return true;
}
}
}
$pdf = new PDF();
$pdf-&gt;AddPage();
$pdf-&gt;SetFont('Arial','',12);
for($i=1;$i&lt;=300;$i++)
$pdf-&gt;Cell(0,5,"Line $i",0,1);
$pdf-&gt;Output();</code></pre>
</div>
<h2>See also</h2>
<a href="setautopagebreak.htm">SetAutoPageBreak</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

@ -0,0 +1,55 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>AddFont</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>AddFont</h1>
<code>AddFont(<b>string</b> family [, <b>string</b> style [, <b>string</b> file]])</code>
<h2>Description</h2>
Imports a TrueType, OpenType or Type1 font and makes it available. It is necessary to generate a font
definition file first with the MakeFont utility.
<br>
The definition file (and the font file itself when embedding) must be present in the font directory.
If it is not found, the error "Could not include font definition file" is raised.
<h2>Parameters</h2>
<dl class="param">
<dt><code>family</code></dt>
<dd>
Font family. The name can be chosen arbitrarily. If it is a standard family name, it will
override the corresponding font.
</dd>
<dt><code>style</code></dt>
<dd>
Font style. Possible values are (case insensitive):
<ul>
<li>empty string: regular</li>
<li><code>B</code>: bold</li>
<li><code>I</code>: italic</li>
<li><code>BI</code> or <code>IB</code>: bold italic</li>
</ul>
The default value is regular.
</dd>
<dt><code>file</code></dt>
<dd>
The font definition file.
<br>
By default, the name is built from the family and style, in lower case with no space.
</dd>
</dl>
<h2>Example</h2>
<div class="doc-source">
<pre><code>$pdf-&gt;AddFont('Comic','I');</code></pre>
</div>
is equivalent to:
<div class="doc-source">
<pre><code>$pdf-&gt;AddFont('Comic','I','comici.php');</code></pre>
</div>
<h2>See also</h2>
<a href="setfont.htm">SetFont</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

@ -0,0 +1,26 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>AddLink</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>AddLink</h1>
<code><b>int</b> AddLink()</code>
<h2>Description</h2>
Creates a new internal link and returns its identifier. An internal link is a clickable area
which directs to another place within the document.
<br>
The identifier can then be passed to Cell(), Write(), Image() or Link(). The destination is
defined with SetLink().
<h2>See also</h2>
<a href="cell.htm">Cell</a>,
<a href="write.htm">Write</a>,
<a href="image.htm">Image</a>,
<a href="link.htm">Link</a>,
<a href="setlink.htm">SetLink</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

@ -0,0 +1,61 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>AddPage</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>AddPage</h1>
<code>AddPage([<b>string</b> orientation [, <b>mixed</b> size [, <b>int</b> rotation]]])</code>
<h2>Description</h2>
Adds a new page to the document. If a page is already present, the Footer() method is called
first to output the footer. Then the page is added, the current position set to the top-left
corner according to the left and top margins, and Header() is called to display the header.
<br>
The font which was set before calling is automatically restored. There is no need to call
SetFont() again if you want to continue with the same font. The same is true for colors and
line width.
<br>
The origin of the coordinate system is at the top-left corner and increasing ordinates go
downwards.
<h2>Parameters</h2>
<dl class="param">
<dt><code>orientation</code></dt>
<dd>
Page orientation. Possible values are (case insensitive):
<ul>
<li><code>P</code> or <code>Portrait</code></li>
<li><code>L</code> or <code>Landscape</code></li>
</ul>
The default value is the one passed to the constructor.
</dd>
<dt><code>size</code></dt>
<dd>
Page size. It can be either one of the following values (case insensitive):
<ul>
<li><code>A3</code></li>
<li><code>A4</code></li>
<li><code>A5</code></li>
<li><code>Letter</code></li>
<li><code>Legal</code></li>
</ul>
or an array containing the width and the height (expressed in user unit).<br>
<br>
The default value is the one passed to the constructor.
</dd>
<dt><code>rotation</code></dt>
<dd>
Angle by which to rotate the page. It must be a multiple of 90; positive values
mean clockwise rotation. The default value is <code>0</code>.
</dd>
</dl>
<h2>See also</h2>
<a href="__construct.htm">__construct</a>,
<a href="header.htm">Header</a>,
<a href="footer.htm">Footer</a>,
<a href="setmargins.htm">SetMargins</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

@ -0,0 +1,45 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>AliasNbPages</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>AliasNbPages</h1>
<code>AliasNbPages([<b>string</b> alias])</code>
<h2>Description</h2>
Defines an alias for the total number of pages. It will be substituted as the document is
closed.
<h2>Parameters</h2>
<dl class="param">
<dt><code>alias</code></dt>
<dd>
The alias. Default value: <code>{nb}</code>.
</dd>
</dl>
<h2>Example</h2>
<div class="doc-source">
<pre><code>class PDF extends FPDF
{
function Footer()
{
// Go to 1.5 cm from bottom
$this-&gt;SetY(-15);
// Select Arial italic 8
$this-&gt;SetFont('Arial','I',8);
// Print current and total page numbers
$this-&gt;Cell(0,10,'Page '.$this-&gt;PageNo().'/{nb}',0,0,'C');
}
}
$pdf = new PDF();
$pdf-&gt;AliasNbPages();</code></pre>
</div>
<h2>See also</h2>
<a href="pageno.htm">PageNo</a>,
<a href="footer.htm">Footer</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

104
share/pnp/application/vendor/fpdf/doc/cell.htm vendored Executable file

@ -0,0 +1,104 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Cell</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>Cell</h1>
<code>Cell(<b>float</b> w [, <b>float</b> h [, <b>string</b> txt [, <b>mixed</b> border [, <b>int</b> ln [, <b>string</b> align [, <b>boolean</b> fill [, <b>mixed</b> link]]]]]]])</code>
<h2>Description</h2>
Prints a cell (rectangular area) with optional borders, background color and character string.
The upper-left corner of the cell corresponds to the current position. The text can be aligned
or centered. After the call, the current position moves to the right or to the next line. It is
possible to put a link on the text.
<br>
If automatic page breaking is enabled and the cell goes beyond the limit, a page break is
done before outputting.
<h2>Parameters</h2>
<dl class="param">
<dt><code>w</code></dt>
<dd>
Cell width. If <code>0</code>, the cell extends up to the right margin.
</dd>
<dt><code>h</code></dt>
<dd>
Cell height.
Default value: <code>0</code>.
</dd>
<dt><code>txt</code></dt>
<dd>
String to print.
Default value: empty string.
</dd>
<dt><code>border</code></dt>
<dd>
Indicates if borders must be drawn around the cell. The value can be either a number:
<ul>
<li><code>0</code>: no border</li>
<li><code>1</code>: frame</li>
</ul>
or a string containing some or all of the following characters (in any order):
<ul>
<li><code>L</code>: left</li>
<li><code>T</code>: top</li>
<li><code>R</code>: right</li>
<li><code>B</code>: bottom</li>
</ul>
Default value: <code>0</code>.
</dd>
<dt><code>ln</code></dt>
<dd>
Indicates where the current position should go after the call. Possible values are:
<ul>
<li><code>0</code>: to the right</li>
<li><code>1</code>: to the beginning of the next line</li>
<li><code>2</code>: below</li>
</ul>
Putting <code>1</code> is equivalent to putting <code>0</code> and calling Ln() just after.
Default value: <code>0</code>.
</dd>
<dt><code>align</code></dt>
<dd>
Allows to center or align the text. Possible values are:
<ul>
<li><code>L</code> or empty string: left align (default value)</li>
<li><code>C</code>: center</li>
<li><code>R</code>: right align</li>
</ul>
</dd>
<dt><code>fill</code></dt>
<dd>
Indicates if the cell background must be painted (<code>true</code>) or transparent (<code>false</code>).
Default value: <code>false</code>.
</dd>
<dt><code>link</code></dt>
<dd>
URL or identifier returned by AddLink().
</dd>
</dl>
<h2>Example</h2>
<div class="doc-source">
<pre><code>// Set font
$pdf-&gt;SetFont('Arial','B',16);
// Move to 8 cm to the right
$pdf-&gt;Cell(80);
// Centered text in a framed 20*10 mm cell and line break
$pdf-&gt;Cell(20,10,'Title',1,1,'C');</code></pre>
</div>
<h2>See also</h2>
<a href="setfont.htm">SetFont</a>,
<a href="setdrawcolor.htm">SetDrawColor</a>,
<a href="setfillcolor.htm">SetFillColor</a>,
<a href="settextcolor.htm">SetTextColor</a>,
<a href="setlinewidth.htm">SetLineWidth</a>,
<a href="addlink.htm">AddLink</a>,
<a href="ln.htm">Ln</a>,
<a href="multicell.htm">MultiCell</a>,
<a href="write.htm">Write</a>,
<a href="setautopagebreak.htm">SetAutoPageBreak</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

@ -0,0 +1,21 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Close</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>Close</h1>
<code>Close()</code>
<h2>Description</h2>
Terminates the PDF document. It is not necessary to call this method explicitly because Output()
does it automatically.
<br>
If the document contains no page, AddPage() is called to prevent from getting an invalid document.
<h2>See also</h2>
<a href="output.htm">Output</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

@ -0,0 +1,26 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Error</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>Error</h1>
<code>Error(<b>string</b> msg)</code>
<h2>Description</h2>
This method is automatically called in case of a fatal error; it simply throws an exception
with the provided message.<br>
An inherited class may override it to customize the error handling but the method should
never return, otherwise the resulting document would probably be invalid.
<h2>Parameters</h2>
<dl class="param">
<dt><code>msg</code></dt>
<dd>
The error message.
</dd>
</dl>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

@ -0,0 +1,35 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Footer</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>Footer</h1>
<code>Footer()</code>
<h2>Description</h2>
This method is used to render the page footer. It is automatically called by AddPage() and
Close() and should not be called directly by the application. The implementation in FPDF is
empty, so you have to subclass it and override the method if you want a specific processing.
<h2>Example</h2>
<div class="doc-source">
<pre><code>class PDF extends FPDF
{
function Footer()
{
// Go to 1.5 cm from bottom
$this-&gt;SetY(-15);
// Select Arial italic 8
$this-&gt;SetFont('Arial','I',8);
// Print centered page number
$this-&gt;Cell(0,10,'Page '.$this-&gt;PageNo(),0,0,'C');
}
}</code></pre>
</div>
<h2>See also</h2>
<a href="header.htm">Header</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

@ -0,0 +1,18 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>GetPageHeight</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>GetPageHeight</h1>
<code><b>float</b> GetPageHeight()</code>
<h2>Description</h2>
Returns the current page height.
<h2>See also</h2>
<a href="getpagewidth.htm">GetPageWidth</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

@ -0,0 +1,18 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>GetPageWidth</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>GetPageWidth</h1>
<code><b>float</b> GetPageWidth()</code>
<h2>Description</h2>
Returns the current page width.
<h2>See also</h2>
<a href="getpageheight.htm">GetPageHeight</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

@ -0,0 +1,23 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>GetStringWidth</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>GetStringWidth</h1>
<code><b>float</b> GetStringWidth(<b>string</b> s)</code>
<h2>Description</h2>
Returns the length of a string in user unit. A font must be selected.
<h2>Parameters</h2>
<dl class="param">
<dt><code>s</code></dt>
<dd>
The string whose length is to be computed.
</dd>
</dl>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

@ -0,0 +1,20 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>GetX</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>GetX</h1>
<code><b>float</b> GetX()</code>
<h2>Description</h2>
Returns the abscissa of the current position.
<h2>See also</h2>
<a href="setx.htm">SetX</a>,
<a href="gety.htm">GetY</a>,
<a href="sety.htm">SetY</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

@ -0,0 +1,20 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>GetY</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>GetY</h1>
<code><b>float</b> GetY()</code>
<h2>Description</h2>
Returns the ordinate of the current position.
<h2>See also</h2>
<a href="sety.htm">SetY</a>,
<a href="getx.htm">GetX</a>,
<a href="setx.htm">SetX</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

@ -0,0 +1,37 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Header</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>Header</h1>
<code>Header()</code>
<h2>Description</h2>
This method is used to render the page header. It is automatically called by AddPage() and
should not be called directly by the application. The implementation in FPDF is empty, so
you have to subclass it and override the method if you want a specific processing.
<h2>Example</h2>
<div class="doc-source">
<pre><code>class PDF extends FPDF
{
function Header()
{
// Select Arial bold 15
$this-&gt;SetFont('Arial','B',15);
// Move to the right
$this-&gt;Cell(80);
// Framed title
$this-&gt;Cell(30,10,'Title',1,0,'C');
// Line break
$this-&gt;Ln(20);
}
}</code></pre>
</div>
<h2>See also</h2>
<a href="footer.htm">Footer</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

@ -0,0 +1,99 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Image</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>Image</h1>
<code>Image(<b>string</b> file [, <b>float</b> x [, <b>float</b> y [, <b>float</b> w [, <b>float</b> h [, <b>string</b> type [, <b>mixed</b> link]]]]]])</code>
<h2>Description</h2>
Puts an image. The size it will take on the page can be specified in different ways:
<ul>
<li>explicit width and height (expressed in user unit or dpi)</li>
<li>one explicit dimension, the other being calculated automatically in order to keep the original proportions</li>
<li>no explicit dimension, in which case the image is put at 96 dpi</li>
</ul>
Supported formats are JPEG, PNG and GIF. The GD extension is required for GIF.
<br>
<br>
For JPEGs, all flavors are allowed:
<ul>
<li>gray scales</li>
<li>true colors (24 bits)</li>
<li>CMYK (32 bits)</li>
</ul>
For PNGs, are allowed:
<ul>
<li>gray scales on at most 8 bits (256 levels)</li>
<li>indexed colors</li>
<li>true colors (24 bits)</li>
</ul>
For GIFs: in case of an animated GIF, only the first frame is displayed.<br>
<br>
Transparency is supported.<br>
<br>
The format can be specified explicitly or inferred from the file extension.<br>
<br>
It is possible to put a link on the image.<br>
<br>
Remark: if an image is used several times, only one copy is embedded in the file.
<h2>Parameters</h2>
<dl class="param">
<dt><code>file</code></dt>
<dd>
Path or URL of the image.
</dd>
<dt><code>x</code></dt>
<dd>
Abscissa of the upper-left corner. If not specified or equal to <code>null</code>, the current abscissa
is used.
</dd>
<dt><code>y</code></dt>
<dd>
Ordinate of the upper-left corner. If not specified or equal to <code>null</code>, the current ordinate
is used; moreover, a page break is triggered first if necessary (in case automatic page breaking is enabled)
and, after the call, the current ordinate is moved to the bottom of the image.
</dd>
<dt><code>w</code></dt>
<dd>
Width of the image in the page. There are three cases:
<ul>
<li>If the value is positive, it represents the width in user unit</li>
<li>If the value is negative, the absolute value represents the horizontal resolution in dpi</li>
<li>If the value is not specified or equal to zero, it is automatically calculated</li>
</ul>
</dd>
<dt><code>h</code></dt>
<dd>
Height of the image in the page. There are three cases:
<ul>
<li>If the value is positive, it represents the height in user unit</li>
<li>If the value is negative, the absolute value represents the vertical resolution in dpi</li>
<li>If the value is not specified or equal to zero, it is automatically calculated</li>
</ul>
</dd>
<dt><code>type</code></dt>
<dd>
Image format. Possible values are (case insensitive): <code>JPG</code>, <code>JPEG</code>, <code>PNG</code> and <code>GIF</code>.
If not specified, the type is inferred from the file extension.
</dd>
<dt><code>link</code></dt>
<dd>
URL or identifier returned by AddLink().
</dd>
</dl>
<h2>Example</h2>
<div class="doc-source">
<pre><code>// Insert a logo in the top-left corner at 300 dpi
$pdf-&gt;Image('logo.png',10,10,-300);
// Insert a dynamic image from a URL
$pdf-&gt;Image('http://chart.googleapis.com/chart?cht=p3&amp;chd=t:60,40&amp;chs=250x100&amp;chl=Hello|World',60,30,90,0,'PNG');</code></pre>
</div>
<h2>See also</h2>
<a href="addlink.htm">AddLink</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

@ -0,0 +1,59 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>FPDF 1.81 Reference Manual</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>FPDF 1.81 Reference Manual</h1>
<a href="__construct.htm">__construct</a> - constructor<br>
<a href="acceptpagebreak.htm">AcceptPageBreak</a> - accept or not automatic page break<br>
<a href="addfont.htm">AddFont</a> - add a new font<br>
<a href="addlink.htm">AddLink</a> - create an internal link<br>
<a href="addpage.htm">AddPage</a> - add a new page<br>
<a href="aliasnbpages.htm">AliasNbPages</a> - define an alias for number of pages<br>
<a href="cell.htm">Cell</a> - print a cell<br>
<a href="close.htm">Close</a> - terminate the document<br>
<a href="error.htm">Error</a> - fatal error<br>
<a href="footer.htm">Footer</a> - page footer<br>
<a href="getpageheight.htm">GetPageHeight</a> - get current page height<br>
<a href="getpagewidth.htm">GetPageWidth</a> - get current page width<br>
<a href="getstringwidth.htm">GetStringWidth</a> - compute string length<br>
<a href="getx.htm">GetX</a> - get current x position<br>
<a href="gety.htm">GetY</a> - get current y position<br>
<a href="header.htm">Header</a> - page header<br>
<a href="image.htm">Image</a> - output an image<br>
<a href="line.htm">Line</a> - draw a line<br>
<a href="link.htm">Link</a> - put a link<br>
<a href="ln.htm">Ln</a> - line break<br>
<a href="multicell.htm">MultiCell</a> - print text with line breaks<br>
<a href="output.htm">Output</a> - save or send the document<br>
<a href="pageno.htm">PageNo</a> - page number<br>
<a href="rect.htm">Rect</a> - draw a rectangle<br>
<a href="setauthor.htm">SetAuthor</a> - set the document author<br>
<a href="setautopagebreak.htm">SetAutoPageBreak</a> - set the automatic page breaking mode<br>
<a href="setcompression.htm">SetCompression</a> - turn compression on or off<br>
<a href="setcreator.htm">SetCreator</a> - set document creator<br>
<a href="setdisplaymode.htm">SetDisplayMode</a> - set display mode<br>
<a href="setdrawcolor.htm">SetDrawColor</a> - set drawing color<br>
<a href="setfillcolor.htm">SetFillColor</a> - set filling color<br>
<a href="setfont.htm">SetFont</a> - set font<br>
<a href="setfontsize.htm">SetFontSize</a> - set font size<br>
<a href="setkeywords.htm">SetKeywords</a> - associate keywords with document<br>
<a href="setleftmargin.htm">SetLeftMargin</a> - set left margin<br>
<a href="setlinewidth.htm">SetLineWidth</a> - set line width<br>
<a href="setlink.htm">SetLink</a> - set internal link destination<br>
<a href="setmargins.htm">SetMargins</a> - set margins<br>
<a href="setrightmargin.htm">SetRightMargin</a> - set right margin<br>
<a href="setsubject.htm">SetSubject</a> - set document subject<br>
<a href="settextcolor.htm">SetTextColor</a> - set text color<br>
<a href="settitle.htm">SetTitle</a> - set document title<br>
<a href="settopmargin.htm">SetTopMargin</a> - set top margin<br>
<a href="setx.htm">SetX</a> - set current x position<br>
<a href="setxy.htm">SetXY</a> - set current x and y positions<br>
<a href="sety.htm">SetY</a> - set current y position and optionally reset x<br>
<a href="text.htm">Text</a> - print a string<br>
<a href="write.htm">Write</a> - print flowing text<br>
</body>
</html>

@ -0,0 +1,38 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Line</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>Line</h1>
<code>Line(<b>float</b> x1, <b>float</b> y1, <b>float</b> x2, <b>float</b> y2)</code>
<h2>Description</h2>
Draws a line between two points.
<h2>Parameters</h2>
<dl class="param">
<dt><code>x1</code></dt>
<dd>
Abscissa of first point.
</dd>
<dt><code>y1</code></dt>
<dd>
Ordinate of first point.
</dd>
<dt><code>x2</code></dt>
<dd>
Abscissa of second point.
</dd>
<dt><code>y2</code></dt>
<dd>
Ordinate of second point.
</dd>
</dl>
<h2>See also</h2>
<a href="setlinewidth.htm">SetLineWidth</a>,
<a href="setdrawcolor.htm">SetDrawColor</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

@ -0,0 +1,46 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Link</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>Link</h1>
<code>Link(<b>float</b> x, <b>float</b> y, <b>float</b> w, <b>float</b> h, <b>mixed</b> link)</code>
<h2>Description</h2>
Puts a link on a rectangular area of the page. Text or image links are generally put via Cell(),
Write() or Image(), but this method can be useful for instance to define a clickable area inside
an image.
<h2>Parameters</h2>
<dl class="param">
<dt><code>x</code></dt>
<dd>
Abscissa of the upper-left corner of the rectangle.
</dd>
<dt><code>y</code></dt>
<dd>
Ordinate of the upper-left corner of the rectangle.
</dd>
<dt><code>w</code></dt>
<dd>
Width of the rectangle.
</dd>
<dt><code>h</code></dt>
<dd>
Height of the rectangle.
</dd>
<dt><code>link</code></dt>
<dd>
URL or identifier returned by AddLink().
</dd>
</dl>
<h2>See also</h2>
<a href="addlink.htm">AddLink</a>,
<a href="cell.htm">Cell</a>,
<a href="write.htm">Write</a>,
<a href="image.htm">Image</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

28
share/pnp/application/vendor/fpdf/doc/ln.htm vendored Executable file

@ -0,0 +1,28 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Ln</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>Ln</h1>
<code>Ln([<b>float</b> h])</code>
<h2>Description</h2>
Performs a line break. The current abscissa goes back to the left margin and the ordinate
increases by the amount passed in parameter.
<h2>Parameters</h2>
<dl class="param">
<dt><code>h</code></dt>
<dd>
The height of the break.
<br>
By default, the value equals the height of the last printed cell.
</dd>
</dl>
<h2>See also</h2>
<a href="cell.htm">Cell</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

@ -0,0 +1,76 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>MultiCell</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>MultiCell</h1>
<code>MultiCell(<b>float</b> w, <b>float</b> h, <b>string</b> txt [, <b>mixed</b> border [, <b>string</b> align [, <b>boolean</b> fill]]])</code>
<h2>Description</h2>
This method allows printing text with line breaks. They can be automatic (as soon as the
text reaches the right border of the cell) or explicit (via the \n character). As many cells
as necessary are output, one below the other.
<br>
Text can be aligned, centered or justified. The cell block can be framed and the background
painted.
<h2>Parameters</h2>
<dl class="param">
<dt><code>w</code></dt>
<dd>
Width of cells. If <code>0</code>, they extend up to the right margin of the page.
</dd>
<dt><code>h</code></dt>
<dd>
Height of cells.
</dd>
<dt><code>txt</code></dt>
<dd>
String to print.
</dd>
<dt><code>border</code></dt>
<dd>
Indicates if borders must be drawn around the cell block. The value can be either a number:
<ul>
<li><code>0</code>: no border</li>
<li><code>1</code>: frame</li>
</ul>
or a string containing some or all of the following characters (in any order):
<ul>
<li><code>L</code>: left</li>
<li><code>T</code>: top</li>
<li><code>R</code>: right</li>
<li><code>B</code>: bottom</li>
</ul>
Default value: <code>0</code>.
</dd>
<dt><code>align</code></dt>
<dd>
Sets the text alignment. Possible values are:
<ul>
<li><code>L</code>: left alignment</li>
<li><code>C</code>: center</li>
<li><code>R</code>: right alignment</li>
<li><code>J</code>: justification (default value)</li>
</ul>
</dd>
<dt><code>fill</code></dt>
<dd>
Indicates if the cell background must be painted (<code>true</code>) or transparent (<code>false</code>).
Default value: <code>false</code>.
</dd>
</dl>
<h2>See also</h2>
<a href="setfont.htm">SetFont</a>,
<a href="setdrawcolor.htm">SetDrawColor</a>,
<a href="setfillcolor.htm">SetFillColor</a>,
<a href="settextcolor.htm">SetTextColor</a>,
<a href="setlinewidth.htm">SetLineWidth</a>,
<a href="cell.htm">Cell</a>,
<a href="write.htm">Write</a>,
<a href="setautopagebreak.htm">SetAutoPageBreak</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

@ -0,0 +1,46 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Output</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>Output</h1>
<code><b>string</b> Output([<b>string</b> dest [, <b>string</b> name [, <b>boolean</b> isUTF8]]])</code>
<h2>Description</h2>
Send the document to a given destination: browser, file or string. In the case of a browser, the
PDF viewer may be used or a download may be forced.
<br>
The method first calls Close() if necessary to terminate the document.
<h2>Parameters</h2>
<dl class="param">
<dt><code>dest</code></dt>
<dd>
Destination where to send the document. It can be one of the following:
<ul>
<li><code>I</code>: send the file inline to the browser. The PDF viewer is used if available.</li>
<li><code>D</code>: send to the browser and force a file download with the name given by <code>name</code>.</li>
<li><code>F</code>: save to a local file with the name given by <code>name</code> (may include a path).</li>
<li><code>S</code>: return the document as a string.</li>
</ul>
The default value is <code>I</code>.
</dd>
<dt><code>name</code></dt>
<dd>
The name of the file. It is ignored in case of destination <code>S</code>.<br>
The default value is <code>doc.pdf</code>.
</dd>
<dt><code>isUTF8</code></dt>
<dd>
Indicates if <code>name</code> is encoded in ISO-8859-1 (<code>false</code>) or UTF-8 (<code>true</code>).
Only used for destinations <code>I</code> and <code>D</code>.<br>
The default value is <code>false</code>.
</dd>
</dl>
<h2>See also</h2>
<a href="close.htm">Close</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

@ -0,0 +1,18 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>PageNo</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>PageNo</h1>
<code><b>int</b> PageNo()</code>
<h2>Description</h2>
Returns the current page number.
<h2>See also</h2>
<a href="aliasnbpages.htm">AliasNbPages</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

@ -0,0 +1,48 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Rect</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>Rect</h1>
<code>Rect(<b>float</b> x, <b>float</b> y, <b>float</b> w, <b>float</b> h [, <b>string</b> style])</code>
<h2>Description</h2>
Outputs a rectangle. It can be drawn (border only), filled (with no border) or both.
<h2>Parameters</h2>
<dl class="param">
<dt><code>x</code></dt>
<dd>
Abscissa of upper-left corner.
</dd>
<dt><code>y</code></dt>
<dd>
Ordinate of upper-left corner.
</dd>
<dt><code>w</code></dt>
<dd>
Width.
</dd>
<dt><code>h</code></dt>
<dd>
Height.
</dd>
<dt><code>style</code></dt>
<dd>
Style of rendering. Possible values are:
<ul>
<li><code>D</code> or empty string: draw. This is the default value.</li>
<li><code>F</code>: fill</li>
<li><code>DF</code> or <code>FD</code>: draw and fill</li>
</ul>
</dd>
</dl>
<h2>See also</h2>
<a href="setlinewidth.htm">SetLineWidth</a>,
<a href="setdrawcolor.htm">SetDrawColor</a>,
<a href="setfillcolor.htm">SetFillColor</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

@ -0,0 +1,33 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>SetAuthor</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>SetAuthor</h1>
<code>SetAuthor(<b>string</b> author [, <b>boolean</b> isUTF8])</code>
<h2>Description</h2>
Defines the author of the document.
<h2>Parameters</h2>
<dl class="param">
<dt><code>author</code></dt>
<dd>
The name of the author.
</dd>
<dt><code>isUTF8</code></dt>
<dd>
Indicates if the string is encoded in ISO-8859-1 (<code>false</code>) or UTF-8 (<code>true</code>).<br>
Default value: <code>false</code>.
</dd>
</dl>
<h2>See also</h2>
<a href="setcreator.htm">SetCreator</a>,
<a href="setkeywords.htm">SetKeywords</a>,
<a href="setsubject.htm">SetSubject</a>,
<a href="settitle.htm">SetTitle</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

@ -0,0 +1,33 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>SetAutoPageBreak</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>SetAutoPageBreak</h1>
<code>SetAutoPageBreak(<b>boolean</b> auto [, <b>float</b> margin])</code>
<h2>Description</h2>
Enables or disables the automatic page breaking mode. When enabling, the second parameter is
the distance from the bottom of the page that defines the triggering limit. By default, the
mode is on and the margin is 2 cm.
<h2>Parameters</h2>
<dl class="param">
<dt><code>auto</code></dt>
<dd>
Boolean indicating if mode should be on or off.
</dd>
<dt><code>margin</code></dt>
<dd>
Distance from the bottom of the page.
</dd>
</dl>
<h2>See also</h2>
<a href="cell.htm">Cell</a>,
<a href="multicell.htm">MultiCell</a>,
<a href="acceptpagebreak.htm">AcceptPageBreak</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

@ -0,0 +1,31 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>SetCompression</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>SetCompression</h1>
<code>SetCompression(<b>boolean</b> compress)</code>
<h2>Description</h2>
Activates or deactivates page compression. When activated, the internal representation of
each page is compressed, which leads to a compression ratio of about 2 for the resulting
document.
<br>
Compression is on by default.
<br>
<br>
<strong>Note:</strong> the Zlib extension is required for this feature. If not present, compression
will be turned off.
<h2>Parameters</h2>
<dl class="param">
<dt><code>compress</code></dt>
<dd>
Boolean indicating if compression must be enabled.
</dd>
</dl>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

@ -0,0 +1,34 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>SetCreator</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>SetCreator</h1>
<code>SetCreator(<b>string</b> creator [, <b>boolean</b> isUTF8])</code>
<h2>Description</h2>
Defines the creator of the document. This is typically the name of the application that
generates the PDF.
<h2>Parameters</h2>
<dl class="param">
<dt><code>creator</code></dt>
<dd>
The name of the creator.
</dd>
<dt><code>isUTF8</code></dt>
<dd>
Indicates if the string is encoded in ISO-8859-1 (<code>false</code>) or UTF-8 (<code>true</code>).<br>
Default value: <code>false</code>.
</dd>
</dl>
<h2>See also</h2>
<a href="setauthor.htm">SetAuthor</a>,
<a href="setkeywords.htm">SetKeywords</a>,
<a href="setsubject.htm">SetSubject</a>,
<a href="settitle.htm">SetTitle</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

@ -0,0 +1,45 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>SetDisplayMode</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>SetDisplayMode</h1>
<code>SetDisplayMode(<b>mixed</b> zoom [, <b>string</b> layout])</code>
<h2>Description</h2>
Defines the way the document is to be displayed by the viewer. The zoom level can be set: pages can be
displayed entirely on screen, occupy the full width of the window, use real size, be scaled by a
specific zooming factor or use viewer default (configured in the Preferences menu of Adobe Reader).
The page layout can be specified too: single at once, continuous display, two columns or viewer
default.
<h2>Parameters</h2>
<dl class="param">
<dt><code>zoom</code></dt>
<dd>
The zoom to use. It can be one of the following string values:
<ul>
<li><code>fullpage</code>: displays the entire page on screen</li>
<li><code>fullwidth</code>: uses maximum width of window</li>
<li><code>real</code>: uses real size (equivalent to 100% zoom)</li>
<li><code>default</code>: uses viewer default mode</li>
</ul>
or a number indicating the zooming factor to use.
</dd>
<dt><code>layout</code></dt>
<dd>
The page layout. Possible values are:
<ul>
<li><code>single</code>: displays one page at once</li>
<li><code>continuous</code>: displays pages continuously</li>
<li><code>two</code>: displays two pages on two columns</li>
<li><code>default</code>: uses viewer default mode</li>
</ul>
Default value is <code>default</code>.
</dd>
</dl>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

@ -0,0 +1,41 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>SetDrawColor</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>SetDrawColor</h1>
<code>SetDrawColor(<b>int</b> r [, <b>int</b> g, <b>int</b> b])</code>
<h2>Description</h2>
Defines the color used for all drawing operations (lines, rectangles and cell borders). It
can be expressed in RGB components or gray scale. The method can be called before the first
page is created and the value is retained from page to page.
<h2>Parameters</h2>
<dl class="param">
<dt><code>r</code></dt>
<dd>
If <code>g</code> et <code>b</code> are given, red component; if not, indicates the gray level.
Value between 0 and 255.
</dd>
<dt><code>g</code></dt>
<dd>
Green component (between 0 and 255).
</dd>
<dt><code>b</code></dt>
<dd>
Blue component (between 0 and 255).
</dd>
</dl>
<h2>See also</h2>
<a href="setfillcolor.htm">SetFillColor</a>,
<a href="settextcolor.htm">SetTextColor</a>,
<a href="line.htm">Line</a>,
<a href="rect.htm">Rect</a>,
<a href="cell.htm">Cell</a>,
<a href="multicell.htm">MultiCell</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

@ -0,0 +1,40 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>SetFillColor</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>SetFillColor</h1>
<code>SetFillColor(<b>int</b> r [, <b>int</b> g, <b>int</b> b])</code>
<h2>Description</h2>
Defines the color used for all filling operations (filled rectangles and cell backgrounds).
It can be expressed in RGB components or gray scale. The method can be called before the first
page is created and the value is retained from page to page.
<h2>Parameters</h2>
<dl class="param">
<dt><code>r</code></dt>
<dd>
If <code>g</code> and <code>b</code> are given, red component; if not, indicates the gray level.
Value between 0 and 255.
</dd>
<dt><code>g</code></dt>
<dd>
Green component (between 0 and 255).
</dd>
<dt><code>b</code></dt>
<dd>
Blue component (between 0 and 255).
</dd>
</dl>
<h2>See also</h2>
<a href="setdrawcolor.htm">SetDrawColor</a>,
<a href="settextcolor.htm">SetTextColor</a>,
<a href="rect.htm">Rect</a>,
<a href="cell.htm">Cell</a>,
<a href="multicell.htm">MultiCell</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

@ -0,0 +1,92 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>SetFont</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>SetFont</h1>
<code>SetFont(<b>string</b> family [, <b>string</b> style [, <b>float</b> size]])</code>
<h2>Description</h2>
Sets the font used to print character strings. It is mandatory to call this method
at least once before printing text or the resulting document would not be valid.
<br>
The font can be either a standard one or a font added via the AddFont() method. Standard fonts
use the Windows encoding cp1252 (Western Europe).
<br>
The method can be called before the first page is created and the font is kept from page
to page.
<br>
If you just wish to change the current font size, it is simpler to call SetFontSize().
<br>
<br>
<strong>Note:</strong> the font definition files must be accessible. They are searched successively in:
<ul>
<li>The directory defined by the <code>FPDF_FONTPATH</code> constant (if this constant is defined)</li>
<li>The <code>font</code> directory located in the same directory as <code>fpdf.php</code> (if it exists)</li>
<li>The directories accessible through <code>include()</code></li>
</ul>
Example using <code>FPDF_FONTPATH</code>:
<div class="doc-source">
<pre><code>define('FPDF_FONTPATH','/home/www/font');
require('fpdf.php');</code></pre>
</div>
If the file corresponding to the requested font is not found, the error "Could not include font
definition file" is raised.
<h2>Parameters</h2>
<dl class="param">
<dt><code>family</code></dt>
<dd>
Family font. It can be either a name defined by AddFont() or one of the standard families (case
insensitive):
<ul>
<li><code>Courier</code> (fixed-width)</li>
<li><code>Helvetica</code> or <code>Arial</code> (synonymous; sans serif)</li>
<li><code>Times</code> (serif)</li>
<li><code>Symbol</code> (symbolic)</li>
<li><code>ZapfDingbats</code> (symbolic)</li>
</ul>
It is also possible to pass an empty string. In that case, the current family is kept.
</dd>
<dt><code>style</code></dt>
<dd>
Font style. Possible values are (case insensitive):
<ul>
<li>empty string: regular</li>
<li><code>B</code>: bold</li>
<li><code>I</code>: italic</li>
<li><code>U</code>: underline</li>
</ul>
or any combination. The default value is regular.
Bold and italic styles do not apply to <code>Symbol</code> and <code>ZapfDingbats</code>.
</dd>
<dt><code>size</code></dt>
<dd>
Font size in points.
<br>
The default value is the current size. If no size has been specified since the beginning of
the document, the value taken is 12.
</dd>
</dl>
<h2>Example</h2>
<div class="doc-source">
<pre><code>// Times regular 12
$pdf-&gt;SetFont('Times');
// Arial bold 14
$pdf-&gt;SetFont('Arial','B',14);
// Removes bold
$pdf-&gt;SetFont('');
// Times bold, italic and underlined 14
$pdf-&gt;SetFont('Times','BIU');</code></pre>
</div>
<h2>See also</h2>
<a href="addfont.htm">AddFont</a>,
<a href="setfontsize.htm">SetFontSize</a>,
<a href="cell.htm">Cell</a>,
<a href="multicell.htm">MultiCell</a>,
<a href="write.htm">Write</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

@ -0,0 +1,25 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>SetFontSize</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>SetFontSize</h1>
<code>SetFontSize(<b>float</b> size)</code>
<h2>Description</h2>
Defines the size of the current font.
<h2>Parameters</h2>
<dl class="param">
<dt><code>size</code></dt>
<dd>
The size (in points).
</dd>
</dl>
<h2>See also</h2>
<a href="setfont.htm">SetFont</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

@ -0,0 +1,33 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>SetKeywords</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>SetKeywords</h1>
<code>SetKeywords(<b>string</b> keywords [, <b>boolean</b> isUTF8])</code>
<h2>Description</h2>
Associates keywords with the document, generally in the form 'keyword1 keyword2 ...'.
<h2>Parameters</h2>
<dl class="param">
<dt><code>keywords</code></dt>
<dd>
The list of keywords.
</dd>
<dt><code>isUTF8</code></dt>
<dd>
Indicates if the string is encoded in ISO-8859-1 (<code>false</code>) or UTF-8 (<code>true</code>).<br>
Default value: <code>false</code>.
</dd>
</dl>
<h2>See also</h2>
<a href="setauthor.htm">SetAuthor</a>,
<a href="setcreator.htm">SetCreator</a>,
<a href="setsubject.htm">SetSubject</a>,
<a href="settitle.htm">SetTitle</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

@ -0,0 +1,30 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>SetLeftMargin</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>SetLeftMargin</h1>
<code>SetLeftMargin(<b>float</b> margin)</code>
<h2>Description</h2>
Defines the left margin. The method can be called before creating the first page.
<br>
If the current abscissa gets out of page, it is brought back to the margin.
<h2>Parameters</h2>
<dl class="param">
<dt><code>margin</code></dt>
<dd>
The margin.
</dd>
</dl>
<h2>See also</h2>
<a href="settopmargin.htm">SetTopMargin</a>,
<a href="setrightmargin.htm">SetRightMargin</a>,
<a href="setautopagebreak.htm">SetAutoPageBreak</a>,
<a href="setmargins.htm">SetMargins</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

@ -0,0 +1,29 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>SetLineWidth</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>SetLineWidth</h1>
<code>SetLineWidth(<b>float</b> width)</code>
<h2>Description</h2>
Defines the line width. By default, the value equals 0.2 mm. The method can be called before
the first page is created and the value is retained from page to page.
<h2>Parameters</h2>
<dl class="param">
<dt><code>width</code></dt>
<dd>
The width.
</dd>
</dl>
<h2>See also</h2>
<a href="line.htm">Line</a>,
<a href="rect.htm">Rect</a>,
<a href="cell.htm">Cell</a>,
<a href="multicell.htm">MultiCell</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

@ -0,0 +1,34 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>SetLink</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>SetLink</h1>
<code>SetLink(<b>int</b> link [, <b>float</b> y [, <b>int</b> page]])</code>
<h2>Description</h2>
Defines the page and position a link points to.
<h2>Parameters</h2>
<dl class="param">
<dt><code>link</code></dt>
<dd>
The link identifier returned by AddLink().
</dd>
<dt><code>y</code></dt>
<dd>
Ordinate of target position; <code>-1</code> indicates the current position.
The default value is <code>0</code> (top of page).
</dd>
<dt><code>page</code></dt>
<dd>
Number of target page; <code>-1</code> indicates the current page. This is the default value.
</dd>
</dl>
<h2>See also</h2>
<a href="addlink.htm">AddLink</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

@ -0,0 +1,37 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>SetMargins</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>SetMargins</h1>
<code>SetMargins(<b>float</b> left, <b>float</b> top [, <b>float</b> right])</code>
<h2>Description</h2>
Defines the left, top and right margins. By default, they equal 1 cm. Call this method to change
them.
<h2>Parameters</h2>
<dl class="param">
<dt><code>left</code></dt>
<dd>
Left margin.
</dd>
<dt><code>top</code></dt>
<dd>
Top margin.
</dd>
<dt><code>right</code></dt>
<dd>
Right margin. Default value is the left one.
</dd>
</dl>
<h2>See also</h2>
<a href="setleftmargin.htm">SetLeftMargin</a>,
<a href="settopmargin.htm">SetTopMargin</a>,
<a href="setrightmargin.htm">SetRightMargin</a>,
<a href="setautopagebreak.htm">SetAutoPageBreak</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

@ -0,0 +1,28 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>SetRightMargin</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>SetRightMargin</h1>
<code>SetRightMargin(<b>float</b> margin)</code>
<h2>Description</h2>
Defines the right margin. The method can be called before creating the first page.
<h2>Parameters</h2>
<dl class="param">
<dt><code>margin</code></dt>
<dd>
The margin.
</dd>
</dl>
<h2>See also</h2>
<a href="setleftmargin.htm">SetLeftMargin</a>,
<a href="settopmargin.htm">SetTopMargin</a>,
<a href="setautopagebreak.htm">SetAutoPageBreak</a>,
<a href="setmargins.htm">SetMargins</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

@ -0,0 +1,33 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>SetSubject</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>SetSubject</h1>
<code>SetSubject(<b>string</b> subject [, <b>boolean</b> isUTF8])</code>
<h2>Description</h2>
Defines the subject of the document.
<h2>Parameters</h2>
<dl class="param">
<dt><code>subject</code></dt>
<dd>
The subject.
</dd>
<dt><code>isUTF8</code></dt>
<dd>
Indicates if the string is encoded in ISO-8859-1 (<code>false</code>) or UTF-8 (<code>true</code>).<br>
Default value: <code>false</code>.
</dd>
</dl>
<h2>See also</h2>
<a href="setauthor.htm">SetAuthor</a>,
<a href="setcreator.htm">SetCreator</a>,
<a href="setkeywords.htm">SetKeywords</a>,
<a href="settitle.htm">SetTitle</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

@ -0,0 +1,40 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>SetTextColor</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>SetTextColor</h1>
<code>SetTextColor(<b>int</b> r [, <b>int</b> g, <b>int</b> b])</code>
<h2>Description</h2>
Defines the color used for text. It can be expressed in RGB components or gray scale. The
method can be called before the first page is created and the value is retained from page to
page.
<h2>Parameters</h2>
<dl class="param">
<dt><code>r</code></dt>
<dd>
If <code>g</code> et <code>b</code> are given, red component; if not, indicates the gray level.
Value between 0 and 255.
</dd>
<dt><code>g</code></dt>
<dd>
Green component (between 0 and 255).
</dd>
<dt><code>b</code></dt>
<dd>
Blue component (between 0 and 255).
</dd>
</dl>
<h2>See also</h2>
<a href="setdrawcolor.htm">SetDrawColor</a>,
<a href="setfillcolor.htm">SetFillColor</a>,
<a href="text.htm">Text</a>,
<a href="cell.htm">Cell</a>,
<a href="multicell.htm">MultiCell</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

@ -0,0 +1,33 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>SetTitle</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>SetTitle</h1>
<code>SetTitle(<b>string</b> title [, <b>boolean</b> isUTF8])</code>
<h2>Description</h2>
Defines the title of the document.
<h2>Parameters</h2>
<dl class="param">
<dt><code>title</code></dt>
<dd>
The title.
</dd>
<dt><code>isUTF8</code></dt>
<dd>
Indicates if the string is encoded in ISO-8859-1 (<code>false</code>) or UTF-8 (<code>true</code>).<br>
Default value: <code>false</code>.
</dd>
</dl>
<h2>See also</h2>
<a href="setauthor.htm">SetAuthor</a>,
<a href="setcreator.htm">SetCreator</a>,
<a href="setkeywords.htm">SetKeywords</a>,
<a href="setsubject.htm">SetSubject</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

@ -0,0 +1,28 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>SetTopMargin</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>SetTopMargin</h1>
<code>SetTopMargin(<b>float</b> margin)</code>
<h2>Description</h2>
Defines the top margin. The method can be called before creating the first page.
<h2>Parameters</h2>
<dl class="param">
<dt><code>margin</code></dt>
<dd>
The margin.
</dd>
</dl>
<h2>See also</h2>
<a href="setleftmargin.htm">SetLeftMargin</a>,
<a href="setrightmargin.htm">SetRightMargin</a>,
<a href="setautopagebreak.htm">SetAutoPageBreak</a>,
<a href="setmargins.htm">SetMargins</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

@ -0,0 +1,29 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>SetX</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>SetX</h1>
<code>SetX(<b>float</b> x)</code>
<h2>Description</h2>
Defines the abscissa of the current position. If the passed value is negative, it is relative
to the right of the page.
<h2>Parameters</h2>
<dl class="param">
<dt><code>x</code></dt>
<dd>
The value of the abscissa.
</dd>
</dl>
<h2>See also</h2>
<a href="getx.htm">GetX</a>,
<a href="gety.htm">GetY</a>,
<a href="sety.htm">SetY</a>,
<a href="setxy.htm">SetXY</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

@ -0,0 +1,31 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>SetXY</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>SetXY</h1>
<code>SetXY(<b>float</b> x, <b>float</b> y)</code>
<h2>Description</h2>
Defines the abscissa and ordinate of the current position. If the passed values are negative,
they are relative respectively to the right and bottom of the page.
<h2>Parameters</h2>
<dl class="param">
<dt><code>x</code></dt>
<dd>
The value of the abscissa.
</dd>
<dt><code>y</code></dt>
<dd>
The value of the ordinate.
</dd>
</dl>
<h2>See also</h2>
<a href="setx.htm">SetX</a>,
<a href="sety.htm">SetY</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

@ -0,0 +1,33 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>SetY</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>SetY</h1>
<code>SetY(<b>float</b> y [, <b>boolean</b> resetX])</code>
<h2>Description</h2>
Sets the ordinate and optionally moves the current abscissa back to the left margin. If the value
is negative, it is relative to the bottom of the page.
<h2>Parameters</h2>
<dl class="param">
<dt><code>y</code></dt>
<dd>
The value of the ordinate.
</dd>
<dt><code>resetX</code></dt>
<dd>
Whether to reset the abscissa. Default value: <code>true</code>.
</dd>
</dl>
<h2>See also</h2>
<a href="getx.htm">GetX</a>,
<a href="gety.htm">GetY</a>,
<a href="setx.htm">SetX</a>,
<a href="setxy.htm">SetXY</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

@ -0,0 +1,39 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Text</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>Text</h1>
<code>Text(<b>float</b> x, <b>float</b> y, <b>string</b> txt)</code>
<h2>Description</h2>
Prints a character string. The origin is on the left of the first character, on the baseline.
This method allows to place a string precisely on the page, but it is usually easier to use
Cell(), MultiCell() or Write() which are the standard methods to print text.
<h2>Parameters</h2>
<dl class="param">
<dt><code>x</code></dt>
<dd>
Abscissa of the origin.
</dd>
<dt><code>y</code></dt>
<dd>
Ordinate of the origin.
</dd>
<dt><code>txt</code></dt>
<dd>
String to print.
</dd>
</dl>
<h2>See also</h2>
<a href="setfont.htm">SetFont</a>,
<a href="settextcolor.htm">SetTextColor</a>,
<a href="cell.htm">Cell</a>,
<a href="multicell.htm">MultiCell</a>,
<a href="write.htm">Write</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

@ -0,0 +1,51 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Write</title>
<link type="text/css" rel="stylesheet" href="../fpdf.css">
</head>
<body>
<h1>Write</h1>
<code>Write(<b>float</b> h, <b>string</b> txt [, <b>mixed</b> link])</code>
<h2>Description</h2>
This method prints text from the current position. When the right margin is reached (or the \n
character is met) a line break occurs and text continues from the left margin. Upon method exit,
the current position is left just at the end of the text.
<br>
It is possible to put a link on the text.
<h2>Parameters</h2>
<dl class="param">
<dt><code>h</code></dt>
<dd>
Line height.
</dd>
<dt><code>txt</code></dt>
<dd>
String to print.
</dd>
<dt><code>link</code></dt>
<dd>
URL or identifier returned by AddLink().
</dd>
</dl>
<h2>Example</h2>
<div class="doc-source">
<pre><code>// Begin with regular font
$pdf-&gt;SetFont('Arial','',14);
$pdf-&gt;Write(5,'Visit ');
// Then put a blue underlined link
$pdf-&gt;SetTextColor(0,0,255);
$pdf-&gt;SetFont('','U');
$pdf-&gt;Write(5,'www.fpdf.org','http://www.fpdf.org');</code></pre>
</div>
<h2>See also</h2>
<a href="setfont.htm">SetFont</a>,
<a href="settextcolor.htm">SetTextColor</a>,
<a href="addlink.htm">AddLink</a>,
<a href="multicell.htm">MultiCell</a>,
<a href="setautopagebreak.htm">SetAutoPageBreak</a>
<hr style="margin-top:1.5em">
<div style="text-align:center"><a href="index.htm">Index</a></div>
</body>
</html>

118
share/pnp/application/vendor/fpdf/filters/FilterASCII85.php vendored Normal file → Executable file

@ -1,68 +1,66 @@
<?php
//
// FPDI - Version 1.3.1
//
// Copyright 2004-2009 Setasign - Jan Slabon
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
/**
* This file is part of FPDI
*
* @package FPDI
* @copyright Copyright (c) 2015 Setasign - Jan Slabon (http://www.setasign.com)
* @license http://opensource.org/licenses/mit-license The MIT License
* @version 1.6.1
*/
if (!defined('ORD_z'))
define('ORD_z',ord('z'));
if (!defined('ORD_exclmark'))
define('ORD_exclmark', ord('!'));
if (!defined('ORD_u'))
define('ORD_u', ord('u'));
if (!defined('ORD_tilde'))
define('ORD_tilde', ord('~'));
/**
* Class FilterASCII85
*/
class FilterASCII85
{
/**
* Decode ASCII85 encoded string
*
* @param string $in
* @return string
* @throws Exception
*/
public function decode($in)
{
$ord = array(
'~' => ord('~'),
'z' => ord('z'),
'u' => ord('u'),
'!' => ord('!')
);
class FilterASCII85 {
function error($msg) {
die($msg);
}
function decode($in) {
$out = '';
$state = 0;
$chn = null;
$l = strlen($in);
for ($k = 0; $k < $l; ++$k) {
$ch = ord($in[$k]) & 0xff;
if ($ch == ORD_tilde) {
if ($ch == $ord['~']) {
break;
}
if (preg_match('/^\s$/',chr($ch))) {
continue;
}
if ($ch == ORD_z && $state == 0) {
$out .= chr(0).chr(0).chr(0).chr(0);
if ($ch == $ord['z'] && $state == 0) {
$out .= chr(0) . chr(0) . chr(0) . chr(0);
continue;
}
if ($ch < ORD_exclmark || $ch > ORD_u) {
$this->error('Illegal character in ASCII85Decode.');
if ($ch < $ord['!'] || $ch > $ord['u']) {
throw new Exception('Illegal character in ASCII85Decode.');
}
$chn[$state++] = $ch - ORD_exclmark;
$chn[$state++] = $ch - $ord['!'];
if ($state == 5) {
$state = 0;
$r = 0;
for ($j = 0; $j < 5; ++$j)
$r = $r * 85 + $chn[$j];
for ($j = 0; $j < 5; ++$j) {
$r = (int)($r * 85 + $chn[$j]);
}
$out .= chr($r >> 24);
$out .= chr($r >> 16);
$out .= chr($r >> 8);
@ -70,19 +68,21 @@ class FilterASCII85 {
}
}
$r = 0;
if ($state == 1)
$this->error('Illegal length in ASCII85Decode.');
if ($state == 1) {
throw new Exception('Illegal length in ASCII85Decode.');
}
if ($state == 2) {
$r = $chn[0] * 85 * 85 * 85 * 85 + ($chn[1]+1) * 85 * 85 * 85;
$out .= chr($r >> 24);
}
else if ($state == 3) {
} else if ($state == 3) {
$r = $chn[0] * 85 * 85 * 85 * 85 + $chn[1] * 85 * 85 * 85 + ($chn[2]+1) * 85 * 85;
$out .= chr($r >> 24);
$out .= chr($r >> 16);
}
else if ($state == 4) {
} else if ($state == 4) {
$r = $chn[0] * 85 * 85 * 85 * 85 + $chn[1] * 85 * 85 * 85 + $chn[2] * 85 * 85 + ($chn[3]+1) * 85 ;
$out .= chr($r >> 24);
$out .= chr($r >> 16);
@ -91,8 +91,16 @@ class FilterASCII85 {
return $out;
}
function encode($in) {
$this->error("ASCII85 encoding not implemented.");
/**
* NOT IMPLEMENTED
*
* @param string $in
* @return string
* @throws LogicException
*/
public function encode($in)
{
throw new LogicException("ASCII85 encoding not implemented.");
}
}

@ -1,33 +0,0 @@
<?php
//
// FPDI - Version 1.3.1
//
// Copyright 2004-2009 Setasign - Jan Slabon
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
require_once('FilterASCII85.php');
class FilterASCII85_FPDI extends FilterASCII85 {
var $fpdi;
function FPDI_FilterASCII85(&$fpdi) {
$this->fpdi =& $fpdi;
}
function error($msg) {
$this->fpdi->error($msg);
}
}

@ -0,0 +1,43 @@
<?php
/**
* This file is part of FPDI
*
* @package FPDI
* @copyright Copyright (c) 2015 Setasign - Jan Slabon (http://www.setasign.com)
* @license http://opensource.org/licenses/mit-license The MIT License
* @version 1.6.1
*/
/**
* Class FilterASCIIHexDecode
*/
class FilterASCIIHexDecode
{
/**
* Converts an ASCII hexadecimal encoded string into it's binary representation.
*
* @param string $data The input string
* @return string
*/
public function decode($data)
{
$data = preg_replace('/[^0-9A-Fa-f]/', '', rtrim($data, '>'));
if ((strlen($data) % 2) == 1) {
$data .= '0';
}
return pack('H*', $data);
}
/**
* Converts a string into ASCII hexadecimal representation.
*
* @param string $data The input string
* @param boolean $leaveEOD
* @return string
*/
public function encode($data, $leaveEOD = false)
{
return current(unpack('H*', $data)) . ($leaveEOD ? '' : '>');
}
}

188
share/pnp/application/vendor/fpdf/filters/FilterLZW.php vendored Normal file → Executable file

@ -1,154 +1,164 @@
<?php
//
// FPDI - Version 1.3.1
//
// Copyright 2004-2009 Setasign - Jan Slabon
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
/**
* This file is part of FPDI
*
* @package FPDI
* @copyright Copyright (c) 2015 Setasign - Jan Slabon (http://www.setasign.com)
* @license http://opensource.org/licenses/mit-license The MIT License
* @version 1.6.1
*/
class FilterLZW {
var $sTable = array();
var $data = null;
var $dataLength = 0;
var $tIdx;
var $bitsToGet = 9;
var $bytePointer;
var $bitPointer;
var $nextData = 0;
var $nextBits = 0;
var $andTable = array(511, 1023, 2047, 4095);
/**
* Class FilterLZW
*/
class FilterLZW
{
protected $_sTable = array();
protected $_data = null;
protected $_dataLength = 0;
protected $_tIdx;
protected $_bitsToGet = 9;
protected $_bytePointer;
protected $_bitPointer;
protected $_nextData = 0;
protected $_nextBits = 0;
protected $_andTable = array(511, 1023, 2047, 4095);
function error($msg) {
die($msg);
}
/**
* Method to decode LZW compressed data.
* Decodes LZW compressed data.
*
* @param string data The compressed data.
* @param string $data The compressed data.
* @throws Exception
* @return string
*/
function decode($data) {
if($data[0] == 0x00 && $data[1] == 0x01) {
$this->error('LZW flavour not supported.');
public function decode($data)
{
if ($data[0] == 0x00 && $data[1] == 0x01) {
throw new Exception('LZW flavour not supported.');
}
$this->initsTable();
$this->_initsTable();
$this->data = $data;
$this->dataLength = strlen($data);
$this->_data = $data;
$this->_dataLength = strlen($data);
// Initialize pointers
$this->bytePointer = 0;
$this->bitPointer = 0;
$this->_bytePointer = 0;
$this->_bitPointer = 0;
$this->nextData = 0;
$this->nextBits = 0;
$this->_nextData = 0;
$this->_nextBits = 0;
$oldCode = 0;
$string = '';
$uncompData = '';
$unCompData = '';
while (($code = $this->getNextCode()) != 257) {
while (($code = $this->_getNextCode()) != 257) {
if ($code == 256) {
$this->initsTable();
$code = $this->getNextCode();
$this->_initsTable();
$code = $this->_getNextCode();
if ($code == 257) {
break;
}
$uncompData .= $this->sTable[$code];
if (!isset($this->_sTable[$code])) {
throw new Exception('Error while decompression LZW compressed data.');
}
$unCompData .= $this->_sTable[$code];
$oldCode = $code;
} else {
if ($code < $this->tIdx) {
$string = $this->sTable[$code];
$uncompData .= $string;
if ($code < $this->_tIdx) {
$string = $this->_sTable[$code];
$unCompData .= $string;
$this->addStringToTable($this->sTable[$oldCode], $string[0]);
$this->_addStringToTable($this->_sTable[$oldCode], $string[0]);
$oldCode = $code;
} else {
$string = $this->sTable[$oldCode];
$string = $string.$string[0];
$uncompData .= $string;
$string = $this->_sTable[$oldCode];
$string = $string . $string[0];
$unCompData .= $string;
$this->addStringToTable($string);
$this->_addStringToTable($string);
$oldCode = $code;
}
}
}
return $uncompData;
return $unCompData;
}
/**
* Initialize the string table.
*/
function initsTable() {
$this->sTable = array();
protected function _initsTable()
{
$this->_sTable = array();
for ($i = 0; $i < 256; $i++)
$this->sTable[$i] = chr($i);
$this->_sTable[$i] = chr($i);
$this->tIdx = 258;
$this->bitsToGet = 9;
$this->_tIdx = 258;
$this->_bitsToGet = 9;
}
/**
* Add a new string to the string table.
*/
function addStringToTable ($oldString, $newString='') {
$string = $oldString.$newString;
protected function _addStringToTable($oldString, $newString = '')
{
$string = $oldString . $newString;
// Add this new String to the table
$this->sTable[$this->tIdx++] = $string;
$this->_sTable[$this->_tIdx++] = $string;
if ($this->tIdx == 511) {
$this->bitsToGet = 10;
} else if ($this->tIdx == 1023) {
$this->bitsToGet = 11;
} else if ($this->tIdx == 2047) {
$this->bitsToGet = 12;
if ($this->_tIdx == 511) {
$this->_bitsToGet = 10;
} else if ($this->_tIdx == 1023) {
$this->_bitsToGet = 11;
} else if ($this->_tIdx == 2047) {
$this->_bitsToGet = 12;
}
}
// Returns the next 9, 10, 11 or 12 bits
function getNextCode() {
if ($this->bytePointer == $this->dataLength) {
/**
* Returns the next 9, 10, 11 or 12 bits
*
* @return int
*/
protected function _getNextCode()
{
if ($this->_bytePointer == $this->_dataLength) {
return 257;
}
$this->nextData = ($this->nextData << 8) | (ord($this->data[$this->bytePointer++]) & 0xff);
$this->nextBits += 8;
$this->_nextData = ($this->_nextData << 8) | (ord($this->_data[$this->_bytePointer++]) & 0xff);
$this->_nextBits += 8;
if ($this->nextBits < $this->bitsToGet) {
$this->nextData = ($this->nextData << 8) | (ord($this->data[$this->bytePointer++]) & 0xff);
$this->nextBits += 8;
if ($this->_nextBits < $this->_bitsToGet) {
$this->_nextData = ($this->_nextData << 8) | (ord($this->_data[$this->_bytePointer++]) & 0xff);
$this->_nextBits += 8;
}
$code = ($this->nextData >> ($this->nextBits - $this->bitsToGet)) & $this->andTable[$this->bitsToGet-9];
$this->nextBits -= $this->bitsToGet;
$code = ($this->_nextData >> ($this->_nextBits - $this->_bitsToGet)) & $this->_andTable[$this->_bitsToGet-9];
$this->_nextBits -= $this->_bitsToGet;
return $code;
}
function encode($in) {
$this->error("LZW encoding not implemented.");
/**
* NOT IMPLEMENTED
*
* @param string $in
* @return string
* @throws LogicException
*/
public function encode($in)
{
throw new LogicException("LZW encoding not implemented.");
}
}

@ -1,33 +0,0 @@
<?php
//
// FPDI - Version 1.3.1
//
// Copyright 2004-2009 Setasign - Jan Slabon
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
require_once('FilterLZW.php');
class FilterLZW_FPDI extends FilterLZW {
var $fpdi;
function FilterLZW_FPDI(&$fpdi) {
$this->fpdi =& $fpdi;
}
function error($msg) {
$this->fpdi->error($msg);
}
}

@ -5,4 +5,6 @@ $up = -100;
$ut = 50;
for($i=0;$i<=255;$i++)
$cw[chr($i)] = 600;
$enc = 'cp1252';
$uv = array(0=>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));
?>

@ -5,4 +5,6 @@ $up = -100;
$ut = 50;
for($i=0;$i<=255;$i++)
$cw[chr($i)] = 600;
$enc = 'cp1252';
$uv = array(0=>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));
?>

@ -5,4 +5,6 @@ $up = -100;
$ut = 50;
for($i=0;$i<=255;$i++)
$cw[chr($i)] = 600;
$enc = 'cp1252';
$uv = array(0=>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));
?>

@ -5,4 +5,6 @@ $up = -100;
$ut = 50;
for($i=0;$i<=255;$i++)
$cw[chr($i)] = 600;
$enc = 'cp1252';
$uv = array(0=>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));
?>

@ -16,4 +16,6 @@ $cw = array(
chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,
chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>500,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>556,chr(241)=>556,
chr(242)=>556,chr(243)=>556,chr(244)=>556,chr(245)=>556,chr(246)=>556,chr(247)=>584,chr(248)=>611,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500);
$enc = 'cp1252';
$uv = array(0=>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));
?>

@ -16,4 +16,6 @@ $cw = array(
chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,
chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>556,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>611,chr(241)=>611,
chr(242)=>611,chr(243)=>611,chr(244)=>611,chr(245)=>611,chr(246)=>611,chr(247)=>584,chr(248)=>611,chr(249)=>611,chr(250)=>611,chr(251)=>611,chr(252)=>611,chr(253)=>556,chr(254)=>611,chr(255)=>556);
$enc = 'cp1252';
$uv = array(0=>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));
?>

@ -16,4 +16,6 @@ $cw = array(
chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,
chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>556,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>611,chr(241)=>611,
chr(242)=>611,chr(243)=>611,chr(244)=>611,chr(245)=>611,chr(246)=>611,chr(247)=>584,chr(248)=>611,chr(249)=>611,chr(250)=>611,chr(251)=>611,chr(252)=>611,chr(253)=>556,chr(254)=>611,chr(255)=>556);
$enc = 'cp1252';
$uv = array(0=>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));
?>

@ -16,4 +16,6 @@ $cw = array(
chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,
chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>500,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>556,chr(241)=>556,
chr(242)=>556,chr(243)=>556,chr(244)=>556,chr(245)=>556,chr(246)=>556,chr(247)=>584,chr(248)=>611,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500);
$enc = 'cp1252';
$uv = array(0=>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));
?>

@ -16,4 +16,5 @@ $cw = array(
chr(198)=>823,chr(199)=>768,chr(200)=>768,chr(201)=>713,chr(202)=>713,chr(203)=>713,chr(204)=>713,chr(205)=>713,chr(206)=>713,chr(207)=>713,chr(208)=>768,chr(209)=>713,chr(210)=>790,chr(211)=>790,chr(212)=>890,chr(213)=>823,chr(214)=>549,chr(215)=>250,chr(216)=>713,chr(217)=>603,chr(218)=>603,chr(219)=>1042,
chr(220)=>987,chr(221)=>603,chr(222)=>987,chr(223)=>603,chr(224)=>494,chr(225)=>329,chr(226)=>790,chr(227)=>790,chr(228)=>786,chr(229)=>713,chr(230)=>384,chr(231)=>384,chr(232)=>384,chr(233)=>384,chr(234)=>384,chr(235)=>384,chr(236)=>494,chr(237)=>494,chr(238)=>494,chr(239)=>494,chr(240)=>0,chr(241)=>329,
chr(242)=>274,chr(243)=>686,chr(244)=>686,chr(245)=>686,chr(246)=>384,chr(247)=>384,chr(248)=>384,chr(249)=>384,chr(250)=>384,chr(251)=>384,chr(252)=>494,chr(253)=>494,chr(254)=>494,chr(255)=>0);
$uv = array(32=>160,33=>33,34=>8704,35=>35,36=>8707,37=>array(37,2),39=>8715,40=>array(40,2),42=>8727,43=>array(43,2),45=>8722,46=>array(46,18),64=>8773,65=>array(913,2),67=>935,68=>array(916,2),70=>934,71=>915,72=>919,73=>921,74=>977,75=>array(922,4),79=>array(927,2),81=>920,82=>929,83=>array(931,3),86=>962,87=>937,88=>926,89=>936,90=>918,91=>91,92=>8756,93=>93,94=>8869,95=>95,96=>63717,97=>array(945,2),99=>967,100=>array(948,2),102=>966,103=>947,104=>951,105=>953,106=>981,107=>array(954,4),111=>array(959,2),113=>952,114=>961,115=>array(963,3),118=>982,119=>969,120=>958,121=>968,122=>950,123=>array(123,3),126=>8764,160=>8364,161=>978,162=>8242,163=>8804,164=>8725,165=>8734,166=>402,167=>9827,168=>9830,169=>9829,170=>9824,171=>8596,172=>array(8592,4),176=>array(176,2),178=>8243,179=>8805,180=>215,181=>8733,182=>8706,183=>8226,184=>247,185=>array(8800,2),187=>8776,188=>8230,189=>array(63718,2),191=>8629,192=>8501,193=>8465,194=>8476,195=>8472,196=>8855,197=>8853,198=>8709,199=>array(8745,2),201=>8835,202=>8839,203=>8836,204=>8834,205=>8838,206=>array(8712,2),208=>8736,209=>8711,210=>63194,211=>63193,212=>63195,213=>8719,214=>8730,215=>8901,216=>172,217=>array(8743,2),219=>8660,220=>array(8656,4),224=>9674,225=>9001,226=>array(63720,3),229=>8721,230=>array(63723,10),241=>9002,242=>8747,243=>8992,244=>63733,245=>8993,246=>array(63734,9));
?>

@ -16,4 +16,6 @@ $cw = array(
chr(198)=>889,chr(199)=>667,chr(200)=>611,chr(201)=>611,chr(202)=>611,chr(203)=>611,chr(204)=>333,chr(205)=>333,chr(206)=>333,chr(207)=>333,chr(208)=>722,chr(209)=>722,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>564,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722,
chr(220)=>722,chr(221)=>722,chr(222)=>556,chr(223)=>500,chr(224)=>444,chr(225)=>444,chr(226)=>444,chr(227)=>444,chr(228)=>444,chr(229)=>444,chr(230)=>667,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>500,
chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>564,chr(248)=>500,chr(249)=>500,chr(250)=>500,chr(251)=>500,chr(252)=>500,chr(253)=>500,chr(254)=>500,chr(255)=>500);
$enc = 'cp1252';
$uv = array(0=>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));
?>

@ -16,4 +16,6 @@ $cw = array(
chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>389,chr(205)=>389,chr(206)=>389,chr(207)=>389,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>570,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,
chr(220)=>722,chr(221)=>722,chr(222)=>611,chr(223)=>556,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>722,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>556,
chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>570,chr(248)=>500,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500);
$enc = 'cp1252';
$uv = array(0=>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));
?>

@ -16,4 +16,6 @@ $cw = array(
chr(198)=>944,chr(199)=>667,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>389,chr(205)=>389,chr(206)=>389,chr(207)=>389,chr(208)=>722,chr(209)=>722,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>570,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722,
chr(220)=>722,chr(221)=>611,chr(222)=>611,chr(223)=>500,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>722,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>556,
chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>570,chr(248)=>500,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>444,chr(254)=>500,chr(255)=>444);
$enc = 'cp1252';
$uv = array(0=>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));
?>

@ -16,4 +16,6 @@ $cw = array(
chr(198)=>889,chr(199)=>667,chr(200)=>611,chr(201)=>611,chr(202)=>611,chr(203)=>611,chr(204)=>333,chr(205)=>333,chr(206)=>333,chr(207)=>333,chr(208)=>722,chr(209)=>667,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>675,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722,
chr(220)=>722,chr(221)=>556,chr(222)=>611,chr(223)=>500,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>667,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>500,
chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>675,chr(248)=>500,chr(249)=>500,chr(250)=>500,chr(251)=>500,chr(252)=>500,chr(253)=>444,chr(254)=>500,chr(255)=>444);
$enc = 'cp1252';
$uv = array(0=>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));
?>

@ -16,4 +16,5 @@ $cw = array(
chr(198)=>788,chr(199)=>788,chr(200)=>788,chr(201)=>788,chr(202)=>788,chr(203)=>788,chr(204)=>788,chr(205)=>788,chr(206)=>788,chr(207)=>788,chr(208)=>788,chr(209)=>788,chr(210)=>788,chr(211)=>788,chr(212)=>894,chr(213)=>838,chr(214)=>1016,chr(215)=>458,chr(216)=>748,chr(217)=>924,chr(218)=>748,chr(219)=>918,
chr(220)=>927,chr(221)=>928,chr(222)=>928,chr(223)=>834,chr(224)=>873,chr(225)=>828,chr(226)=>924,chr(227)=>924,chr(228)=>917,chr(229)=>930,chr(230)=>931,chr(231)=>463,chr(232)=>883,chr(233)=>836,chr(234)=>836,chr(235)=>867,chr(236)=>867,chr(237)=>696,chr(238)=>696,chr(239)=>874,chr(240)=>0,chr(241)=>874,
chr(242)=>760,chr(243)=>946,chr(244)=>771,chr(245)=>865,chr(246)=>771,chr(247)=>888,chr(248)=>967,chr(249)=>888,chr(250)=>831,chr(251)=>873,chr(252)=>927,chr(253)=>970,chr(254)=>918,chr(255)=>0);
$uv = array(32=>32,33=>array(9985,4),37=>9742,38=>array(9990,4),42=>9755,43=>9758,44=>array(9996,28),72=>9733,73=>array(10025,35),108=>9679,109=>10061,110=>9632,111=>array(10063,4),115=>9650,116=>9660,117=>9670,118=>10070,119=>9687,120=>array(10072,7),128=>array(10088,14),161=>array(10081,7),168=>9827,169=>9830,170=>9829,171=>9824,172=>array(9312,10),182=>array(10102,31),213=>8594,214=>array(8596,2),216=>array(10136,24),241=>array(10161,14));
?>

21
share/pnp/application/vendor/fpdf/fpdf.css vendored Executable file

@ -0,0 +1,21 @@
body {font-family:"Times New Roman",serif}
h1 {font:bold 135% Arial,sans-serif; color:#4000A0; margin-bottom:0.9em}
h2 {font:bold 95% Arial,sans-serif; color:#900000; margin-top:1.5em; margin-bottom:1em}
dl.param dt {text-decoration:underline}
dl.param dd {margin-top:1em; margin-bottom:1em}
dl.param ul {margin-top:1em; margin-bottom:1em}
tt, code, kbd {font-family:"Courier New",Courier,monospace; font-size:82%}
div.source {margin-top:1.4em; margin-bottom:1.3em}
div.source pre {display:table; border:1px solid #24246A; width:100%; margin:0em; font-family:inherit; font-size:100%}
div.source code {display:block; border:1px solid #C5C5EC; background-color:#F0F5FF; padding:6px; color:#000000}
div.doc-source {margin-top:1.4em; margin-bottom:1.3em}
div.doc-source pre {display:table; width:100%; margin:0em; font-family:inherit; font-size:100%}
div.doc-source code {display:block; background-color:#E0E0E0; padding:4px}
.kw {color:#000080; font-weight:bold}
.str {color:#CC0000}
.cmt {color:#008000}
p.demo {text-align:center; margin-top:-0.9em}
a.demo {text-decoration:none; font-weight:bold; color:#0000CC}
a.demo:link {text-decoration:none; font-weight:bold; color:#0000CC}
a.demo:hover {text-decoration:none; font-weight:bold; color:#0000FF}
a.demo:active {text-decoration:none; font-weight:bold; color:#0000FF}

File diff suppressed because it is too large Load Diff

633
share/pnp/application/vendor/fpdf/fpdf_tpl.php vendored Normal file → Executable file

@ -1,81 +1,92 @@
<?php
//
// FPDF_TPL - Version 1.1.3
//
// Copyright 2004-2009 Setasign - Jan Slabon
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
/**
* This file is part of FPDI
*
* @package FPDI
* @copyright Copyright (c) 2015 Setasign - Jan Slabon (http://www.setasign.com)
* @license http://opensource.org/licenses/mit-license The MIT License
* @version 1.6.1
*/
class FPDF_TPL extends FPDF {
if (!class_exists('fpdi_bridge')) {
require_once('fpdi_bridge.php');
}
/**
* Class FPDF_TPL
*/
class FPDF_TPL extends fpdi_bridge
{
/**
* Array of Tpl-Data
* Array of template data
*
* @var array
*/
var $tpls = array();
protected $_tpls = array();
/**
* Current Template-ID
* Current Template-Id
*
* @var int
*/
var $tpl = 0;
/**
* "In Template"-Flag
* @var boolean
*/
var $_intpl = false;
/**
* Nameprefix of Templates used in Resources-Dictonary
* @var string A String defining the Prefix used as Template-Object-Names. Have to beginn with an /
*/
var $tplprefix = "/TPL";
public $tpl = 0;
/**
* Resources used By Templates and Pages
* @var array
* "In Template"-Flag
*
* @var boolean
*/
var $_res = array();
protected $_inTpl = false;
/**
* Last used Template data
* Name prefix of templates used in Resources dictionary
*
* @var string A String defining the Prefix used as Template-Object-Names. Have to begin with an /
*/
public $tplPrefix = "/TPL";
/**
* Resources used by templates and pages
*
* @var array
*/
var $lastUsedTemplateData = array();
protected $_res = array();
/**
* Start a Template
* Last used template data
*
* @var array
*/
public $lastUsedTemplateData = array();
/**
* Start a template.
*
* This method starts a template. You can give own coordinates to build an own sized
* Template. Pay attention, that the margins are adapted to the new templatesize.
* If you want to write outside the template, for example to build a clipped Template,
* you have to set the Margins and "Cursor"-Position manual after beginTemplate-Call.
* template. Pay attention, that the margins are adapted to the new template size.
* If you want to write outside the template, for example to build a clipped template,
* you have to set the margins and "cursor"-position manual after beginTemplate()-call.
*
* If no parameter is given, the template uses the current page-size.
* The Method returns an ID of the current Template. This ID is used later for using this template.
* Warning: A created Template is used in PDF at all events. Still if you don't use it after creation!
* The method returns an id of the current template. This id is used later for using this template.
* Warning: A created template is saved in the resulting PDF at all events. Also if you don't use it after creation!
*
* @param int $x The x-coordinate given in user-unit
* @param int $y The y-coordinate given in user-unit
* @param int $w The width given in user-unit
* @param int $h The height given in user-unit
* @return int The ID of new created Template
* @return int The id of new created template
* @throws LogicException
*/
function beginTemplate($x=null, $y=null, $w=null, $h=null) {
if ($this->page <= 0)
$this->error("You have to add a page to fpdf first!");
public function beginTemplate($x = null, $y = null, $w = null, $h = null)
{
if (is_subclass_of($this, 'TCPDF')) {
throw new LogicException('This method is only usable with FPDF. Use TCPDF methods startTemplate() instead.');
}
if ($this->page <= 0) {
throw new LogicException("You have to add at least a page first!");
}
if ($x == null)
$x = 0;
@ -88,7 +99,7 @@ class FPDF_TPL extends FPDF {
// Save settings
$this->tpl++;
$tpl =& $this->tpls[$this->tpl];
$tpl =& $this->_tpls[$this->tpl];
$tpl = array(
'o_x' => $this->x,
'o_y' => $this->y,
@ -99,6 +110,10 @@ class FPDF_TPL extends FPDF {
'o_rMargin' => $this->rMargin,
'o_h' => $this->h,
'o_w' => $this->w,
'o_FontFamily' => $this->FontFamily,
'o_FontStyle' => $this->FontStyle,
'o_FontSizePt' => $this->FontSizePt,
'o_FontSize' => $this->FontSize,
'buffer' => '',
'x' => $x,
'y' => $y,
@ -107,29 +122,43 @@ class FPDF_TPL extends FPDF {
);
$this->SetAutoPageBreak(false);
// Define own high and width to calculate possitions correct
// Define own high and width to calculate correct positions
$this->h = $h;
$this->w = $w;
$this->_intpl = true;
$this->SetXY($x+$this->lMargin, $y+$this->tMargin);
$this->SetRightMargin($this->w-$w+$this->rMargin);
$this->_inTpl = true;
$this->SetXY($x + $this->lMargin, $y + $this->tMargin);
$this->SetRightMargin($this->w - $w + $this->rMargin);
if ($this->CurrentFont) {
$fontKey = $this->FontFamily . $this->FontStyle;
if ($fontKey) {
$this->_res['tpl'][$this->tpl]['fonts'][$fontKey] =& $this->fonts[$fontKey];
$this->_out(sprintf('BT /F%d %.2F Tf ET', $this->CurrentFont['i'], $this->FontSizePt));
}
}
return $this->tpl;
}
/**
* End Template
* End template.
*
* This method ends a template and reset initiated variables on beginTemplate.
* This method ends a template and reset initiated variables collected in {@link beginTemplate()}.
*
* @return mixed If a template is opened, the ID is returned. If not a false is returned.
* @return int|boolean If a template is opened, the id is returned. If not a false is returned.
*/
function endTemplate() {
if ($this->_intpl) {
$this->_intpl = false;
$tpl =& $this->tpls[$this->tpl];
public function endTemplate()
{
if (is_subclass_of($this, 'TCPDF')) {
$args = func_get_args();
return call_user_func_array(array($this, 'TCPDF::endTemplate'), $args);
}
if ($this->_inTpl) {
$this->_inTpl = false;
$tpl = $this->_tpls[$this->tpl];
$this->SetXY($tpl['o_x'], $tpl['o_y']);
$this->tMargin = $tpl['o_tMargin'];
$this->lMargin = $tpl['o_lMargin'];
@ -137,271 +166,381 @@ class FPDF_TPL extends FPDF {
$this->h = $tpl['o_h'];
$this->w = $tpl['o_w'];
$this->SetAutoPageBreak($tpl['o_AutoPageBreak'], $tpl['o_bMargin']);
$this->FontFamily = $tpl['o_FontFamily'];
$this->FontStyle = $tpl['o_FontStyle'];
$this->FontSizePt = $tpl['o_FontSizePt'];
$this->FontSize = $tpl['o_FontSize'];
$fontKey = $this->FontFamily . $this->FontStyle;
if ($fontKey)
$this->CurrentFont =& $this->fonts[$fontKey];
return $this->tpl;
} else {
return false;
}
}
/**
* Use a Template in current Page or other Template
* Use a template in current page or other template.
*
* You can use a template in a page or in another template.
* You can give the used template a new size like you use the Image()-method.
* All parameters are optional. The width or height is calculated automaticaly
* You can give the used template a new size.
* All parameters are optional. The width or height is calculated automatically
* if one is given. If no parameter is given the origin size as defined in
* beginTemplate() is used.
* {@link beginTemplate()} method is used.
*
* The calculated or used width and height are returned as an array.
*
* @param int $tplidx A valid template-Id
* @param int $_x The x-position
* @param int $_y The y-position
* @param int $_w The new width of the template
* @param int $_h The new height of the template
* @retrun array The height and width of the template
* @param int $tplIdx A valid template-id
* @param int $x The x-position
* @param int $y The y-position
* @param int $w The new width of the template
* @param int $h The new height of the template
* @return array The height and width of the template (array('w' => ..., 'h' => ...))
* @throws LogicException|InvalidArgumentException
*/
function useTemplate($tplidx, $_x=null, $_y=null, $_w=0, $_h=0) {
if ($this->page <= 0)
$this->error("You have to add a page to fpdf first!");
if (!isset($this->tpls[$tplidx]))
$this->error("Template does not exist!");
if ($this->_intpl) {
$this->_res['tpl'][$this->tpl]['tpls'][$tplidx] =& $this->tpls[$tplidx];
public function useTemplate($tplIdx, $x = null, $y = null, $w = 0, $h = 0)
{
if ($this->page <= 0) {
throw new LogicException('You have to add at least a page first!');
}
$tpl =& $this->tpls[$tplidx];
$w = $tpl['w'];
$h = $tpl['h'];
if ($_x == null)
$_x = 0;
if ($_y == null)
$_y = 0;
$_x += $tpl['x'];
$_y += $tpl['y'];
$wh = $this->getTemplateSize($tplidx, $_w, $_h);
$_w = $wh['w'];
$_h = $wh['h'];
$tData = array(
if (!isset($this->_tpls[$tplIdx])) {
throw new InvalidArgumentException('Template does not exist!');
}
if ($this->_inTpl) {
$this->_res['tpl'][$this->tpl]['tpls'][$tplIdx] =& $this->_tpls[$tplIdx];
}
$tpl = $this->_tpls[$tplIdx];
$_w = $tpl['w'];
$_h = $tpl['h'];
if ($x == null) {
$x = 0;
}
if ($y == null) {
$y = 0;
}
$x += $tpl['x'];
$y += $tpl['y'];
$wh = $this->getTemplateSize($tplIdx, $w, $h);
$w = $wh['w'];
$h = $wh['h'];
$tplData = array(
'x' => $this->x,
'y' => $this->y,
'w' => $_w,
'h' => $_h,
'scaleX' => ($_w/$w),
'scaleY' => ($_h/$h),
'tx' => $_x,
'ty' => ($this->h-$_y-$_h),
'lty' => ($this->h-$_y-$_h) - ($this->h-$h) * ($_h/$h)
'w' => $w,
'h' => $h,
'scaleX' => ($w / $_w),
'scaleY' => ($h / $_h),
'tx' => $x,
'ty' => ($this->h - $y - $h),
'lty' => ($this->h - $y - $h) - ($this->h - $_h) * ($h / $_h)
);
$this->_out(sprintf("q %.4F 0 0 %.4F %.4F %.4F cm", $tData['scaleX'], $tData['scaleY'], $tData['tx']*$this->k, $tData['ty']*$this->k)); // Translate
$this->_out(sprintf('%s%d Do Q', $this->tplprefix, $tplidx));
$this->lastUsedTemplateData = $tData;
return array("w" => $_w, "h" => $_h);
$this->_out(sprintf('q %.4F 0 0 %.4F %.4F %.4F cm',
$tplData['scaleX'], $tplData['scaleY'], $tplData['tx'] * $this->k, $tplData['ty'] * $this->k)
); // Translate
$this->_out(sprintf('%s%d Do Q', $this->tplPrefix, $tplIdx));
$this->lastUsedTemplateData = $tplData;
return array('w' => $w, 'h' => $h);
}
/**
* Get The calculated Size of a Template
* Get the calculated size of a template.
*
* If one size is given, this method calculates the other one.
*
* @param int $tplidx A valid template-Id
* @param int $_w The width of the template
* @param int $_h The height of the template
* @return array The height and width of the template
* @param int $tplIdx A valid template-id
* @param int $w The width of the template
* @param int $h The height of the template
* @return array The height and width of the template (array('w' => ..., 'h' => ...))
*/
function getTemplateSize($tplidx, $_w=0, $_h=0) {
if (!$this->tpls[$tplidx])
public function getTemplateSize($tplIdx, $w = 0, $h = 0)
{
if (!isset($this->_tpls[$tplIdx]))
return false;
$tpl =& $this->tpls[$tplidx];
$w = $tpl['w'];
$h = $tpl['h'];
if ($_w == 0 and $_h == 0) {
$_w = $w;
$_h = $h;
$tpl = $this->_tpls[$tplIdx];
$_w = $tpl['w'];
$_h = $tpl['h'];
if ($w == 0 && $h == 0) {
$w = $_w;
$h = $_h;
}
if($_w==0)
$_w = $_h*$w/$h;
if($_h==0)
$_h = $_w*$h/$w;
return array("w" => $_w, "h" => $_h);
if ($w == 0)
$w = $h * $_w / $_h;
if($h == 0)
$h = $w * $_h / $_w;
return array("w" => $w, "h" => $h);
}
/**
* See FPDF/TCPDF-Documentation ;-)
* Sets the font used to print character strings.
*
* See FPDF/TCPDF documentation.
*
* @see http://fpdf.org/en/doc/setfont.htm
* @see http://www.tcpdf.org/doc/code/classTCPDF.html#afd56e360c43553830d543323e81bc045
*/
function SetFont($family, $style='', $size=0, $fontfile='') {
if (!is_subclass_of($this, 'TCPDF') && func_num_args() > 3) {
$this->Error('More than 3 arguments for the SetFont method are only available in TCPDF.');
public function SetFont($family, $style = '', $size = null, $fontfile = '', $subset = 'default', $out = true)
{
if (is_subclass_of($this, 'TCPDF')) {
$args = func_get_args();
return call_user_func_array(array($this, 'TCPDF::SetFont'), $args);
}
/**
* force the resetting of font changes in a template
*/
if ($this->_intpl)
$this->FontFamily = '';
parent::SetFont($family, $style, $size, $fontfile);
$fontkey = $this->FontFamily.$this->FontStyle;
if ($this->_intpl) {
parent::SetFont($family, $style, $size);
$fontkey = $this->FontFamily . $this->FontStyle;
if ($this->_inTpl) {
$this->_res['tpl'][$this->tpl]['fonts'][$fontkey] =& $this->fonts[$fontkey];
} else {
$this->_res['page'][$this->page]['fonts'][$fontkey] =& $this->fonts[$fontkey];
}
}
/**
* See FPDF/TCPDF-Documentation ;-)
* Puts an image.
*
* See FPDF/TCPDF documentation.
*
* @see http://fpdf.org/en/doc/image.htm
* @see http://www.tcpdf.org/doc/code/classTCPDF.html#a714c2bee7d6b39d4d6d304540c761352
*/
function Image($file, $x, $y, $w=0, $h=0, $type='', $link='', $align='', $resize=false, $dpi=300, $palign='', $ismask=false, $imgmask=false, $border=0) {
if (!is_subclass_of($this, 'TCPDF') && func_num_args() > 7) {
$this->Error('More than 7 arguments for the Image method are only available in TCPDF.');
public function Image(
$file, $x = '', $y = '', $w = 0, $h = 0, $type = '', $link = '', $align = '', $resize = false,
$dpi = 300, $palign = '', $ismask = false, $imgmask = false, $border = 0, $fitbox = false,
$hidden = false, $fitonpage = false, $alt = false, $altimgs = array()
)
{
if (is_subclass_of($this, 'TCPDF')) {
$args = func_get_args();
return call_user_func_array(array($this, 'TCPDF::Image'), $args);
}
parent::Image($file, $x, $y, $w, $h, $type, $link, $align, $resize, $dpi, $palign, $ismask, $imgmask, $border);
if ($this->_intpl) {
$ret = parent::Image($file, $x, $y, $w, $h, $type, $link);
if ($this->_inTpl) {
$this->_res['tpl'][$this->tpl]['images'][$file] =& $this->images[$file];
} else {
$this->_res['page'][$this->page]['images'][$file] =& $this->images[$file];
}
}
/**
* See FPDF-Documentation ;-)
*
* AddPage is not available when you're "in" a template.
*/
function AddPage($orientation='', $format='') {
if ($this->_intpl)
$this->Error('Adding pages in templates isn\'t possible!');
parent::AddPage($orientation, $format);
return $ret;
}
/**
* Preserve adding Links in Templates ...won't work
* Adds a new page to the document.
*
* See FPDF/TCPDF documentation.
*
* This method cannot be used if you'd started a template.
*
* @see http://fpdf.org/en/doc/addpage.htm
* @see http://www.tcpdf.org/doc/code/classTCPDF.html#a5171e20b366b74523709d84c349c1ced
*/
function Link($x, $y, $w, $h, $link, $spaces=0) {
if (!is_subclass_of($this, 'TCPDF') && func_num_args() > 5) {
$this->Error('More than 7 arguments for the Image method are only available in TCPDF.');
public function AddPage($orientation = '', $format = '', $rotationOrKeepmargins = false, $tocpage = false)
{
if (is_subclass_of($this, 'TCPDF')) {
$args = func_get_args();
return call_user_func_array(array($this, 'TCPDF::AddPage'), $args);
}
if ($this->_intpl)
$this->Error('Using links in templates aren\'t possible!');
parent::Link($x, $y, $w, $h, $link, $spaces);
if ($this->_inTpl) {
throw new LogicException('Adding pages in templates is not possible!');
}
parent::AddPage($orientation, $format, $rotationOrKeepmargins);
}
function AddLink() {
if ($this->_intpl)
$this->Error('Adding links in templates aren\'t possible!');
/**
* Puts a link on a rectangular area of the page.
*
* Overwritten because adding links in a template will not work.
*
* @see http://fpdf.org/en/doc/link.htm
* @see http://www.tcpdf.org/doc/code/classTCPDF.html#ab87bf1826384fbfe30eb499d42f1d994
*/
public function Link($x, $y, $w, $h, $link, $spaces = 0)
{
if (is_subclass_of($this, 'TCPDF')) {
$args = func_get_args();
return call_user_func_array(array($this, 'TCPDF::Link'), $args);
}
if ($this->_inTpl) {
throw new LogicException('Using links in templates is not posible!');
}
parent::Link($x, $y, $w, $h, $link);
}
/**
* Creates a new internal link and returns its identifier.
*
* Overwritten because adding links in a template will not work.
*
* @see http://fpdf.org/en/doc/addlink.htm
* @see http://www.tcpdf.org/doc/code/classTCPDF.html#a749522038ed7786c3e1701435dcb891e
*/
public function AddLink()
{
if (is_subclass_of($this, 'TCPDF')) {
$args = func_get_args();
return call_user_func_array(array($this, 'TCPDF::AddLink'), $args);
}
if ($this->_inTpl) {
throw new LogicException('Adding links in templates is not possible!');
}
return parent::AddLink();
}
function SetLink($link, $y=0, $page=-1) {
if ($this->_intpl)
$this->Error('Setting links in templates aren\'t possible!');
/**
* Defines the page and position a link points to.
*
* Overwritten because adding links in a template will not work.
*
* @see http://fpdf.org/en/doc/setlink.htm
* @see http://www.tcpdf.org/doc/code/classTCPDF.html#ace5be60e7857953ea5e2b89cb90df0ae
*/
public function SetLink($link, $y = 0, $page = -1)
{
if (is_subclass_of($this, 'TCPDF')) {
$args = func_get_args();
return call_user_func_array(array($this, 'TCPDF::SetLink'), $args);
}
if ($this->_inTpl) {
throw new LogicException('Setting links in templates is not possible!');
}
parent::SetLink($link, $y, $page);
}
/**
* Private Method that writes the form xobjects
*/
function _putformxobjects() {
$filter=($this->compress) ? '/Filter /FlateDecode ' : '';
reset($this->tpls);
foreach($this->tpls AS $tplidx => $tpl) {
$p=($this->compress) ? gzcompress($tpl['buffer']) : $tpl['buffer'];
$this->_newobj();
$this->tpls[$tplidx]['n'] = $this->n;
$this->_out('<<'.$filter.'/Type /XObject');
/**
* Writes the form XObjects to the PDF document.
*/
protected function _putformxobjects()
{
$filter=($this->compress) ? '/Filter /FlateDecode ' : '';
reset($this->_tpls);
foreach($this->_tpls AS $tplIdx => $tpl) {
$this->_newobj();
$this->_tpls[$tplIdx]['n'] = $this->n;
$this->_out('<<'.$filter.'/Type /XObject');
$this->_out('/Subtype /Form');
$this->_out('/FormType 1');
$this->_out(sprintf('/BBox [%.2F %.2F %.2F %.2F]',
// llx
$tpl['x'],
$tpl['x'] * $this->k,
// lly
-$tpl['y'],
-$tpl['y'] * $this->k,
// urx
($tpl['w']+$tpl['x'])*$this->k,
($tpl['w'] + $tpl['x']) * $this->k,
// ury
($tpl['h']-$tpl['y'])*$this->k
($tpl['h'] - $tpl['y']) * $this->k
));
if ($tpl['x'] != 0 || $tpl['y'] != 0) {
$this->_out(sprintf('/Matrix [1 0 0 1 %.5F %.5F]',
-$tpl['x']*$this->k*2, $tpl['y']*$this->k*2
-$tpl['x'] * $this->k * 2, $tpl['y'] * $this->k * 2
));
}
$this->_out('/Resources ');
$this->_out('/Resources ');
$this->_out('<</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]');
if (isset($this->_res['tpl'][$tplidx]['fonts']) && count($this->_res['tpl'][$tplidx]['fonts'])) {
$this->_out('/Font <<');
foreach($this->_res['tpl'][$tplidx]['fonts'] as $font)
$this->_out('/F'.$font['i'].' '.$font['n'].' 0 R');
$this->_out('>>');
if (isset($this->_res['tpl'][$tplIdx])) {
$res = $this->_res['tpl'][$tplIdx];
if (isset($res['fonts']) && count($res['fonts'])) {
$this->_out('/Font <<');
foreach($res['fonts'] as $font) {
$this->_out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R');
}
$this->_out('>>');
}
if(isset($res['images']) || isset($res['tpls'])) {
$this->_out('/XObject <<');
if (isset($res['images'])) {
foreach($res['images'] as $image)
$this->_out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R');
}
if (isset($res['tpls'])) {
foreach($res['tpls'] as $i => $_tpl)
$this->_out($this->tplPrefix . $i . ' ' . $_tpl['n'] . ' 0 R');
}
$this->_out('>>');
}
}
if(isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images']) ||
isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls']))
{
$this->_out('/XObject <<');
if (isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images'])) {
foreach($this->_res['tpl'][$tplidx]['images'] as $image)
$this->_out('/I'.$image['i'].' '.$image['n'].' 0 R');
}
if (isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls'])) {
foreach($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl)
$this->_out($this->tplprefix.$i.' '.$tpl['n'].' 0 R');
}
$this->_out('>>');
}
$this->_out('>>');
$this->_out('/Length '.strlen($p).' >>');
$this->_putstream($p);
$this->_out('endobj');
$this->_out('>>');
$buffer = ($this->compress) ? gzcompress($tpl['buffer']) : $tpl['buffer'];
$this->_out('/Length ' . strlen($buffer) . ' >>');
$this->_putstream($buffer);
$this->_out('endobj');
}
}
/**
* Overwritten to add _putformxobjects() after _putimages()
* Output images.
*
* Overwritten to add {@link _putformxobjects()} after _putimages().
*/
function _putimages() {
public function _putimages()
{
parent::_putimages();
$this->_putformxobjects();
}
function _putxobjectdict() {
/**
* Writes the references of XObject resources to the document.
*
* Overwritten to add the the templates to the XObject resource dictionary.
*/
public function _putxobjectdict()
{
parent::_putxobjectdict();
if (count($this->tpls)) {
foreach($this->tpls as $tplidx => $tpl) {
$this->_out(sprintf('%s%d %d 0 R', $this->tplprefix, $tplidx, $tpl['n']));
}
foreach($this->_tpls as $tplIdx => $tpl) {
$this->_out(sprintf('%s%d %d 0 R', $this->tplPrefix, $tplIdx, $tpl['n']));
}
}
/**
* Private Method
* Writes bytes to the resulting document.
*
* Overwritten to delegate the data to the template buffer.
*
* @param string $s
*/
function _out($s) {
if ($this->state==2 && $this->_intpl) {
$this->tpls[$this->tpl]['buffer'] .= $s."\n";
public function _out($s)
{
if ($this->state == 2 && $this->_inTpl) {
$this->_tpls[$this->tpl]['buffer'] .= $s . "\n";
} else {
parent::_out($s);
}

1198
share/pnp/application/vendor/fpdf/fpdi.php vendored Normal file → Executable file

File diff suppressed because it is too large Load Diff

@ -1,171 +0,0 @@
<?php
//
// FPDI - Version 1.3.1
//
// Copyright 2004-2009 Setasign - Jan Slabon
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
/**
* This class is used as a bridge between TCPDF and FPDI
* and will create the possibility to use both FPDF and TCPDF
* via one FPDI version.
*
* We'll simply remap TCPDF to FPDF again.
*
* It'll be loaded and extended by FPDF_TPL.
*/
class FPDF extends TCPDF {
function __get($name) {
switch ($name) {
case 'PDFVersion':
return $this->PDFVersion;
case 'k':
return $this->k;
default:
// Error handling
$this->Error('Cannot access protected property '.get_class($this).':$'.$name.' / Undefined property: '.get_class($this).'::$'.$name);
}
}
function __set($name, $value) {
switch ($name) {
case 'PDFVersion':
$this->PDFVersion = $value;
break;
default:
// Error handling
$this->Error('Cannot access protected property '.get_class($this).':$'.$name.' / Undefined property: '.get_class($this).'::$'.$name);
}
}
/**
* Encryption of imported data by FPDI
*
* @param array $value
*/
function pdf_write_value(&$value) {
switch ($value[0]) {
case PDF_TYPE_STRING :
if ($this->encrypted) {
$value[1] = $this->_unescape($value[1]);
$value[1] = $this->_RC4($this->_objectkey($this->_current_obj_id), $value[1]);
$value[1] = $this->_escape($value[1]);
}
break;
case PDF_TYPE_STREAM :
if ($this->encrypted) {
$value[2][1] = $this->_RC4($this->_objectkey($this->_current_obj_id), $value[2][1]);
}
break;
case PDF_TYPE_HEX :
if ($this->encrypted) {
$value[1] = $this->hex2str($value[1]);
$value[1] = $this->_RC4($this->_objectkey($this->_current_obj_id), $value[1]);
// remake hexstring of encrypted string
$value[1] = $this->str2hex($value[1]);
}
break;
}
}
/**
* Unescapes a PDF string
*
* @param string $s
* @return string
*/
function _unescape($s) {
$out = '';
for ($count = 0, $n = strlen($s); $count < $n; $count++) {
if ($s[$count] != '\\' || $count == $n-1) {
$out .= $s[$count];
} else {
switch ($s[++$count]) {
case ')':
case '(':
case '\\':
$out .= $s[$count];
break;
case 'f':
$out .= chr(0x0C);
break;
case 'b':
$out .= chr(0x08);
break;
case 't':
$out .= chr(0x09);
break;
case 'r':
$out .= chr(0x0D);
break;
case 'n':
$out .= chr(0x0A);
break;
case "\r":
if ($count != $n-1 && $s[$count+1] == "\n")
$count++;
break;
case "\n":
break;
default:
// Octal-Values
if (ord($s[$count]) >= ord('0') &&
ord($s[$count]) <= ord('9')) {
$oct = ''. $s[$count];
if (ord($s[$count+1]) >= ord('0') &&
ord($s[$count+1]) <= ord('9')) {
$oct .= $s[++$count];
if (ord($s[$count+1]) >= ord('0') &&
ord($s[$count+1]) <= ord('9')) {
$oct .= $s[++$count];
}
}
$out .= chr(octdec($oct));
} else {
$out .= $s[$count];
}
}
}
}
return $out;
}
/**
* Hexadecimal to string
*
* @param string $hex
* @return string
*/
function hex2str($hex) {
return pack('H*', str_replace(array("\r", "\n", ' '), '', $hex));
}
/**
* String to hexadecimal
*
* @param string $str
* @return string
*/
function str2hex($str) {
return current(unpack('H*', $str));
}
}

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