mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 12:40:01 +01:00
Merge branch 'MDL-60301-master' of git://github.com/ankitagarwal/moodle
This commit is contained in:
commit
ae2ae5f46f
@ -1,6 +1,6 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Setasign - Jan Slabon, https://www.setasign.com
|
||||
Copyright (c) 2017 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
|
||||
|
@ -3,9 +3,9 @@
|
||||
* This file is part of FPDI
|
||||
*
|
||||
* @package FPDI
|
||||
* @copyright Copyright (c) 2015 Setasign - Jan Slabon (http://www.setasign.com)
|
||||
* @copyright Copyright (c) 2017 Setasign - Jan Slabon (https://www.setasign.com)
|
||||
* @license http://opensource.org/licenses/mit-license The MIT License
|
||||
* @version 1.6.1
|
||||
* @version 1.6.2
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -3,9 +3,9 @@
|
||||
* This file is part of FPDI
|
||||
*
|
||||
* @package FPDI
|
||||
* @copyright Copyright (c) 2015 Setasign - Jan Slabon (http://www.setasign.com)
|
||||
* @copyright Copyright (c) 2017 Setasign - Jan Slabon (https://www.setasign.com)
|
||||
* @license http://opensource.org/licenses/mit-license The MIT License
|
||||
* @version 1.6.1
|
||||
* @version 1.6.2
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -3,9 +3,9 @@
|
||||
* This file is part of FPDI
|
||||
*
|
||||
* @package FPDI
|
||||
* @copyright Copyright (c) 2015 Setasign - Jan Slabon (http://www.setasign.com)
|
||||
* @copyright Copyright (c) 2017 Setasign - Jan Slabon (https://www.setasign.com)
|
||||
* @license http://opensource.org/licenses/mit-license The MIT License
|
||||
* @version 1.6.1
|
||||
* @version 1.6.2
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -3,9 +3,9 @@
|
||||
* This file is part of FPDI
|
||||
*
|
||||
* @package FPDI
|
||||
* @copyright Copyright (c) 2015 Setasign - Jan Slabon (http://www.setasign.com)
|
||||
* @copyright Copyright (c) 2017 Setasign - Jan Slabon (https://www.setasign.com)
|
||||
* @license http://opensource.org/licenses/mit-license The MIT License
|
||||
* @version 1.6.1
|
||||
* @version 1.6.2
|
||||
*/
|
||||
|
||||
if (!class_exists('fpdi_bridge')) {
|
||||
|
@ -3,9 +3,9 @@
|
||||
* This file is part of FPDI
|
||||
*
|
||||
* @package FPDI
|
||||
* @copyright Copyright (c) 2015 Setasign - Jan Slabon (http://www.setasign.com)
|
||||
* @copyright Copyright (c) 2017 Setasign - Jan Slabon (https://www.setasign.com)
|
||||
* @license http://opensource.org/licenses/mit-license The MIT License
|
||||
* @version 1.6.1
|
||||
* @version 1.6.2
|
||||
*/
|
||||
|
||||
if (!class_exists('FPDF_TPL')) {
|
||||
@ -22,7 +22,7 @@ class FPDI extends FPDF_TPL
|
||||
*
|
||||
* @string
|
||||
*/
|
||||
const VERSION = '1.6.1';
|
||||
const VERSION = '1.6.2';
|
||||
|
||||
/**
|
||||
* Actual filename
|
||||
@ -88,6 +88,7 @@ class FPDI extends FPDF_TPL
|
||||
*
|
||||
* @param string $filename A valid path to the PDF document from which pages should be imported from
|
||||
* @return int The number of pages in the document
|
||||
* @throws Exception
|
||||
*/
|
||||
public function setSourceFile($filename)
|
||||
{
|
||||
@ -95,16 +96,27 @@ class FPDI extends FPDF_TPL
|
||||
if (false !== $_filename)
|
||||
$filename = $_filename;
|
||||
|
||||
$this->currentFilename = $filename;
|
||||
|
||||
if (!isset($this->parsers[$filename])) {
|
||||
$this->parsers[$filename] = $this->_getPdfParser($filename);
|
||||
$this->setPdfVersion(
|
||||
max($this->getPdfVersion(), $this->parsers[$filename]->getPdfVersion())
|
||||
);
|
||||
}
|
||||
$currentFilename = $this->currentFilename;
|
||||
$currentParser = $this->currentParser;
|
||||
|
||||
$this->currentParser = $this->parsers[$filename];
|
||||
try {
|
||||
$this->currentFilename = $filename;
|
||||
|
||||
if (!isset($this->parsers[$filename])) {
|
||||
$this->parsers[$filename] = $this->_getPdfParser($filename);
|
||||
$this->setPdfVersion(
|
||||
max($this->getPdfVersion(), $this->parsers[$filename]->getPdfVersion())
|
||||
);
|
||||
}
|
||||
|
||||
$this->currentParser = $this->parsers[$filename];
|
||||
|
||||
} catch (Exception $e) {
|
||||
unset($this->parsers[$filename]);
|
||||
$this->currentFilename = $currentFilename;
|
||||
$this->currentParser = $currentParser;
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $this->parsers[$filename]->getPageCount();
|
||||
}
|
||||
@ -559,7 +571,7 @@ class FPDI extends FPDF_TPL
|
||||
|
||||
reset ($value[1]);
|
||||
|
||||
while (list($k, $v) = each($value[1])) {
|
||||
foreach ($value[1] as $k => $v) {
|
||||
$this->_straightOut($k . ' ');
|
||||
$this->_writeValue($v);
|
||||
}
|
||||
|
@ -3,9 +3,9 @@
|
||||
* This file is part of FPDI
|
||||
*
|
||||
* @package FPDI
|
||||
* @copyright Copyright (c) 2015 Setasign - Jan Slabon (http://www.setasign.com)
|
||||
* @copyright Copyright (c) 2017 Setasign - Jan Slabon (https://www.setasign.com)
|
||||
* @license http://opensource.org/licenses/mit-license The MIT License
|
||||
* @version 1.6.1
|
||||
* @version 1.6.2
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -3,9 +3,9 @@
|
||||
* This file is part of FPDI
|
||||
*
|
||||
* @package FPDI
|
||||
* @copyright Copyright (c) 2015 Setasign - Jan Slabon (http://www.setasign.com)
|
||||
* @copyright Copyright (c) 2017 Setasign - Jan Slabon (http://www.setasign.com)
|
||||
* @license http://opensource.org/licenses/mit-license The MIT License
|
||||
* @version 1.6.1
|
||||
* @version 1.6.2
|
||||
*/
|
||||
|
||||
if (!class_exists('pdf_parser')) {
|
||||
@ -155,6 +155,10 @@ class fpdi_pdf_parser extends pdf_parser
|
||||
if (isset($this->_pages[$this->pageNo][1][1]['/Contents'])) {
|
||||
$contents = $this->_getPageContent($this->_pages[$this->pageNo][1][1]['/Contents']);
|
||||
foreach ($contents AS $tmpContent) {
|
||||
if ($tmpContent[0] !== pdf_parser::TYPE_STREAM) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$buffer .= $this->_unFilterStream($tmpContent) . ' ';
|
||||
}
|
||||
}
|
||||
@ -335,6 +339,10 @@ class fpdi_pdf_parser extends pdf_parser
|
||||
|
||||
foreach ($kids as $v) {
|
||||
$pg = $this->resolveObject($v);
|
||||
if ($pg[0] !== pdf_parser::TYPE_OBJECT) {
|
||||
throw new Exception('Invalid data type in page tree.');
|
||||
}
|
||||
|
||||
if ($pg[1][1]['/Type'][1] === '/Pages') {
|
||||
// If one of the kids is an embedded
|
||||
// /Pages array, resolve it as well.
|
||||
|
@ -3,9 +3,9 @@
|
||||
* This file is part of FPDI
|
||||
*
|
||||
* @package FPDI
|
||||
* @copyright Copyright (c) 2015 Setasign - Jan Slabon (http://www.setasign.com)
|
||||
* @copyright Copyright (c) 2017 Setasign - Jan Slabon (https://www.setasign.com)
|
||||
* @license http://opensource.org/licenses/mit-license The MIT License
|
||||
* @version 1.6.1
|
||||
* @version 1.6.2
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -67,7 +67,14 @@ class pdf_context
|
||||
public function getPos()
|
||||
{
|
||||
if ($this->_mode == 0) {
|
||||
return ftell($this->file);
|
||||
if (feof($this->file)) {
|
||||
$stat = fstat($this->file);
|
||||
fseek($this->file, $stat['size']);
|
||||
}
|
||||
|
||||
$pos = ftell($this->file);
|
||||
|
||||
return $pos;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
@ -85,7 +92,7 @@ class pdf_context
|
||||
{
|
||||
if ($this->_mode == 0) {
|
||||
if (!is_null($pos)) {
|
||||
fseek ($this->file, $pos);
|
||||
fseek($this->file, $pos);
|
||||
}
|
||||
|
||||
$this->buffer = $l > 0 ? fread($this->file, $l) : '';
|
||||
|
@ -3,9 +3,9 @@
|
||||
* This file is part of FPDI
|
||||
*
|
||||
* @package FPDI
|
||||
* @copyright Copyright (c) 2015 Setasign - Jan Slabon (http://www.setasign.com)
|
||||
* @copyright Copyright (c) 2017 Setasign - Jan Slabon (https://www.setasign.com)
|
||||
* @license http://opensource.org/licenses/mit-license The MIT License
|
||||
* @version 1.6.1
|
||||
* @version 1.6.2
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -19,6 +19,15 @@ Installation
|
||||
3) Update mod/assign/feedback/editpdf/fpdi/fpdi_bridge.php (or the replacement file) to extend 'pdf' instead of 'TCPDF'.
|
||||
4) Make a note below of any changes made.
|
||||
|
||||
2017/10/03
|
||||
----------
|
||||
1/ Updated to 1.6.2
|
||||
2/ Cherry-picked changes in MDL-55848.
|
||||
3/ Renamed 'TCPDF' to 'pdf' as stated above.
|
||||
4/ Applied php7.2 compatibility fix, remove this if it is fixed in next major release (2.0) (MDL-60301).
|
||||
|
||||
Updated by Ankit Agarwal<ankit.agrr@gmail.com> (MDL-60301)
|
||||
|
||||
2016/11/15
|
||||
----------
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
<location>fpdi</location>
|
||||
<name>FPDI</name>
|
||||
<license>MIT</license>
|
||||
<version>1.6.1</version>
|
||||
<version>1.6.2</version>
|
||||
<licenseversion></licenseversion>
|
||||
</library>
|
||||
</libraries>
|
||||
|
Loading…
x
Reference in New Issue
Block a user