From 4188f38ad56d7ba2ea46e94403f305243514f80c Mon Sep 17 00:00:00 2001 From: tcit Date: Thu, 24 Jul 2014 15:49:36 +0200 Subject: add pdf and mobi libraries --- inc/3rdparty/libraries/mpdf/mpdfi/pdf_context.php | 78 +++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 inc/3rdparty/libraries/mpdf/mpdfi/pdf_context.php (limited to 'inc/3rdparty/libraries/mpdf/mpdfi/pdf_context.php') diff --git a/inc/3rdparty/libraries/mpdf/mpdfi/pdf_context.php b/inc/3rdparty/libraries/mpdf/mpdfi/pdf_context.php new file mode 100644 index 00000000..6cf4bdcc --- /dev/null +++ b/inc/3rdparty/libraries/mpdf/mpdfi/pdf_context.php @@ -0,0 +1,78 @@ +file = $f; + $this->reset(); + } + + // Optionally move the file + // pointer to a new location + // and reset the buffered data + + function reset($pos = null, $l = 100) { + if (!is_null ($pos)) { + fseek ($this->file, $pos); + } + + $this->buffer = $l > 0 ? fread($this->file, $l) : ''; + $this->offset = 0; + $this->length = strlen($this->buffer); + $this->stack = array(); + } + + // Make sure that there is at least one + // character beyond the current offset in + // the buffer to prevent the tokenizer + // from attempting to access data that does + // not exist + + function ensure_content() { + if ($this->offset >= $this->length - 1) { + return $this->increase_length(); + } else { + return true; + } + } + + // Forcefully read more data into the buffer + + function increase_length($l=100) { + if (feof($this->file)) { + return false; + } else { + $this->buffer .= fread($this->file, $l); + $this->length = strlen($this->buffer); + return true; + } + } + +} +?> \ No newline at end of file -- cgit v1.2.3