--- a/web/lib/Zend/Pdf.php Sun Apr 21 10:07:03 2013 +0200
+++ b/web/lib/Zend/Pdf.php Sun Apr 21 21:54:24 2013 +0200
@@ -14,9 +14,9 @@
*
* @category Zend
* @package Zend_Pdf
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: Pdf.php 22908 2010-08-25 20:52:47Z alexander $
+ * @version $Id: Pdf.php 24593 2012-01-05 20:35:02Z matthew $
*/
@@ -78,7 +78,7 @@
*
* @category Zend
* @package Zend_Pdf
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf
@@ -210,6 +210,14 @@
protected static $_inheritableAttributes = array('Resources', 'MediaBox', 'CropBox', 'Rotate');
/**
+ * True if the object is a newly created PDF document (affects save() method behavior)
+ * False otherwise
+ *
+ * @var boolean
+ */
+ protected $_isNewDocument = true;
+
+ /**
* Request used memory manager
*
* @return Zend_Memory_Manager
@@ -262,7 +270,8 @@
/**
* Render PDF document and save it.
*
- * If $updateOnly is true, then it only appends new section to the end of file.
+ * If $updateOnly is true and it's not a new document, then it only
+ * appends new section to the end of file.
*
* @param string $filename
* @param boolean $updateOnly
@@ -348,6 +357,8 @@
$this->_originalProperties = $this->properties;
}
+
+ $this->_isNewDocument = false;
} else {
$this->_pdfHeaderVersion = Zend_Pdf::PDF_VERSION;
@@ -1174,7 +1185,8 @@
/**
* Render the completed PDF to a string.
- * If $newSegmentOnly is true, then only appended part of PDF is returned.
+ * If $newSegmentOnly is true and it's not a new document,
+ * then only appended part of PDF is returned.
*
* @param boolean $newSegmentOnly
* @param resource $outputStream
@@ -1183,6 +1195,12 @@
*/
public function render($newSegmentOnly = false, $outputStream = null)
{
+ if ($this->_isNewDocument) {
+ // Drop full document first time even $newSegmentOnly is set to true
+ $newSegmentOnly = false;
+ $this->_isNewDocument = false;
+ }
+
// Save document properties if necessary
if ($this->properties != $this->_originalProperties) {
$docInfo = $this->_objFactory->newObject(new Zend_Pdf_Element_Dictionary());